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

Unified Diff: chrome/renderer/guest_view/chrome_guest_view_container_dispatcher.cc

Issue 1602663003: Framelet Prototype 2016 using Mojo IPC Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Disabled oilpan Created 4 years, 11 months 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
« no previous file with comments | « chrome/renderer/guest_view/chrome_guest_view_container_dispatcher.h ('k') | components/components.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/guest_view/chrome_guest_view_container_dispatcher.cc
diff --git a/chrome/renderer/guest_view/chrome_guest_view_container_dispatcher.cc b/chrome/renderer/guest_view/chrome_guest_view_container_dispatcher.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9dd5200fb1fac0371443a3e0574b1f85c2612b8f
--- /dev/null
+++ b/chrome/renderer/guest_view/chrome_guest_view_container_dispatcher.cc
@@ -0,0 +1,57 @@
+// Copyright 2015 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 "chrome/renderer/guest_view/chrome_guest_view_container_dispatcher.h"
+
+#include "components/framelet/common/framelet_messages.h"
+#include "content/public/renderer/render_frame.h"
+#include "content/public/renderer/render_thread.h"
+#include "content/public/renderer/render_view.h"
+#include "ipc/ipc_message.h"
+#include "ipc/ipc_message_macros.h"
+#include "third_party/WebKit/public/web/WebKit.h"
+#include "third_party/WebKit/public/web/WebLocalFrame.h"
+#include "v8/include/v8.h"
+
+namespace chrome {
+
+ChromeGuestViewContainerDispatcher::ChromeGuestViewContainerDispatcher() {}
+
+ChromeGuestViewContainerDispatcher::~ChromeGuestViewContainerDispatcher() {}
+
+bool ChromeGuestViewContainerDispatcher::HandlesMessage(
+ const IPC::Message& message) {
+ return GuestViewContainerDispatcherBase::HandlesMessage(message) ||
+ (IPC_MESSAGE_CLASS(message) == ChromeGuestViewMsgStart);
+}
+
+bool ChromeGuestViewContainerDispatcher::OnControlMessageReceived(
+ const IPC::Message& message) {
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP(ChromeGuestViewContainerDispatcher, message)
+ IPC_MESSAGE_HANDLER(ChromeGuestViewMsg_RequestHeapSize, OnRequestHeapSize);
+ IPC_MESSAGE_UNHANDLED(
+ handled = GuestViewContainerDispatcherBase::OnControlMessageReceived(
+ message));
+ IPC_END_MESSAGE_MAP();
+ return handled;
+}
+
+void ChromeGuestViewContainerDispatcher::OnRequestHeapSize(int routing_id) {
+ size_t heap_size = 0;
+ content::RenderView* render_view =
+ content::RenderView::FromRoutingID(routing_id);
+ if (render_view) {
+ v8::Isolate* isolate = blink::mainThreadIsolate();
+ v8::HandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = render_view->GetMainRenderFrame()
+ ->GetWebFrame()
+ ->mainWorldScriptContext();
+ heap_size = context->EstimatedSize();
+ }
+ content::RenderThread::Get()->Send(
+ new ChromeGuestViewHostMsg_HeapSize(routing_id, heap_size));
+}
+
+} // namespace chrome
« no previous file with comments | « chrome/renderer/guest_view/chrome_guest_view_container_dispatcher.h ('k') | components/components.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698