Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1427)

Unified Diff: sky/viewer/document_view.cc

Issue 746713002: Move InspectorBackendMojo out of the blink namespace (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sky/viewer/document_view.cc
diff --git a/sky/viewer/document_view.cc b/sky/viewer/document_view.cc
index 75d974289ebeeb9dad59388de74b370165303007..58aff2f908e16b4a1da77077954c0c24c4c44600 100644
--- a/sky/viewer/document_view.cc
+++ b/sky/viewer/document_view.cc
@@ -19,6 +19,7 @@
#include "skia/ext/refptr.h"
#include "sky/engine/public/platform/Platform.h"
#include "sky/engine/public/platform/WebHTTPHeaderVisitor.h"
+#include "sky/engine/public/web/Sky.h"
#include "sky/engine/public/web/WebConsoleMessage.h"
#include "sky/engine/public/web/WebDocument.h"
#include "sky/engine/public/web/WebElement.h"
@@ -27,6 +28,8 @@
#include "sky/engine/public/web/WebScriptSource.h"
#include "sky/engine/public/web/WebSettings.h"
#include "sky/engine/public/web/WebView.h"
+#include "sky/engine/v8_inspector/inspector_backend_mojo.h"
+#include "sky/engine/v8_inspector/inspector_host.h"
#include "sky/viewer/converters/input_event_types.h"
#include "sky/viewer/converters/url_request_types.h"
#include "sky/viewer/internals.h"
@@ -253,4 +256,31 @@ void DocumentView::OnViewInputEvent(
web_view_->handleInputEvent(*web_event);
}
+class InspectorHostImpl : public inspector::InspectorHost {
+ public:
+ InspectorHostImpl(blink::WebView* web_view, mojo::Shell* shell)
+ : web_view_(web_view), shell_(shell) {}
+
+ virtual ~InspectorHostImpl() {}
+
+ mojo::Shell* GetShell() override { return shell_; }
+ v8::Isolate* GetIsolate() override { return blink::mainThreadIsolate(); }
+ v8::Local<v8::Context> GetContext() override {
+ return web_view_->mainFrame()->mainWorldScriptContext();
+ }
+
+ private:
+ blink::WebView* web_view_;
+ mojo::Shell* shell_;
+};
+
+void DocumentView::StartDebuggerInspectorBackend() {
+ if (!inspector_backend_) {
+ inspector_host_.reset(new InspectorHostImpl(web_view_, shell_.get()));
+ inspector_backend_.reset(
+ new inspector::InspectorBackendMojo(inspector_host_.get()));
+ }
+ inspector_backend_->Connect();
+}
+
} // namespace sky

Powered by Google App Engine
This is Rietveld 408576698