Don't start the Observatory when testing Sky viewer

This commit is contained in:
Collin Jackson 2015-05-21 13:54:48 -07:00
parent 4c6f6cd8a8
commit 1408fcff9a
5 changed files with 20 additions and 5 deletions

View File

@ -11,6 +11,7 @@
#include "base/trace_event/trace_event.h"
#include "dart/runtime/bin/embedded_dart_io.h"
#include "dart/runtime/include/dart_mirrors_api.h"
#include "gen/sky/platform/RuntimeEnabledFeatures.h"
#include "sky/engine/bindings/builtin.h"
#include "sky/engine/bindings/builtin_natives.h"
#include "sky/engine/bindings/builtin_sky.h"
@ -257,11 +258,13 @@ static Dart_Isolate IsolateCreateCallback(const char* script_uri,
// Start the handle watcher from the service isolate so it isn't available
// for debugging or general Observatory interaction.
EnsureHandleWatcherStarted();
std::string ip = "127.0.0.1";
const intptr_t port = 8181;
const bool service_isolate_booted =
DartServiceIsolate::Startup(ip, port, LibraryTagHandler, error);
CHECK(service_isolate_booted) << error;
if (RuntimeEnabledFeatures::observatoryEnabled()) {
std::string ip = "127.0.0.1";
const intptr_t port = 8181;
const bool service_isolate_booted =
DartServiceIsolate::Startup(ip, port, LibraryTagHandler, error);
CHECK(service_isolate_booted) << error;
}
}
Dart_ExitIsolate();
return isolate;

View File

@ -118,3 +118,5 @@ WOFF2 status=stable
PseudoClassesInMatchingCriteriaInAuthorShadowTrees status=test
CredentialManager status=test
Observatory status=stable

View File

@ -94,6 +94,8 @@ public:
BLINK_EXPORT static void enableLaxMixedContentChecking(bool);
BLINK_EXPORT static void enableObservatory(bool);
private:
WebRuntimeFeatures();
};

View File

@ -176,4 +176,9 @@ void WebRuntimeFeatures::enableLaxMixedContentChecking(bool enable)
RuntimeEnabledFeatures::setLaxMixedContentCheckingEnabled(enable);
}
void WebRuntimeFeatures::enableObservatory(bool enable)
{
RuntimeEnabledFeatures::setObservatoryEnabled(enable);
}
} // namespace blink

View File

@ -15,6 +15,7 @@
#include "mojo/public/cpp/application/interface_factory_impl.h"
#include "mojo/services/content_handler/public/interfaces/content_handler.mojom.h"
#include "sky/engine/public/web/Sky.h"
#include "sky/engine/public/web/WebRuntimeFeatures.h"
#include "sky/services/platform/platform_impl.h"
#include "sky/viewer/content_handler_impl.h"
#include "sky/viewer/document_view.h"
@ -34,6 +35,8 @@ class Viewer : public mojo::ApplicationDelegate,
void Initialize(mojo::ApplicationImpl* app) override {
RuntimeFlags::Initialize(app);
blink::WebRuntimeFeatures::enableObservatory(!RuntimeFlags::Get().testing());
mojo::NetworkServicePtr network_service;
app->ConnectToService("mojo:network_service", &network_service);
platform_impl_.reset(new PlatformImpl(network_service.Pass()));