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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/renderer/guest_view/chrome_guest_view_container_dispatcher.h"
6
7 #include "components/framelet/common/framelet_messages.h"
8 #include "content/public/renderer/render_frame.h"
9 #include "content/public/renderer/render_thread.h"
10 #include "content/public/renderer/render_view.h"
11 #include "ipc/ipc_message.h"
12 #include "ipc/ipc_message_macros.h"
13 #include "third_party/WebKit/public/web/WebKit.h"
14 #include "third_party/WebKit/public/web/WebLocalFrame.h"
15 #include "v8/include/v8.h"
16
17 namespace chrome {
18
19 ChromeGuestViewContainerDispatcher::ChromeGuestViewContainerDispatcher() {}
20
21 ChromeGuestViewContainerDispatcher::~ChromeGuestViewContainerDispatcher() {}
22
23 bool ChromeGuestViewContainerDispatcher::HandlesMessage(
24 const IPC::Message& message) {
25 return GuestViewContainerDispatcherBase::HandlesMessage(message) ||
26 (IPC_MESSAGE_CLASS(message) == ChromeGuestViewMsgStart);
27 }
28
29 bool ChromeGuestViewContainerDispatcher::OnControlMessageReceived(
30 const IPC::Message& message) {
31 bool handled = true;
32 IPC_BEGIN_MESSAGE_MAP(ChromeGuestViewContainerDispatcher, message)
33 IPC_MESSAGE_HANDLER(ChromeGuestViewMsg_RequestHeapSize, OnRequestHeapSize);
34 IPC_MESSAGE_UNHANDLED(
35 handled = GuestViewContainerDispatcherBase::OnControlMessageReceived(
36 message));
37 IPC_END_MESSAGE_MAP();
38 return handled;
39 }
40
41 void ChromeGuestViewContainerDispatcher::OnRequestHeapSize(int routing_id) {
42 size_t heap_size = 0;
43 content::RenderView* render_view =
44 content::RenderView::FromRoutingID(routing_id);
45 if (render_view) {
46 v8::Isolate* isolate = blink::mainThreadIsolate();
47 v8::HandleScope handle_scope(isolate);
48 v8::Local<v8::Context> context = render_view->GetMainRenderFrame()
49 ->GetWebFrame()
50 ->mainWorldScriptContext();
51 heap_size = context->EstimatedSize();
52 }
53 content::RenderThread::Get()->Send(
54 new ChromeGuestViewHostMsg_HeapSize(routing_id, heap_size));
55 }
56
57 } // namespace chrome
OLDNEW
« 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