Move inspector_backend_mojo.cc to v8_inspector

Also fixed several chromium style errors in the file.

I had to make web depend on v8_inspector for
the time being until v8_inspector can be
weened off of the Page class.

R=abarth@chromium.org, yurys@chromium.org
BUG=435243

Review URL: https://codereview.chromium.org/749523002
This commit is contained in:
Eric Seidel 2014-11-20 11:30:01 -08:00
parent 8061020580
commit bc10cd4167
9 changed files with 47 additions and 39 deletions

View File

@ -79,6 +79,5 @@ group("engine") {
"//sky/engine/public:sky_headers",
"//sky/engine/web",
"//sky/engine/platform",
"//sky/engine/v8_inspector",
]
}

View File

@ -26,7 +26,6 @@ source_set("libraries") {
"//mojo/services/public/interfaces/navigation",
"//skia",
"//sky/engine/wtf",
"//sky/services/inspector:bindings",
"//third_party/angle:translator",
"//third_party/iccjpeg",
"//third_party/libpng",

View File

@ -1052,8 +1052,6 @@ sky_core_files = [
"inspector/InjectedScriptHost.h",
"inspector/InjectedScriptManager.cpp",
"inspector/InjectedScriptManager.h",
"inspector/inspector_backend_mojo.cc",
"inspector/inspector_backend_mojo.h",
"inspector/InspectorBaseAgent.cpp",
"inspector/InspectorBaseAgent.h",
"inspector/InspectorCounters.cpp",

View File

@ -11,8 +11,13 @@ component("v8_inspector") {
output_name = "v8_inspector"
deps = [
"//sky/engine/core",
"//sky/engine/platform",
"//base",
"//mojo/public/cpp/application",
"//mojo/public/interfaces/application",
"//sky/engine/core", # FIXME: Remove.
"//sky/engine/platform", # FIXME: Remove.
"//sky/engine/public:sky_headers",
"//sky/services/inspector:bindings",
]
configs += [
@ -22,6 +27,7 @@ component("v8_inspector") {
]
sources = [
"inspector_backend_mojo.cc",
"inspector_backend_mojo.h",
]
}

View File

@ -2,45 +2,43 @@
// 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 "sky/engine/config.h"
#include "v8_inspector/inspector_backend_mojo.h"
#include "base/memory/scoped_ptr.h"
#include "base/run_loop.h"
#include "bindings/core/v8/PageScriptDebugServer.h"
#include "bindings/core/v8/ScriptController.h"
#include "core/frame/FrameHost.h"
#include "core/inspector/InspectorState.h"
#include "core/inspector/InstrumentingAgents.h"
#include "core/inspector/PageDebuggerAgent.h"
#include "core/page/Page.h"
#include "gen/sky/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 "platform/JSONValues.h"
#include "public/platform/ServiceProvider.h"
#include "sky/engine/core/frame/FrameHost.h"
#include "sky/engine/core/inspector/InspectorState.h"
#include "sky/engine/core/inspector/InstrumentingAgents.h"
#include "sky/engine/core/inspector/PageDebuggerAgent.h"
#include "sky/engine/core/page/Page.h"
#include "sky/engine/platform/JSONValues.h"
#include "sky/engine/public/platform/ServiceProvider.h"
namespace blink {
class MessageLoopAdaptor : public PageScriptDebugServer::ClientMessageLoop {
public:
MessageLoopAdaptor() { }
public:
MessageLoopAdaptor() {}
private:
virtual void run(Page* page)
{
run_loop_.reset(new base::RunLoop());
run_loop_->Run();
}
private:
virtual void run(Page* page) {
run_loop_.reset(new base::RunLoop());
run_loop_->Run();
}
virtual void quitNow()
{
if (run_loop_)
run_loop_->Quit();
}
virtual void quitNow() {
if (run_loop_)
run_loop_->Quit();
}
scoped_ptr<base::RunLoop> run_loop_;
scoped_ptr<base::RunLoop> run_loop_;
};
InspectorBackendMojo::InspectorBackendMojo(const FrameHost& frame_host)
@ -59,7 +57,8 @@ void InspectorBackendMojo::Connect() {
frontend_.set_client(this);
// Theoretically we should load our state from the inspector cookie.
inspector_state_ = adoptPtr(new InspectorState(nullptr, JSONObject::create()));
inspector_state_ =
adoptPtr(new InspectorState(nullptr, JSONObject::create()));
old_frontend_ = adoptPtr(new InspectorFrontend(this));
v8::Isolate* isolate = frame_host_.page().mainFrame()->script().isolate();
@ -69,7 +68,9 @@ void InspectorBackendMojo::Connect() {
// 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());
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());
@ -101,7 +102,7 @@ void InspectorBackendMojo::OnMessage(const mojo::String& message) {
// if agents are missing, since we only want this backend to care about
// the Debugger agent, we manually filter here.
if (command_name.startsWith("Debugger"))
dispatcher_->dispatch(wtf_message);
dispatcher_->dispatch(wtf_message);
}
} // namespace blink
} // namespace blink

View File

@ -20,14 +20,14 @@ class InstrumentingAgents;
class InspectorFrontend;
class InspectorBackendMojo : public mojo::InterfaceImpl<sky::InspectorBackend>,
public InspectorFrontendChannel {
public:
public InspectorFrontendChannel {
public:
explicit InspectorBackendMojo(const FrameHost& frame_host);
~InspectorBackendMojo();
void Connect();
private:
private:
// InspectorBackend:
void OnConnect() override;
void OnDisconnect() override;

View File

@ -25,6 +25,9 @@ component("web") {
deps = [
"//sky/engine/core",
"//sky/engine/platform",
# FIXME: v8_inspector should not depend on core types and be separate
# from both web and core.
"//sky/engine/v8_inspector",
]
configs += [

View File

@ -51,7 +51,7 @@
#include "core/html/HTMLImportElement.h"
#include "core/html/ime/InputMethodContext.h"
#include "gen/sky/core/HTMLNames.h"
#include "core/inspector/inspector_backend_mojo.h"
#include "v8_inspector/inspector_backend_mojo.h"
#include "core/loader/FrameLoader.h"
#include "core/loader/UniqueIdentifier.h"
#include "core/page/Chrome.h"

View File

@ -32,7 +32,6 @@
#define WebViewImpl_h
#include "core/html/ime/InputMethodContext.h"
#include "core/inspector/inspector_backend_mojo.h"
#include "platform/geometry/IntPoint.h"
#include "platform/geometry/IntRect.h"
#include "platform/graphics/GraphicsLayer.h"
@ -63,6 +62,7 @@ class WebActiveGestureAnimation;
class WebLocalFrameImpl;
class WebImage;
class WebSettingsImpl;
class InspectorBackendMojo;
class WebViewImpl final : public WebView
, public RefCounted<WebViewImpl>
@ -451,6 +451,8 @@ private:
bool m_userGestureObserved;
// FIXME(sky): InspectorBackendMojo should be a peer to WebView
// however right now it depends on acccess to the Page.
OwnPtr<InspectorBackendMojo> m_inspectorBackend;
};