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

Unified Diff: chrome/browser/guest_view/chrome_guest_view_message_filter.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
Index: chrome/browser/guest_view/chrome_guest_view_message_filter.cc
diff --git a/chrome/browser/guest_view/chrome_guest_view_message_filter.cc b/chrome/browser/guest_view/chrome_guest_view_message_filter.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1bc5b9fecb2df391621034d8450d69dcaad25dd3
--- /dev/null
+++ b/chrome/browser/guest_view/chrome_guest_view_message_filter.cc
@@ -0,0 +1,85 @@
+// 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/browser/guest_view/chrome_guest_view_message_filter.h"
+
+#include "chrome/browser/guest_view/chrome_guest_view_manager_delegate.h"
+#include "components/framelet/browser/framelet_guest.h"
+#include "components/framelet/browser/framelet_memory_tracker.h"
+#include "components/framelet/common/framelet_constants.h"
+#include "components/framelet/common/framelet_messages.h"
+#include "components/guest_view/browser/guest_view_manager.h"
+#include "components/guest_view/common/guest_view_constants.h"
+#include "content/public/browser/render_frame_host.h"
+#include "content/public/browser/render_process_host.h"
+#include "content/public/browser/web_contents.h"
+#include "ipc/ipc_message_macros.h"
+#include "ipc/ipc_message_start.h"
+#include "ui/gfx/geometry/size.h"
+
+namespace chrome {
+
+namespace {
+
+const uint32_t kFilteredGuestViewMessageClasses[] = {
+ GuestViewMsgStart,
+#if defined(ENABLE_EXTENSIONS)
+ ExtensionsGuestViewMsgStart,
+#endif
+ ChromeGuestViewMsgStart};
+
+} // namespace
+
+ChromeGuestViewMessageFilter::ChromeGuestViewMessageFilter(
+ int render_process_id,
+ content::BrowserContext* context)
+ : GuestViewMessageFilterBase(kFilteredGuestViewMessageClasses,
+ arraysize(kFilteredGuestViewMessageClasses),
+ render_process_id,
+ context) {}
+
+ChromeGuestViewMessageFilter::~ChromeGuestViewMessageFilter() {}
+
+guest_view::GuestViewManager*
+ChromeGuestViewMessageFilter::GetOrCreateGuestViewManager() {
+ auto manager =
+ guest_view::GuestViewManager::FromBrowserContext(browser_context_);
+ if (!manager) {
+ manager = guest_view::GuestViewManager::CreateWithDelegate(
+ browser_context_,
+ make_scoped_ptr(
+ ChromeGuestViewManagerDelegate::Create(browser_context_)));
+ }
+ return manager;
+}
+
+bool ChromeGuestViewMessageFilter::OnMessageReceived(
+ const IPC::Message& message) {
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP(ChromeGuestViewMessageFilter, message)
+ IPC_MESSAGE_HANDLER(ChromeGuestViewHostMsg_HeapSize, OnHeapSize);
+ IPC_MESSAGE_UNHANDLED(
+ handled = GuestViewMessageFilterBase::OnMessageReceived(message));
+ IPC_END_MESSAGE_MAP();
+ return handled;
+}
+
+void ChromeGuestViewMessageFilter::OverrideThreadForMessage(
+ const IPC::Message& message,
+ content::BrowserThread::ID* thread) {
+ if (IPC_MESSAGE_CLASS(message) == ChromeGuestViewMsgStart) {
+ *thread = content::BrowserThread::UI;
+ return;
+ }
+ GuestViewMessageFilterBase::OverrideThreadForMessage(message, thread);
+}
+
+void ChromeGuestViewMessageFilter::OnHeapSize(int routing_id, int heap_size) {
+ framelet::FrameletMemoryTracker::ClientID client_id(render_process_id_,
+ routing_id);
+ framelet::FrameletMemoryTracker::FromBrowserContext(browser_context_)
+ ->ReportHeapSize(client_id, heap_size);
+}
+
+} // namespace chrome
« no previous file with comments | « chrome/browser/guest_view/chrome_guest_view_message_filter.h ('k') | chrome/browser/profiles/profile_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698