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

Unified Diff: extensions/browser/io_thread_extension_message_filter.h

Issue 901573003: Split ExtensionMessageFilter up into a UI thread part and an IO thread part. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: review Created 5 years, 10 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: extensions/browser/io_thread_extension_message_filter.h
diff --git a/extensions/browser/io_thread_extension_message_filter.h b/extensions/browser/io_thread_extension_message_filter.h
new file mode 100644
index 0000000000000000000000000000000000000000..e45a253af19a973d78368455bad3d222f2679914
--- /dev/null
+++ b/extensions/browser/io_thread_extension_message_filter.h
@@ -0,0 +1,66 @@
+// 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.
+
+#ifndef EXTENSIONS_BROWSER_IO_THREAD_EXTENSION_MESSAGE_FILTER_H_
+#define EXTENSIONS_BROWSER_IO_THREAD_EXTENSION_MESSAGE_FILTER_H_
+
+#include "base/compiler_specific.h"
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "content/public/browser/browser_message_filter.h"
+
+struct ExtensionHostMsg_Request_Params;
+
+namespace content {
+class BrowserContext;
+}
+
+namespace extensions {
+
+class InfoMap;
+
+// This class filters out incoming extension-specific IPC messages from the
+// renderer process. It is created on the UI thread, but handles messages on the
+// IO thread and is destroyed there.
+class IOThreadExtensionMessageFilter : public content::BrowserMessageFilter {
+ public:
+ IOThreadExtensionMessageFilter(int render_process_id,
+ content::BrowserContext* context);
+
+ int render_process_id() { return render_process_id_; }
+
+ private:
+ friend class base::DeleteHelper<IOThreadExtensionMessageFilter>;
+ friend class content::BrowserThread;
+
+ ~IOThreadExtensionMessageFilter() override;
+
+ // content::BrowserMessageFilter implementation.
+ void OnDestruct() const override;
+ bool OnMessageReceived(const IPC::Message& message) override;
+
+ // Message handlers on the IO thread.
+ void OnExtensionGenerateUniqueID(int* unique_id);
+ void OnExtensionResumeRequests(int route_id);
+ void OnExtensionRequestForIOThread(
+ int routing_id,
+ const ExtensionHostMsg_Request_Params& params);
+
+ const int render_process_id_;
+
+ // The browser context as a void pointer, for use as an identifier on the IO
+ // thread.
+ void* browser_context_id_;
+
+ scoped_refptr<extensions::InfoMap> extension_info_map_;
+
+ // Weak pointers produced by this factory are bound to the IO thread.
+ base::WeakPtrFactory<IOThreadExtensionMessageFilter> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(IOThreadExtensionMessageFilter);
+};
+
+} // namespace extensions
+
+#endif // EXTENSIONS_BROWSER_IO_THREAD_EXTENSION_MESSAGE_FILTER_H_
« no previous file with comments | « extensions/browser/extension_message_filter.cc ('k') | extensions/browser/io_thread_extension_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698