mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Roll Dart (#3194)
Update DartServiceIsolate/FlutterView because VMServiceIO_NotifyServerState now provides a URI for the observatory
This commit is contained in:
parent
b3ca46b363
commit
e54b0e286b
2
DEPS
2
DEPS
@ -27,7 +27,7 @@ vars = {
|
||||
|
||||
# Note: When updating the Dart revision, ensure that all entries that are
|
||||
# dependencies of dart are also updated
|
||||
'dart_revision': '9f0e4e1162298625c2d90213076c3dcac4dc41a5',
|
||||
'dart_revision': '823bb1a0a2f0cd6d41b9150be3ae89771257a31c',
|
||||
'dart_boringssl_gen_revision': '62c20247d582444cb2804f9ea4e3abaa6e47f6a5',
|
||||
'dart_boringssl_revision': '8d343b44bbab829d1a28fdef650ca95f7db4412e',
|
||||
'dart_observatory_packages_revision': '26aad88f1c1915d39bbcbff3cad589e2402fdcf1',
|
||||
|
||||
@ -41,7 +41,7 @@ namespace {
|
||||
static Dart_LibraryTagHandler g_embedder_tag_handler;
|
||||
static tonic::DartLibraryNatives* g_natives;
|
||||
static EmbedderResources* g_resources;
|
||||
static int observatory_port_;
|
||||
static std::string observatory_uri_;
|
||||
|
||||
Dart_NativeFunction GetNativeFunction(Dart_Handle name,
|
||||
int argument_count,
|
||||
@ -66,14 +66,14 @@ void DartServiceIsolate::TriggerResourceLoad(Dart_NativeArguments args) {
|
||||
|
||||
void DartServiceIsolate::NotifyServerState(Dart_NativeArguments args) {
|
||||
Dart_Handle exception = nullptr;
|
||||
int port = tonic::DartConverter<int>::FromArguments(args, 1, exception);
|
||||
std::string uri = tonic::DartConverter<std::string>::FromArguments(args, 0, exception);
|
||||
if (!exception) {
|
||||
observatory_port_ = port;
|
||||
observatory_uri_ = uri;
|
||||
}
|
||||
}
|
||||
|
||||
int DartServiceIsolate::GetObservatoryPort() {
|
||||
return observatory_port_;
|
||||
std::string DartServiceIsolate::GetObservatoryUri() {
|
||||
return observatory_uri_;
|
||||
}
|
||||
|
||||
void DartServiceIsolate::Shutdown(Dart_NativeArguments args) {
|
||||
@ -97,7 +97,7 @@ bool DartServiceIsolate::Startup(std::string server_ip,
|
||||
if (!g_natives) {
|
||||
g_natives = new tonic::DartLibraryNatives();
|
||||
g_natives->Register({
|
||||
{"VMServiceIO_NotifyServerState", NotifyServerState, 2, true},
|
||||
{"VMServiceIO_NotifyServerState", NotifyServerState, 1, true},
|
||||
{"VMServiceIO_Shutdown", Shutdown, 0, true},
|
||||
});
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ class DartServiceIsolate {
|
||||
bool disable_origin_check,
|
||||
char** error);
|
||||
|
||||
static int GetObservatoryPort();
|
||||
static std::string GetObservatoryUri();
|
||||
|
||||
private:
|
||||
// Native entries.
|
||||
|
||||
@ -37,6 +37,7 @@ import org.json.JSONObject;
|
||||
import org.chromium.base.CalledByNative;
|
||||
import org.chromium.base.JNINamespace;
|
||||
|
||||
import java.net.URI;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@ -492,7 +493,7 @@ public class FlutterView extends SurfaceView
|
||||
}
|
||||
|
||||
private static native long nativeAttach(FlutterView view);
|
||||
private static native int nativeGetObservatoryPort();
|
||||
private static native String nativeGetObservatoryUri();
|
||||
private static native void nativeDetach(long nativePlatformViewAndroid);
|
||||
private static native void nativeSurfaceCreated(long nativePlatformViewAndroid,
|
||||
Surface surface,
|
||||
@ -758,10 +759,11 @@ public class FlutterView extends SurfaceView
|
||||
private class DiscoveryReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
URI observatoryUri = URI.create(nativeGetObservatoryUri());
|
||||
JSONObject discover = new JSONObject();
|
||||
try {
|
||||
discover.put("id", getContext().getPackageName());
|
||||
discover.put("observatoryPort", nativeGetObservatoryPort());
|
||||
discover.put("observatoryPort", observatoryUri.getPort());
|
||||
Log.i(TAG, "DISCOVER: " + discover);
|
||||
} catch (JSONException e) {}
|
||||
}
|
||||
|
||||
@ -521,8 +521,9 @@ void PlatformViewAndroid::GetBitmapGpuTask(ftl::AutoResetWaitableEvent* latch,
|
||||
latch->Signal();
|
||||
}
|
||||
|
||||
jint GetObservatoryPort(JNIEnv* env, jclass clazz) {
|
||||
return blink::DartServiceIsolate::GetObservatoryPort();
|
||||
jstring GetObservatoryUri(JNIEnv* env, jclass clazz) {
|
||||
return env->NewStringUTF(
|
||||
blink::DartServiceIsolate::GetObservatoryUri().c_str());
|
||||
}
|
||||
|
||||
bool PlatformViewAndroid::Register(JNIEnv* env) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user