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

Unified Diff: content/public/browser/browser_message_filter.h

Issue 9665014: Modify BrowserMessageFilter::OverrideThreadForMessage to allow the subclasses to specificy either a… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 | « no previous file | content/public/browser/browser_message_filter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/browser/browser_message_filter.h
===================================================================
--- content/public/browser/browser_message_filter.h (revision 126267)
+++ content/public/browser/browser_message_filter.h (working copy)
@@ -11,6 +11,10 @@
#include "content/public/browser/browser_thread.h"
#include "ipc/ipc_channel_proxy.h"
+namespace base {
+class TaskRunner;
+}
+
namespace content {
// Base class for message filters in the browser process. You can receive and
@@ -36,15 +40,26 @@
virtual bool Send(IPC::Message* message) OVERRIDE;
// If you want the given message to be dispatched to your OnMessageReceived on
- // a different thread, change |thread| to the id of the target thread.
- // If you don't handle this message, or want to keep it on the IO thread, do
- // nothing.
- virtual void OverrideThreadForMessage(const IPC::Message& message,
- content::BrowserThread::ID* thread);
+ // a different thread, there are two options, either
+ // OverrideThreadForMessage or OverrideTaskRunnerForMessage.
+ // If neither is overriden, the message will be dispatched on the IO thread.
+ // If you want the message to be dispatched on a particular well-known
+ // browser thread, change |thread| to the id of the target thread
+ virtual void OverrideThreadForMessage(
+ const IPC::Message& message,
+ BrowserThread::ID* thread);
+
+ // If you want the message to be dispatched via the SequencedWorkerPool,
+ // return a non-null task runner which will target tasks accordingly.
+ // Note: To target the UI thread, please use OverrideThreadForMessage
+ // since that has extra checks to avoid deadlocks.
+ virtual base::TaskRunner* OverrideTaskRunnerForMessage(
+ const IPC::Message& message);
+
// Override this to receive messages.
// Your function will normally be called on the IO thread. However, if your
- // OverrideThreadForMessage modifies the thread used to dispatch the message,
+ // OverrideXForMessage modifies the thread used to dispatch the message,
// your function will be called on the requested thread.
virtual bool OnMessageReceived(const IPC::Message& message,
bool* message_was_ok) = 0;
« no previous file with comments | « no previous file | content/public/browser/browser_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698