Chromium Code Reviews| Index: sky/engine/core/inspector/inspector_backend_mojo.cc |
| diff --git a/sky/engine/core/inspector/inspector_backend_mojo.cc b/sky/engine/core/inspector/inspector_backend_mojo.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..917bc1780c67651169f0e0431061b9fdfe5224d4 |
| --- /dev/null |
| +++ b/sky/engine/core/inspector/inspector_backend_mojo.cc |
| @@ -0,0 +1,76 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "config.h" |
| +#include "core/inspector/inspector_backend_mojo.h" |
| + |
| +#include "core/frame/FrameHost.h" |
| +#include "core/page/Page.h" |
| +#include "core/inspector/JSONValues.h" |
| +#include "core/inspector/InspectorState.h" |
| +#include "core/inspector/InstrumentingAgents.h" |
| +#include "core/inspector/PageDebuggerAgent.h" |
| +#include "bindings/core/v8/PageScriptDebugServer.h" |
| +#include "core/InspectorBackendDispatcher.h" |
| +#include "mojo/public/cpp/application/connect.h" |
| +#include "mojo/public/cpp/application/service_provider_impl.h" |
| +#include "mojo/public/interfaces/application/shell.mojom.h" |
| +#include "public/platform/ServiceProvider.h" |
| +#include "bindings/core/v8/ScriptController.h" |
| + |
| +namespace blink { |
| + |
| +InspectorBackendMojo::InspectorBackendMojo(const FrameHost& frame_host) |
| + : frame_host_(frame_host) { |
| +} |
| + |
| +InspectorBackendMojo::~InspectorBackendMojo() { |
| +} |
| + |
| +void InspectorBackendMojo::Connect() { |
| + mojo::Shell* shell = frame_host_.services().Shell(); |
| + mojo::ServiceProviderPtr inspector_service_provider; |
| + shell->ConnectToApplication("mojo:sky_inspector_server", |
| + GetProxy(&inspector_service_provider)); |
| + mojo::ConnectToService(inspector_service_provider.get(), &frontend_); |
| + frontend_.set_client(this); |
| + |
| + // Theoretically we should load our state from the inspector cookie. |
| + inspector_state_ = adoptPtr(new InspectorState(nullptr, JSONObject::create())); |
| + old_frontend_ = adoptPtr(new InspectorFrontend(this)); |
| + |
| + // FIXME: This is dumb, required to not crash. |
| + v8::Isolate* isolate = frame_host_.page().mainFrame()->script().isolate(); |
| + PageScriptDebugServer::setMainThreadIsolate(isolate); |
|
yurys
2014/11/14 07:38:31
You'll also need to supply the debug server with a
|
| + |
| + // AgentRegistry used to do this, but we don't need it for one agent. |
| + script_manager_ = InjectedScriptManager::createForPage(); |
| + debugger_agent_ = PageDebuggerAgent::create(&PageScriptDebugServer::shared(), &frame_host_.page(), script_manager_.get()); |
| + agents_ = adoptPtr(new InstrumentingAgents(debugger_agent_.get())); |
| + debugger_agent_->init(agents_.get(), inspector_state_.get()); |
| + debugger_agent_->setFrontend(old_frontend_.get()); |
| + |
| + dispatcher_ = InspectorBackendDispatcher::create(this); |
| + dispatcher_->registerAgent(debugger_agent_.get()); |
| +} |
| + |
| +void InspectorBackendMojo::sendMessageToFrontend( |
| + PassRefPtr<JSONObject> message) { |
| +} |
| + |
| +void InspectorBackendMojo::flush() { |
| + // TODO(eseidel): Unclear if this is needed. |
| +} |
| + |
| +void InspectorBackendMojo::OnConnect() { |
| +} |
| + |
| +void InspectorBackendMojo::OnDisconnect() { |
| +} |
| + |
| +void InspectorBackendMojo::OnMessage(const mojo::String& message) { |
| + dispatcher_->dispatch(String::fromUTF8(message.To<std::string>())); |
| +} |
| + |
| +} // namespace blink |