diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-24 06:19:28 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-24 06:19:28 +0000 |
commit | a95986a837fc86e079b5c6dac357636478b50092 (patch) | |
tree | 66a32009250791e64741216cdd6c21ecf1ff7f86 | |
parent | 125a7ba65ad10ace9edcf36d6943ce9ae2bdc1d6 (diff) | |
download | chromium_src-a95986a837fc86e079b5c6dac357636478b50092.zip chromium_src-a95986a837fc86e079b5c6dac357636478b50092.tar.gz chromium_src-a95986a837fc86e079b5c6dac357636478b50092.tar.bz2 |
Make IPC::Channel::Listener:OnMessageReceived have a return value indicating whether a message was processed or not.
TBR=brettw
Review URL: http://codereview.chromium.org/5978003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70139 0039d316-1c4b-4281-b951-d872f2087c98
203 files changed, 643 insertions, 412 deletions
diff --git a/chrome/browser/appcache/appcache_dispatcher_host.cc b/chrome/browser/appcache/appcache_dispatcher_host.cc index 60172ea..8bcf53e 100644 --- a/chrome/browser/appcache/appcache_dispatcher_host.cc +++ b/chrome/browser/appcache/appcache_dispatcher_host.cc @@ -60,20 +60,19 @@ void AppCacheDispatcherHost::OnChannelConnected(int32 peer_pid) { bool AppCacheDispatcherHost::OnMessageReceived(const IPC::Message& message, bool* message_was_ok) { bool handled = true; - IPC_BEGIN_MESSAGE_MAP_EX(AppCacheDispatcherHost, message, *message_was_ok) - IPC_MESSAGE_HANDLER(AppCacheMsg_RegisterHost, OnRegisterHost); - IPC_MESSAGE_HANDLER(AppCacheMsg_UnregisterHost, OnUnregisterHost); - IPC_MESSAGE_HANDLER(AppCacheMsg_GetResourceList, OnGetResourceList); - IPC_MESSAGE_HANDLER(AppCacheMsg_SelectCache, OnSelectCache); + IPC_MESSAGE_HANDLER(AppCacheMsg_RegisterHost, OnRegisterHost) + IPC_MESSAGE_HANDLER(AppCacheMsg_UnregisterHost, OnUnregisterHost) + IPC_MESSAGE_HANDLER(AppCacheMsg_GetResourceList, OnGetResourceList) + IPC_MESSAGE_HANDLER(AppCacheMsg_SelectCache, OnSelectCache) IPC_MESSAGE_HANDLER(AppCacheMsg_SelectCacheForWorker, - OnSelectCacheForWorker); + OnSelectCacheForWorker) IPC_MESSAGE_HANDLER(AppCacheMsg_SelectCacheForSharedWorker, - OnSelectCacheForSharedWorker); - IPC_MESSAGE_HANDLER(AppCacheMsg_MarkAsForeignEntry, OnMarkAsForeignEntry); - IPC_MESSAGE_HANDLER_DELAY_REPLY(AppCacheMsg_GetStatus, OnGetStatus); - IPC_MESSAGE_HANDLER_DELAY_REPLY(AppCacheMsg_StartUpdate, OnStartUpdate); - IPC_MESSAGE_HANDLER_DELAY_REPLY(AppCacheMsg_SwapCache, OnSwapCache); + OnSelectCacheForSharedWorker) + IPC_MESSAGE_HANDLER(AppCacheMsg_MarkAsForeignEntry, OnMarkAsForeignEntry) + IPC_MESSAGE_HANDLER_DELAY_REPLY(AppCacheMsg_GetStatus, OnGetStatus) + IPC_MESSAGE_HANDLER_DELAY_REPLY(AppCacheMsg_StartUpdate, OnStartUpdate) + IPC_MESSAGE_HANDLER_DELAY_REPLY(AppCacheMsg_SwapCache, OnSwapCache) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP_EX() diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index e4e1909..b782c2c 100644 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -358,14 +358,15 @@ void AutomationProvider::OnChannelConnected(int pid) { Send(new AutomationMsg_InitialLoadsComplete()); } -void AutomationProvider::OnMessageReceived(const IPC::Message& message) { +bool AutomationProvider::OnMessageReceived(const IPC::Message& message) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(AutomationProvider, message) #if !defined(OS_MACOSX) IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WindowDrag, WindowSimulateDrag) #endif // !defined(OS_MACOSX) IPC_MESSAGE_HANDLER(AutomationMsg_HandleUnused, HandleUnused) - IPC_MESSAGE_HANDLER(AutomationMsg_SetProxyConfig, SetProxyConfig); + IPC_MESSAGE_HANDLER(AutomationMsg_SetProxyConfig, SetProxyConfig) IPC_MESSAGE_HANDLER(AutomationMsg_PrintAsync, PrintAsync) IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_Find, HandleFindRequest) IPC_MESSAGE_HANDLER(AutomationMsg_OverrideEncoding, OverrideEncoding) @@ -429,8 +430,9 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_LoginWithUserAndPass, LoginWithUserAndPass) #endif // defined(OS_CHROMEOS) - IPC_MESSAGE_UNHANDLED(OnUnhandledMessage()) + IPC_MESSAGE_UNHANDLED(handled = false;OnUnhandledMessage()) IPC_END_MESSAGE_MAP() + return handled; } void AutomationProvider::OnUnhandledMessage() { diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h index 40b9bce..4eb6f96 100644 --- a/chrome/browser/automation/automation_provider.h +++ b/chrome/browser/automation/automation_provider.h @@ -148,7 +148,7 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, // IPC implementations virtual bool Send(IPC::Message* msg); virtual void OnChannelConnected(int pid); - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); virtual void OnChannelError(); IPC::Message* reply_message_release() { diff --git a/chrome/browser/automation/chrome_frame_automation_provider.cc b/chrome/browser/automation/chrome_frame_automation_provider.cc index 8fb0621..7b699f1 100644 --- a/chrome/browser/automation/chrome_frame_automation_provider.cc +++ b/chrome/browser/automation/chrome_frame_automation_provider.cc @@ -12,13 +12,13 @@ ChromeFrameAutomationProvider::ChromeFrameAutomationProvider(Profile* profile) : AutomationProvider(profile) {} -void ChromeFrameAutomationProvider::OnMessageReceived( +bool ChromeFrameAutomationProvider::OnMessageReceived( const IPC::Message& message) { - if (IsValidMessage(message.type())) { - AutomationProvider::OnMessageReceived(message); - } else { - OnUnhandledMessage(message); - } + if (IsValidMessage(message.type())) + return AutomationProvider::OnMessageReceived(message); + + OnUnhandledMessage(message); + return false; } void ChromeFrameAutomationProvider::OnUnhandledMessage( diff --git a/chrome/browser/automation/chrome_frame_automation_provider.h b/chrome/browser/automation/chrome_frame_automation_provider.h index fad6bd8..f2a67e0 100644 --- a/chrome/browser/automation/chrome_frame_automation_provider.h +++ b/chrome/browser/automation/chrome_frame_automation_provider.h @@ -24,7 +24,7 @@ class ChromeFrameAutomationProvider : public AutomationProvider { explicit ChromeFrameAutomationProvider(Profile* profile); // IPC::Channel::Listener overrides. - virtual void OnMessageReceived(const IPC::Message& message); + virtual bool OnMessageReceived(const IPC::Message& message); protected: // This function is called when we receive an invalid message type. diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 78afce1..103225b 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -203,8 +203,9 @@ void TestingAutomationProvider::Observe(NotificationType type, Release(); } -void TestingAutomationProvider::OnMessageReceived( +bool TestingAutomationProvider::OnMessageReceived( const IPC::Message& message) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(TestingAutomationProvider, message) IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_CloseBrowser, CloseBrowser) IPC_MESSAGE_HANDLER(AutomationMsg_CloseBrowserRequestAsync, @@ -389,8 +390,10 @@ void TestingAutomationProvider::OnMessageReceived( IPC_MESSAGE_HANDLER(AutomationMsg_LoadBlockedPlugins, LoadBlockedPlugins) IPC_MESSAGE_HANDLER(AutomationMsg_ResetToDefaultTheme, ResetToDefaultTheme) - IPC_MESSAGE_UNHANDLED(AutomationProvider::OnMessageReceived(message)); + IPC_MESSAGE_UNHANDLED( + handled = AutomationProvider::OnMessageReceived(message)) IPC_END_MESSAGE_MAP() + return handled; } void TestingAutomationProvider::OnChannelError() { diff --git a/chrome/browser/automation/testing_automation_provider.h b/chrome/browser/automation/testing_automation_provider.h index 57f9572..6bda672 100644 --- a/chrome/browser/automation/testing_automation_provider.h +++ b/chrome/browser/automation/testing_automation_provider.h @@ -33,7 +33,7 @@ class TestingAutomationProvider : public AutomationProvider, virtual void OnBrowserRemoved(const Browser* browser); // IPC::Channel::Listener implementation. - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); virtual void OnChannelError(); private: diff --git a/chrome/browser/gpu_process_host.cc b/chrome/browser/gpu_process_host.cc index 511747b..9e374c4 100644 --- a/chrome/browser/gpu_process_host.cc +++ b/chrome/browser/gpu_process_host.cc @@ -132,13 +132,14 @@ bool GpuProcessHost::Send(IPC::Message* msg) { return BrowserChildProcessHost::Send(msg); } -void GpuProcessHost::OnMessageReceived(const IPC::Message& message) { +bool GpuProcessHost::OnMessageReceived(const IPC::Message& message) { DCHECK(CalledOnValidThread()); if (message.routing_id() == MSG_ROUTING_CONTROL) - OnControlMessageReceived(message); - else - RouteOnUIThread(message); + return OnControlMessageReceived(message); + + RouteOnUIThread(message); + return true; } void GpuProcessHost::EstablishGpuChannel(int renderer_id, @@ -178,7 +179,7 @@ GpuProcessHost::SynchronizationRequest::SynchronizationRequest( GpuProcessHost::SynchronizationRequest::~SynchronizationRequest() {} -void GpuProcessHost::OnControlMessageReceived(const IPC::Message& message) { +bool GpuProcessHost::OnControlMessageReceived(const IPC::Message& message) { DCHECK(CalledOnValidThread()); IPC_BEGIN_MESSAGE_MAP(GpuProcessHost, message) @@ -202,6 +203,8 @@ void GpuProcessHost::OnControlMessageReceived(const IPC::Message& message) { // handle it. IPC_MESSAGE_UNHANDLED(RouteOnUIThread(message)) IPC_END_MESSAGE_MAP() + + return true; } void GpuProcessHost::OnChannelEstablished( diff --git a/chrome/browser/gpu_process_host.h b/chrome/browser/gpu_process_host.h index a1b7c8c..14edf88 100644 --- a/chrome/browser/gpu_process_host.h +++ b/chrome/browser/gpu_process_host.h @@ -37,7 +37,7 @@ class GpuProcessHost : public BrowserChildProcessHost, public NonThreadSafe { virtual bool Send(IPC::Message* msg); // IPC::Channel::Listener implementation. - virtual void OnMessageReceived(const IPC::Message& message); + virtual bool OnMessageReceived(const IPC::Message& message); // Tells the GPU process to create a new channel for communication with a // renderer. Will asynchronously send message to object with given routing id @@ -77,7 +77,7 @@ class GpuProcessHost : public BrowserChildProcessHost, public NonThreadSafe { bool EnsureInitialized(); bool Init(); - void OnControlMessageReceived(const IPC::Message& message); + bool OnControlMessageReceived(const IPC::Message& message); // Message handlers. void OnChannelEstablished(const IPC::ChannelHandle& channel_handle, diff --git a/chrome/browser/gpu_process_host_ui_shim.cc b/chrome/browser/gpu_process_host_ui_shim.cc index d6b7d6a..87c7be2 100644 --- a/chrome/browser/gpu_process_host_ui_shim.cc +++ b/chrome/browser/gpu_process_host_ui_shim.cc @@ -63,13 +63,13 @@ void GpuProcessHostUIShim::RemoveRoute(int32 routing_id) { router_.RemoveRoute(routing_id); } -void GpuProcessHostUIShim::OnMessageReceived(const IPC::Message& message) { +bool GpuProcessHostUIShim::OnMessageReceived(const IPC::Message& message) { DCHECK(CalledOnValidThread()); if (message.routing_id() == MSG_ROUTING_CONTROL) - OnControlMessageReceived(message); - else - router_.RouteMessage(message); + return OnControlMessageReceived(message); + + return router_.RouteMessage(message); } void GpuProcessHostUIShim::CollectGraphicsInfoAsynchronously() { @@ -119,7 +119,8 @@ void GpuProcessHostUIShim::OnScheduleComposite(int renderer_id, } host->ScheduleComposite(); } -void GpuProcessHostUIShim::OnControlMessageReceived( + +bool GpuProcessHostUIShim::OnControlMessageReceived( const IPC::Message& message) { DCHECK(CalledOnValidThread()); @@ -127,9 +128,10 @@ void GpuProcessHostUIShim::OnControlMessageReceived( IPC_MESSAGE_HANDLER(GpuHostMsg_GraphicsInfoCollected, OnGraphicsInfoCollected) #if defined(OS_WIN) - IPC_MESSAGE_HANDLER(GpuHostMsg_ScheduleComposite, - OnScheduleComposite); + IPC_MESSAGE_HANDLER(GpuHostMsg_ScheduleComposite, OnScheduleComposite); #endif IPC_MESSAGE_UNHANDLED_ERROR() IPC_END_MESSAGE_MAP() + + return true; } diff --git a/chrome/browser/gpu_process_host_ui_shim.h b/chrome/browser/gpu_process_host_ui_shim.h index d0d0f37..f261093d 100644 --- a/chrome/browser/gpu_process_host_ui_shim.h +++ b/chrome/browser/gpu_process_host_ui_shim.h @@ -36,7 +36,7 @@ class GpuProcessHostUIShim : public IPC::Channel::Sender, // The GpuProcessHost causes this to be called on the UI thread to // dispatch the incoming messages from the GPU process, which are // actually received on the IO thread. - virtual void OnMessageReceived(const IPC::Message& message); + virtual bool OnMessageReceived(const IPC::Message& message); // See documentation on MessageRouter for AddRoute and RemoveRoute void AddRoute(int32 routing_id, IPC::Channel::Listener* listener); @@ -72,7 +72,7 @@ class GpuProcessHostUIShim : public IPC::Channel::Sender, // Message handlers. void OnGraphicsInfoCollected(const GPUInfo& gpu_info); void OnScheduleComposite(int32 renderer_id, int32 render_view_id); - void OnControlMessageReceived(const IPC::Message& message); + bool OnControlMessageReceived(const IPC::Message& message); int last_routing_id_; diff --git a/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc b/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc index ba1b5aa..15ac4a2 100644 --- a/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc +++ b/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc @@ -94,11 +94,14 @@ class FFDecryptorServerChannelListener : public IPC::Channel::Listener { sender_->Send(new Msg_Decryptor_Quit()); } - virtual void OnMessageReceived(const IPC::Message& msg) { + virtual bool OnMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(FFDecryptorServerChannelListener, msg) IPC_MESSAGE_HANDLER(Msg_Decryptor_InitReturnCode, OnInitDecryptorResponse) IPC_MESSAGE_HANDLER(Msg_Decryptor_Response, OnDecryptedTextResonse) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + return handled; } // If an error occured, just kill the message Loop. @@ -231,12 +234,15 @@ class FFDecryptorClientChannelListener : public IPC::Channel::Listener { MessageLoop::current()->Quit(); } - virtual void OnMessageReceived(const IPC::Message& msg) { + virtual bool OnMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(FFDecryptorClientChannelListener, msg) IPC_MESSAGE_HANDLER(Msg_Decryptor_Init, OnDecryptor_Init) IPC_MESSAGE_HANDLER(Msg_Decrypt, OnDecrypt) IPC_MESSAGE_HANDLER(Msg_Decryptor_Quit, OnQuitRequest) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + return handled; } virtual void OnChannelError() { diff --git a/chrome/browser/nacl_host/nacl_broker_host_win.cc b/chrome/browser/nacl_host/nacl_broker_host_win.cc index 0942a23..7d0fbea 100644 --- a/chrome/browser/nacl_host/nacl_broker_host_win.cc +++ b/chrome/browser/nacl_host/nacl_broker_host_win.cc @@ -46,10 +46,13 @@ bool NaClBrokerHost::Init() { return true; } -void NaClBrokerHost::OnMessageReceived(const IPC::Message& msg) { +bool NaClBrokerHost::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(NaClBrokerHost, msg) IPC_MESSAGE_HANDLER(NaClProcessMsg_LoaderLaunched, OnLoaderLaunched) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + return handled; } bool NaClBrokerHost::LaunchLoader( diff --git a/chrome/browser/nacl_host/nacl_broker_host_win.h b/chrome/browser/nacl_host/nacl_broker_host_win.h index 7213ff0..27ceb24 100644 --- a/chrome/browser/nacl_host/nacl_broker_host_win.h +++ b/chrome/browser/nacl_host/nacl_broker_host_win.h @@ -33,7 +33,7 @@ class NaClBrokerHost : public BrowserChildProcessHost { base::ProcessHandle handle); // IPC::Channel::Listener - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); bool stopping_; diff --git a/chrome/browser/nacl_host/nacl_process_host.cc b/chrome/browser/nacl_host/nacl_process_host.cc index f9f5667..a009702 100644 --- a/chrome/browser/nacl_host/nacl_process_host.cc +++ b/chrome/browser/nacl_host/nacl_process_host.cc @@ -282,8 +282,9 @@ void NaClProcessHost::SendStartMessage() { sockets_for_sel_ldr_.clear(); } -void NaClProcessHost::OnMessageReceived(const IPC::Message& msg) { +bool NaClProcessHost::OnMessageReceived(const IPC::Message& msg) { NOTREACHED() << "Invalid message with type = " << msg.type(); + return false; } bool NaClProcessHost::CanShutdown() { diff --git a/chrome/browser/nacl_host/nacl_process_host.h b/chrome/browser/nacl_host/nacl_process_host.h index e2b0c39..c0d5731 100644 --- a/chrome/browser/nacl_host/nacl_process_host.h +++ b/chrome/browser/nacl_host/nacl_process_host.h @@ -32,7 +32,7 @@ class NaClProcessHost : public BrowserChildProcessHost { int socket_count, IPC::Message* reply_msg); - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); void OnProcessLaunchedByBroker(base::ProcessHandle handle); diff --git a/chrome/browser/plugin_data_remover.cc b/chrome/browser/plugin_data_remover.cc index fd7d9bd..2baf0d0 100644 --- a/chrome/browser/plugin_data_remover.cc +++ b/chrome/browser/plugin_data_remover.cc @@ -115,12 +115,14 @@ void PluginDataRemover::OnTimeout() { SignalDone(); } -void PluginDataRemover::OnMessageReceived(const IPC::Message& msg) { +bool PluginDataRemover::OnMessageReceived(const IPC::Message& msg) { IPC_BEGIN_MESSAGE_MAP(PluginDataRemover, msg) IPC_MESSAGE_HANDLER(PluginHostMsg_ClearSiteDataResult, OnClearSiteDataResult) IPC_MESSAGE_UNHANDLED_ERROR() IPC_END_MESSAGE_MAP() + + return true; } void PluginDataRemover::OnChannelError() { diff --git a/chrome/browser/plugin_data_remover.h b/chrome/browser/plugin_data_remover.h index 58387fe..77f7f58 100644 --- a/chrome/browser/plugin_data_remover.h +++ b/chrome/browser/plugin_data_remover.h @@ -45,8 +45,8 @@ class PluginDataRemover : public base::RefCountedThreadSafe<PluginDataRemover>, virtual void OnChannelOpened(const IPC::ChannelHandle& handle); virtual void OnError(); - // IPC::ChannelProxy::MessageFilter methods - virtual void OnMessageReceived(const IPC::Message& message); + // IPC::Channel::Listener methods + virtual bool OnMessageReceived(const IPC::Message& message); virtual void OnChannelError(); private: diff --git a/chrome/browser/plugin_process_host.cc b/chrome/browser/plugin_process_host.cc index 4be2ce7..cb99a80 100644 --- a/chrome/browser/plugin_process_host.cc +++ b/chrome/browser/plugin_process_host.cc @@ -298,7 +298,8 @@ void PluginProcessHost::OnProcessLaunched() { } } -void PluginProcessHost::OnMessageReceived(const IPC::Message& msg) { +bool PluginProcessHost::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(PluginProcessHost, msg) IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ChannelCreated, OnChannelCreated) IPC_MESSAGE_HANDLER(PluginProcessHostMsg_GetPluginFinderUrl, @@ -327,8 +328,11 @@ void PluginProcessHost::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginSetCursorVisibility, OnPluginSetCursorVisibility) #endif - IPC_MESSAGE_UNHANDLED_ERROR() + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + + DCHECK(handled); + return handled; } void PluginProcessHost::OnChannelConnected(int32 peer_pid) { diff --git a/chrome/browser/plugin_process_host.h b/chrome/browser/plugin_process_host.h index b98840e..d30a77a 100644 --- a/chrome/browser/plugin_process_host.h +++ b/chrome/browser/plugin_process_host.h @@ -66,7 +66,7 @@ class PluginProcessHost : public BrowserChildProcessHost, // Force the plugin process to shutdown (cleanly). virtual void ForceShutdown(); - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); virtual void OnChannelConnected(int32 peer_pid); virtual void OnChannelError(); diff --git a/chrome/browser/ppapi_plugin_process_host.cc b/chrome/browser/ppapi_plugin_process_host.cc index b9be47a..c90d1f4 100644 --- a/chrome/browser/ppapi_plugin_process_host.cc +++ b/chrome/browser/ppapi_plugin_process_host.cc @@ -69,11 +69,14 @@ bool PpapiPluginProcessHost::CanShutdown() { void PpapiPluginProcessHost::OnProcessLaunched() { } -void PpapiPluginProcessHost::OnMessageReceived(const IPC::Message& msg) { +bool PpapiPluginProcessHost::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(PpapiPluginProcessHost, msg) IPC_MESSAGE_HANDLER(PpapiHostMsg_PluginLoaded, OnPluginLoaded) - IPC_MESSAGE_UNHANDLED_ERROR(); + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + DCHECK(handled); + return handled; } void PpapiPluginProcessHost::OnChannelConnected(int32 peer_pid) { diff --git a/chrome/browser/ppapi_plugin_process_host.h b/chrome/browser/ppapi_plugin_process_host.h index 23be5da..227cf31 100644 --- a/chrome/browser/ppapi_plugin_process_host.h +++ b/chrome/browser/ppapi_plugin_process_host.h @@ -23,7 +23,7 @@ class PpapiPluginProcessHost : public BrowserChildProcessHost { virtual bool CanShutdown(); virtual void OnProcessLaunched(); - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); virtual void OnChannelConnected(int32 peer_pid); virtual void OnChannelError(); diff --git a/chrome/browser/profile_import_process_host.cc b/chrome/browser/profile_import_process_host.cc index d221817..3663ef7 100644 --- a/chrome/browser/profile_import_process_host.cc +++ b/chrome/browser/profile_import_process_host.cc @@ -118,13 +118,14 @@ bool ProfileImportProcessHost::StartProcess() { return true; } -void ProfileImportProcessHost::OnMessageReceived(const IPC::Message& message) { +bool ProfileImportProcessHost::OnMessageReceived(const IPC::Message& message) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); BrowserThread::PostTask( thread_id_, FROM_HERE, NewRunnableMethod(import_process_client_.get(), &ImportProcessClient::OnMessageReceived, message)); + return true; } void ProfileImportProcessHost::OnProcessCrashed(int exit_code) { @@ -144,8 +145,9 @@ ProfileImportProcessHost::ImportProcessClient::ImportProcessClient() {} ProfileImportProcessHost::ImportProcessClient::~ImportProcessClient() {} -void ProfileImportProcessHost::ImportProcessClient::OnMessageReceived( +bool ProfileImportProcessHost::ImportProcessClient::OnMessageReceived( const IPC::Message& message) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(ProfileImportProcessHost, message) // Notification messages about the state of the import process. IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_Import_Started, @@ -176,5 +178,7 @@ void ProfileImportProcessHost::ImportProcessClient::OnMessageReceived( ImportProcessClient::OnPasswordFormImportReady) IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyKeywordsReady, ImportProcessClient::OnKeywordsImportReady) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP_EX() + return handled; } diff --git a/chrome/browser/profile_import_process_host.h b/chrome/browser/profile_import_process_host.h index 68ef64f..dae6108 100644 --- a/chrome/browser/profile_import_process_host.h +++ b/chrome/browser/profile_import_process_host.h @@ -73,7 +73,7 @@ class ProfileImportProcessHost : public BrowserChildProcessHost { const std::vector<TemplateURL>& template_urls, int default_keyword_index, bool unique_on_host_and_path) {} - virtual void OnMessageReceived(const IPC::Message& message); + virtual bool OnMessageReceived(const IPC::Message& message); protected: friend class base::RefCountedThreadSafe<ImportProcessClient>; @@ -122,7 +122,7 @@ class ProfileImportProcessHost : public BrowserChildProcessHost { // Called by the external importer process to send messages back to the // ImportProcessClient. - virtual void OnMessageReceived(const IPC::Message& message); + virtual bool OnMessageReceived(const IPC::Message& message); // Overridden from BrowserChildProcessHost: virtual void OnProcessCrashed(int exit_code); diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc index 66968b7..e3849fb 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.cc +++ b/chrome/browser/renderer_host/browser_render_process_host.cc @@ -977,11 +977,11 @@ bool BrowserRenderProcessHost::Send(IPC::Message* msg) { return channel_->Send(msg); } -void BrowserRenderProcessHost::OnMessageReceived(const IPC::Message& msg) { +bool BrowserRenderProcessHost::OnMessageReceived(const IPC::Message& msg) { // If we're about to be deleted, we can no longer trust that our profile is // valid, so we ignore incoming messages. if (deleting_soon_) - return; + return false; #if defined(OS_CHROMEOS) // To troubleshoot crosbug.com/7327. @@ -1018,7 +1018,7 @@ void BrowserRenderProcessHost::OnMessageReceived(const IPC::Message& msg) { UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_BRPH")); ReceivedBadMessage(); } - return; + return true; } // Dispatch incoming messages to the appropriate RenderView/WidgetHost. @@ -1031,9 +1031,9 @@ void BrowserRenderProcessHost::OnMessageReceived(const IPC::Message& msg) { reply->set_reply_error(); Send(reply); } - return; + return true; } - listener->OnMessageReceived(msg); + return listener->OnMessageReceived(msg); } void BrowserRenderProcessHost::OnChannelConnected(int32 peer_pid) { diff --git a/chrome/browser/renderer_host/browser_render_process_host.h b/chrome/browser/renderer_host/browser_render_process_host.h index 3b28e6b..f1bc47a 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.h +++ b/chrome/browser/renderer_host/browser_render_process_host.h @@ -85,7 +85,7 @@ class BrowserRenderProcessHost : public RenderProcessHost, virtual bool Send(IPC::Message* msg); // IPC::Channel::Listener via RenderProcessHost. - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); virtual void OnChannelConnected(int32 peer_pid); virtual void OnChannelError(); diff --git a/chrome/browser/renderer_host/mock_render_process_host.cc b/chrome/browser/renderer_host/mock_render_process_host.cc index bd4d675..1f1a2b3 100644 --- a/chrome/browser/renderer_host/mock_render_process_host.cc +++ b/chrome/browser/renderer_host/mock_render_process_host.cc @@ -117,7 +117,8 @@ TransportDIB* MockRenderProcessHost::GetTransportDIB(TransportDIB::Id dib_id) { return transport_dib_; } -void MockRenderProcessHost::OnMessageReceived(const IPC::Message& msg) { +bool MockRenderProcessHost::OnMessageReceived(const IPC::Message& msg) { + return false; } void MockRenderProcessHost::OnChannelConnected(int32 peer_pid) { diff --git a/chrome/browser/renderer_host/mock_render_process_host.h b/chrome/browser/renderer_host/mock_render_process_host.h index 0d8bfa6..6309685 100644 --- a/chrome/browser/renderer_host/mock_render_process_host.h +++ b/chrome/browser/renderer_host/mock_render_process_host.h @@ -59,7 +59,7 @@ class MockRenderProcessHost : public RenderProcessHost { virtual bool Send(IPC::Message* msg); // IPC::Channel::Listener via RenderProcessHost. - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); virtual void OnChannelConnected(int32 peer_pid); // Attaches the factory object so we can remove this object in its destructor diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc index df012bf..950c60e 100644 --- a/chrome/browser/renderer_host/render_view_host.cc +++ b/chrome/browser/renderer_host/render_view_host.cc @@ -738,7 +738,7 @@ bool RenderViewHost::SuddenTerminationAllowed() const { /////////////////////////////////////////////////////////////////////////////// // RenderViewHost, IPC message handlers: -void RenderViewHost::OnMessageReceived(const IPC::Message& msg) { +bool RenderViewHost::OnMessageReceived(const IPC::Message& msg) { #if defined(OS_WIN) // On Windows there's a potential deadlock with sync messsages going in // a circle from browser -> plugin -> renderer -> browser. @@ -756,10 +756,11 @@ void RenderViewHost::OnMessageReceived(const IPC::Message& msg) { IPC::Message* reply = IPC::SyncMessage::GenerateReply(&msg); reply->set_reply_error(); Send(reply); - return; + return true; } #endif + bool handled = true; bool msg_is_ok = true; IPC_BEGIN_MESSAGE_MAP_EX(RenderViewHost, msg, msg_is_ok) IPC_MESSAGE_HANDLER(ViewHostMsg_ShowView, OnMsgShowView) @@ -917,7 +918,7 @@ void RenderViewHost::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(ViewHostMsg_PagesReadyForPreview, OnPagesReadyForPreview) // Have the super handle all other messages. - IPC_MESSAGE_UNHANDLED(RenderWidgetHost::OnMessageReceived(msg)) + IPC_MESSAGE_UNHANDLED(handled = RenderWidgetHost::OnMessageReceived(msg)) IPC_END_MESSAGE_MAP_EX() if (!msg_is_ok) { @@ -926,6 +927,8 @@ void RenderViewHost::OnMessageReceived(const IPC::Message& msg) { UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RVH")); process()->ReceivedBadMessage(); } + + return handled; } void RenderViewHost::Shutdown() { diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h index 163039b..02c08d1 100644 --- a/chrome/browser/renderer_host/render_view_host.h +++ b/chrome/browser/renderer_host/render_view_host.h @@ -446,7 +446,7 @@ class RenderViewHost : public RenderWidgetHost { // RenderWidgetHost public overrides. virtual void Shutdown(); virtual bool IsRenderView() const; - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); virtual void GotFocus(); virtual void LostCapture(); virtual void ForwardMouseEvent(const WebKit::WebMouseEvent& mouse_event); diff --git a/chrome/browser/renderer_host/render_widget_host.cc b/chrome/browser/renderer_host/render_widget_host.cc index 3c319e0..28862af 100644 --- a/chrome/browser/renderer_host/render_widget_host.cc +++ b/chrome/browser/renderer_host/render_widget_host.cc @@ -151,7 +151,8 @@ bool RenderWidgetHost::IsRenderView() const { return false; } -void RenderWidgetHost::OnMessageReceived(const IPC::Message &msg) { +bool RenderWidgetHost::OnMessageReceived(const IPC::Message &msg) { + bool handled = true; bool msg_is_ok = true; IPC_BEGIN_MESSAGE_MAP_EX(RenderWidgetHost, msg, msg_is_ok) IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnMsgRenderViewReady) @@ -192,7 +193,7 @@ void RenderWidgetHost::OnMessageReceived(const IPC::Message &msg) { IPC_MESSAGE_HANDLER(ViewHostMsg_DestroyPluginContainer, OnMsgDestroyPluginContainer) #endif - IPC_MESSAGE_UNHANDLED_ERROR() + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP_EX() if (!msg_is_ok) { @@ -200,6 +201,7 @@ void RenderWidgetHost::OnMessageReceived(const IPC::Message &msg) { UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RWH")); process()->ReceivedBadMessage(); } + return handled; } bool RenderWidgetHost::Send(IPC::Message* msg) { diff --git a/chrome/browser/renderer_host/render_widget_host.h b/chrome/browser/renderer_host/render_widget_host.h index 90204aa..73d7fa4 100644 --- a/chrome/browser/renderer_host/render_widget_host.h +++ b/chrome/browser/renderer_host/render_widget_host.h @@ -181,7 +181,7 @@ class RenderWidgetHost : public IPC::Channel::Listener, virtual bool IsRenderView() const; // IPC::Channel::Listener - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); // Sends a message to the corresponding object in the renderer. virtual bool Send(IPC::Message* msg); diff --git a/chrome/browser/renderer_host/test/test_render_view_host.cc b/chrome/browser/renderer_host/test/test_render_view_host.cc index 72674497..1c2e4b4 100644 --- a/chrome/browser/renderer_host/test/test_render_view_host.cc +++ b/chrome/browser/renderer_host/test/test_render_view_host.cc @@ -70,8 +70,8 @@ bool TestRenderViewHost::IsRenderViewLive() const { return render_view_created_; } -void TestRenderViewHost::TestOnMessageReceived(const IPC::Message& msg) { - OnMessageReceived(msg); +bool TestRenderViewHost::TestOnMessageReceived(const IPC::Message& msg) { + return OnMessageReceived(msg); } void TestRenderViewHost::SendNavigate(int page_id, const GURL& url) { diff --git a/chrome/browser/renderer_host/test/test_render_view_host.h b/chrome/browser/renderer_host/test/test_render_view_host.h index f84bc21..70f2d11 100644 --- a/chrome/browser/renderer_host/test/test_render_view_host.h +++ b/chrome/browser/renderer_host/test/test_render_view_host.h @@ -166,7 +166,7 @@ class TestRenderViewHost : public RenderViewHost { // Calls the RenderViewHosts' private OnMessageReceived function with the // given message. - void TestOnMessageReceived(const IPC::Message& msg); + bool TestOnMessageReceived(const IPC::Message& msg); // Calls OnMsgNavigate on the RenderViewHost with the given information, // setting the rest of the parameters in the message to the "typical" values. diff --git a/chrome/browser/service/service_process_control.cc b/chrome/browser/service/service_process_control.cc index dfba80a..27e3a2d 100644 --- a/chrome/browser/service/service_process_control.cc +++ b/chrome/browser/service/service_process_control.cc @@ -238,14 +238,17 @@ void ServiceProcessControl::OnProcessLaunched() { launcher_ = NULL; } -void ServiceProcessControl::OnMessageReceived(const IPC::Message& message) { +bool ServiceProcessControl::OnMessageReceived(const IPC::Message& message) { + bool handled = true;; IPC_BEGIN_MESSAGE_MAP(ServiceProcessControl, message) - IPC_MESSAGE_HANDLER(ServiceHostMsg_GoodDay, OnGoodDay) - IPC_MESSAGE_HANDLER(ServiceHostMsg_CloudPrintProxy_IsEnabled, - OnCloudPrintProxyIsEnabled) - IPC_MESSAGE_HANDLER(ServiceHostMsg_RemotingHost_HostInfo, - OnRemotingHostInfo) + IPC_MESSAGE_HANDLER(ServiceHostMsg_GoodDay, OnGoodDay) + IPC_MESSAGE_HANDLER(ServiceHostMsg_CloudPrintProxy_IsEnabled, + OnCloudPrintProxyIsEnabled) + IPC_MESSAGE_HANDLER(ServiceHostMsg_RemotingHost_HostInfo, + OnRemotingHostInfo) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + return handled; } void ServiceProcessControl::OnChannelConnected(int32 peer_pid) { diff --git a/chrome/browser/service/service_process_control.h b/chrome/browser/service/service_process_control.h index efbd545..9162736 100644 --- a/chrome/browser/service/service_process_control.h +++ b/chrome/browser/service/service_process_control.h @@ -77,7 +77,7 @@ class ServiceProcessControl : public IPC::Channel::Sender, void Launch(Task* success_task, Task* failure_task); // IPC::Channel::Listener implementation. - virtual void OnMessageReceived(const IPC::Message& message); + virtual bool OnMessageReceived(const IPC::Message& message); virtual void OnChannelConnected(int32 peer_pid); virtual void OnChannelError(); diff --git a/chrome/browser/utility_process_host.cc b/chrome/browser/utility_process_host.cc index ab5b39f..4d208fd 100644 --- a/chrome/browser/utility_process_host.cc +++ b/chrome/browser/utility_process_host.cc @@ -153,10 +153,11 @@ bool UtilityProcessHost::StartProcess(const FilePath& exposed_dir) { return true; } -void UtilityProcessHost::OnMessageReceived(const IPC::Message& message) { +bool UtilityProcessHost::OnMessageReceived(const IPC::Message& message) { BrowserThread::PostTask( client_thread_id_, FROM_HERE, NewRunnableMethod(client_.get(), &Client::OnMessageReceived, message)); + return true; } void UtilityProcessHost::OnProcessCrashed(int exit_code) { @@ -169,8 +170,9 @@ bool UtilityProcessHost::CanShutdown() { return true; } -void UtilityProcessHost::Client::OnMessageReceived( +bool UtilityProcessHost::Client::OnMessageReceived( const IPC::Message& message) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(UtilityProcessHost, message) IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackExtension_Succeeded, Client::OnUnpackExtensionSucceeded) @@ -192,5 +194,7 @@ void UtilityProcessHost::Client::OnMessageReceived( Client::OnIDBKeysFromValuesAndKeyPathSucceeded) IPC_MESSAGE_HANDLER(UtilityHostMsg_IDBKeysFromValuesAndKeyPath_Failed, Client::OnIDBKeysFromValuesAndKeyPathFailed) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP_EX() + return handled; } diff --git a/chrome/browser/utility_process_host.h b/chrome/browser/utility_process_host.h index 21776b6..c1f4055 100644 --- a/chrome/browser/utility_process_host.h +++ b/chrome/browser/utility_process_host.h @@ -97,7 +97,7 @@ class UtilityProcessHost : public BrowserChildProcessHost { private: friend class UtilityProcessHost; - void OnMessageReceived(const IPC::Message& message); + bool OnMessageReceived(const IPC::Message& message); DISALLOW_COPY_AND_ASSIGN(Client); }; @@ -149,7 +149,7 @@ class UtilityProcessHost : public BrowserChildProcessHost { bool StartProcess(const FilePath& exposed_dir); // IPC messages: - virtual void OnMessageReceived(const IPC::Message& message); + virtual bool OnMessageReceived(const IPC::Message& message); // BrowserChildProcessHost: virtual void OnProcessCrashed(int exit_code); diff --git a/chrome/browser/worker_host/worker_process_host.cc b/chrome/browser/worker_host/worker_process_host.cc index 6167132..2006e2f 100644 --- a/chrome/browser/worker_host/worker_process_host.cc +++ b/chrome/browser/worker_host/worker_process_host.cc @@ -276,7 +276,7 @@ bool WorkerProcessHost::FilterMessage(const IPC::Message& message, void WorkerProcessHost::OnProcessLaunched() { } -void WorkerProcessHost::OnMessageReceived(const IPC::Message& message) { +bool WorkerProcessHost::OnMessageReceived(const IPC::Message& message) { bool msg_is_ok = true; bool handled = true; IPC_BEGIN_MESSAGE_MAP_EX(WorkerProcessHost, message, msg_is_ok) @@ -293,7 +293,7 @@ void WorkerProcessHost::OnMessageReceived(const IPC::Message& message) { } if (handled) - return; + return true; for (Instances::iterator i = instances_.begin(); i != instances_.end(); ++i) { if (i->worker_route_id() == message.routing_id()) { @@ -308,9 +308,10 @@ void WorkerProcessHost::OnMessageReceived(const IPC::Message& message) { instances_.erase(i); UpdateTitle(); } - break; + return true; } } + return false; } // Sent to notify the browser process when a worker context invokes close(), so diff --git a/chrome/browser/worker_host/worker_process_host.h b/chrome/browser/worker_host/worker_process_host.h index 150da93..f3f6fdd 100644 --- a/chrome/browser/worker_host/worker_process_host.h +++ b/chrome/browser/worker_host/worker_process_host.h @@ -149,7 +149,7 @@ class WorkerProcessHost : public BrowserChildProcessHost { // IPC::Channel::Listener implementation: // Called when a message arrives from the worker process. - virtual void OnMessageReceived(const IPC::Message& message); + virtual bool OnMessageReceived(const IPC::Message& message); void OnWorkerContextClosed(int worker_route_id); void OnAllowDatabase(int worker_route_id, diff --git a/chrome/common/appcache/appcache_dispatcher.h b/chrome/common/appcache/appcache_dispatcher.h index f099183..f88a38a 100644 --- a/chrome/common/appcache/appcache_dispatcher.h +++ b/chrome/common/appcache/appcache_dispatcher.h @@ -9,20 +9,21 @@ #include <string> #include <vector> #include "chrome/common/appcache/appcache_backend_proxy.h" -#include "ipc/ipc_message.h" +#include "ipc/ipc_channel.h" #include "webkit/appcache/appcache_frontend_impl.h" // Dispatches appcache related messages sent to a child process from the // main browser process. There is one instance per child process. Messages // are dispatched on the main child thread. The ChildThread base class // creates an instance and delegates calls to it. -class AppCacheDispatcher { +class AppCacheDispatcher : public IPC::Channel::Listener { public: explicit AppCacheDispatcher(IPC::Message::Sender* sender) : backend_proxy_(sender) {} AppCacheBackendProxy* backend_proxy() { return &backend_proxy_; } + // IPC::Channel::Listener implementation bool OnMessageReceived(const IPC::Message& msg); private: diff --git a/chrome/common/child_process_host.cc b/chrome/common/child_process_host.cc index c19d0ca..e03b3a6 100644 --- a/chrome/common/child_process_host.cc +++ b/chrome/common/child_process_host.cc @@ -155,13 +155,13 @@ ChildProcessHost::ListenerHook::ListenerHook(ChildProcessHost* host) : host_(host) { } -void ChildProcessHost::ListenerHook::OnMessageReceived( +bool ChildProcessHost::ListenerHook::OnMessageReceived( const IPC::Message& msg) { #ifdef IPC_MESSAGE_LOG_ENABLED IPC::Logging* logger = IPC::Logging::GetInstance(); if (msg.type() == IPC_LOGGING_ID) { logger->OnReceivedLoggingMessage(msg); - return; + return true; } if (logger->Enabled()) @@ -183,12 +183,13 @@ void ChildProcessHost::ListenerHook::OnMessageReceived( } if (!handled) - host_->OnMessageReceived(msg); + handled = host_->OnMessageReceived(msg); #ifdef IPC_MESSAGE_LOG_ENABLED if (logger->Enabled()) logger->OnPostDispatchMessage(msg, host_->channel_id_); #endif + return handled; } void ChildProcessHost::ListenerHook::OnChannelConnected(int32 peer_pid) { diff --git a/chrome/common/child_process_host.h b/chrome/common/child_process_host.h index 3b467ec..c822346 100644 --- a/chrome/common/child_process_host.h +++ b/chrome/common/child_process_host.h @@ -80,7 +80,7 @@ class ChildProcessHost : public IPC::Channel::Listener, virtual void InstanceCreated(); // IPC::Channel::Listener implementation: - virtual void OnMessageReceived(const IPC::Message& msg) { } + virtual bool OnMessageReceived(const IPC::Message& msg) { return false; } virtual void OnChannelConnected(int32 peer_pid) { } virtual void OnChannelError() { } @@ -102,7 +102,7 @@ class ChildProcessHost : public IPC::Channel::Listener, class ListenerHook : public IPC::Channel::Listener { public: explicit ListenerHook(ChildProcessHost* host); - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); virtual void OnChannelConnected(int32 peer_pid); virtual void OnChannelError(); private: diff --git a/chrome/common/child_thread.cc b/chrome/common/child_thread.cc index 2a46de8..53823bc 100644 --- a/chrome/common/child_thread.cc +++ b/chrome/common/child_thread.cc @@ -139,14 +139,14 @@ MessageLoop* ChildThread::message_loop() { return message_loop_; } -void ChildThread::OnMessageReceived(const IPC::Message& msg) { +bool ChildThread::OnMessageReceived(const IPC::Message& msg) { // Resource responses are sent to the resource dispatcher. if (resource_dispatcher_->OnMessageReceived(msg)) - return; + return true; if (socket_stream_dispatcher_->OnMessageReceived(msg)) - return; + return true; if (file_system_dispatcher_->OnMessageReceived(msg)) - return; + return true; bool handled = true; IPC_BEGIN_MESSAGE_MAP(ChildThread, msg) @@ -160,13 +160,12 @@ void ChildThread::OnMessageReceived(const IPC::Message& msg) { IPC_END_MESSAGE_MAP() if (handled) - return; + return true; - if (msg.routing_id() == MSG_ROUTING_CONTROL) { - OnControlMessageReceived(msg); - } else { - router_.OnMessageReceived(msg); - } + if (msg.routing_id() == MSG_ROUTING_CONTROL) + return OnControlMessageReceived(msg); + + return router_.OnMessageReceived(msg); } void ChildThread::OnAskBeforeShutdown() { diff --git a/chrome/common/child_thread.h b/chrome/common/child_thread.h index 337a7f8..dbe8677 100644 --- a/chrome/common/child_thread.h +++ b/chrome/common/child_thread.h @@ -74,7 +74,9 @@ class ChildThread : public IPC::Channel::Listener, // Called when the process refcount is 0. void OnProcessFinalRelease(); - virtual void OnControlMessageReceived(const IPC::Message& msg) { } + virtual bool OnControlMessageReceived(const IPC::Message& msg) { + return false; + } virtual void OnAskBeforeShutdown(); virtual void OnShutdown(); @@ -92,7 +94,7 @@ class ChildThread : public IPC::Channel::Listener, void Init(); // IPC::Channel::Listener implementation: - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); virtual void OnChannelError(); std::string channel_name_; diff --git a/chrome/common/file_system/file_system_dispatcher.h b/chrome/common/file_system/file_system_dispatcher.h index b8ffb2c..21bc792 100644 --- a/chrome/common/file_system/file_system_dispatcher.h +++ b/chrome/common/file_system/file_system_dispatcher.h @@ -25,11 +25,12 @@ class GURL; // Dispatches and sends file system related messages sent to/from a child // process from/to the main browser process. There is one instance // per child process. Messages are dispatched on the main child thread. -class FileSystemDispatcher { +class FileSystemDispatcher : public IPC::Channel::Listener { public: FileSystemDispatcher(); ~FileSystemDispatcher(); + // IPC::Channel::Listener implementation. bool OnMessageReceived(const IPC::Message& msg); bool OpenFileSystem(const GURL& origin_url, diff --git a/chrome/common/message_router.cc b/chrome/common/message_router.cc index 6bd6e95..b3ea5960 100644 --- a/chrome/common/message_router.cc +++ b/chrome/common/message_router.cc @@ -10,9 +10,10 @@ MessageRouter::MessageRouter() { MessageRouter::~MessageRouter() { } -void MessageRouter::OnControlMessageReceived(const IPC::Message& msg) { +bool MessageRouter::OnControlMessageReceived(const IPC::Message& msg) { NOTREACHED() << "should override in subclass if you care about control messages"; + return false; } bool MessageRouter::Send(IPC::Message* msg) { @@ -30,12 +31,11 @@ void MessageRouter::RemoveRoute(int32 routing_id) { routes_.Remove(routing_id); } -void MessageRouter::OnMessageReceived(const IPC::Message& msg) { - if (msg.routing_id() == MSG_ROUTING_CONTROL) { - OnControlMessageReceived(msg); - } else { - RouteMessage(msg); - } +bool MessageRouter::OnMessageReceived(const IPC::Message& msg) { + if (msg.routing_id() == MSG_ROUTING_CONTROL) + return OnControlMessageReceived(msg); + + return RouteMessage(msg); } bool MessageRouter::RouteMessage(const IPC::Message& msg) { diff --git a/chrome/common/message_router.h b/chrome/common/message_router.h index 6a61091..e6709be 100644 --- a/chrome/common/message_router.h +++ b/chrome/common/message_router.h @@ -34,10 +34,10 @@ class MessageRouter : public IPC::Channel::Listener, virtual ~MessageRouter(); // Implemented by subclasses to handle control messages - virtual void OnControlMessageReceived(const IPC::Message& msg); + virtual bool OnControlMessageReceived(const IPC::Message& msg); // IPC::Channel::Listener implementation: - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); // Like OnMessageReceived, except it only handles routed messages. Returns // true if the message was dispatched, or false if there was no listener for diff --git a/chrome/common/resource_dispatcher.h b/chrome/common/resource_dispatcher.h index 3ca3492..52c6589 100644 --- a/chrome/common/resource_dispatcher.h +++ b/chrome/common/resource_dispatcher.h @@ -23,13 +23,12 @@ struct ResourceResponseHead; // This class serves as a communication interface between the // ResourceDispatcherHost in the browser process and the ResourceLoaderBridge in // the child process. It can be used from any child process. -class ResourceDispatcher { +class ResourceDispatcher : public IPC::Channel::Listener { public: explicit ResourceDispatcher(IPC::Message::Sender* sender); ~ResourceDispatcher(); - // Called to possibly handle the incoming IPC message. Returns true if - // handled, else false. + // IPC::Channel::Listener implementation. bool OnMessageReceived(const IPC::Message& message); // Creates a ResourceLoaderBridge for this type of dispatcher, this is so diff --git a/chrome/common/socket_stream_dispatcher.h b/chrome/common/socket_stream_dispatcher.h index e0bf58f..01c5421 100644 --- a/chrome/common/socket_stream_dispatcher.h +++ b/chrome/common/socket_stream_dispatcher.h @@ -9,10 +9,7 @@ #include <vector> #include "base/basictypes.h" - -namespace IPC { -class Message; -} +#include "ipc/ipc_channel.h" namespace WebKit { class WebSocketStreamHandle; @@ -27,7 +24,7 @@ class WebSocketStreamHandleDelegate; // main browser process. There is one instance per child process. Messages // are dispatched on the main child thread. The RenderThread class // creates an instance of SocketStreamDispatcher and delegates calls to it. -class SocketStreamDispatcher { +class SocketStreamDispatcher : public IPC::Channel::Listener { public: SocketStreamDispatcher(); ~SocketStreamDispatcher() {} @@ -35,6 +32,8 @@ class SocketStreamDispatcher { static webkit_glue::WebSocketStreamHandleBridge* CreateBridge( WebKit::WebSocketStreamHandle* handle, webkit_glue::WebSocketStreamHandleDelegate* delegate); + + // IPC::Channel::Listener implementation. bool OnMessageReceived(const IPC::Message& msg); private: diff --git a/chrome/common/webmessageportchannel_impl.cc b/chrome/common/webmessageportchannel_impl.cc index b7a9388..0778871 100644 --- a/chrome/common/webmessageportchannel_impl.cc +++ b/chrome/common/webmessageportchannel_impl.cc @@ -180,11 +180,14 @@ void WebMessagePortChannelImpl::Send(IPC::Message* message) { ChildThread::current()->Send(message); } -void WebMessagePortChannelImpl::OnMessageReceived(const IPC::Message& message) { +bool WebMessagePortChannelImpl::OnMessageReceived(const IPC::Message& message) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(WebMessagePortChannelImpl, message) IPC_MESSAGE_HANDLER(WorkerProcessMsg_Message, OnMessage) IPC_MESSAGE_HANDLER(WorkerProcessMsg_MessagesQueued, OnMessagedQueued) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + return handled; } void WebMessagePortChannelImpl::OnMessage( diff --git a/chrome/common/webmessageportchannel_impl.h b/chrome/common/webmessageportchannel_impl.h index 3c96fc38..0199ebb 100644 --- a/chrome/common/webmessageportchannel_impl.h +++ b/chrome/common/webmessageportchannel_impl.h @@ -48,7 +48,7 @@ class WebMessagePortChannelImpl void Send(IPC::Message* message); // IPC::Channel::Listener implementation. - virtual void OnMessageReceived(const IPC::Message& message); + virtual bool OnMessageReceived(const IPC::Message& message); void OnMessage(const string16& message, const std::vector<int>& sent_message_port_ids, diff --git a/chrome/gpu/gpu_channel.cc b/chrome/gpu/gpu_channel.cc index 8fb5024..79e9186 100644 --- a/chrome/gpu/gpu_channel.cc +++ b/chrome/gpu/gpu_channel.cc @@ -38,19 +38,18 @@ void GpuChannel::OnChannelConnected(int32 peer_pid) { } } -void GpuChannel::OnMessageReceived(const IPC::Message& message) { +bool GpuChannel::OnMessageReceived(const IPC::Message& message) { if (log_messages_) { VLOG(1) << "received message @" << &message << " on channel @" << this << " with type " << message.type(); } - if (message.routing_id() == MSG_ROUTING_CONTROL) { - OnControlMessageReceived(message); - } else { - // Fail silently if the GPU process has destroyed while the IPC message was - // en-route. - router_.RouteMessage(message); - } + if (message.routing_id() == MSG_ROUTING_CONTROL) + return OnControlMessageReceived(message); + + // Fail silently if the GPU process has destroyed while the IPC message was + // en-route. + return router_.RouteMessage(message); } void GpuChannel::OnChannelError() { @@ -94,7 +93,8 @@ bool GpuChannel::IsRenderViewGone(int32 renderer_route_id) { } #endif -void GpuChannel::OnControlMessageReceived(const IPC::Message& msg) { +bool GpuChannel::OnControlMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(GpuChannel, msg) IPC_MESSAGE_HANDLER(GpuChannelMsg_CreateViewCommandBuffer, OnCreateViewCommandBuffer) @@ -106,8 +106,10 @@ void GpuChannel::OnControlMessageReceived(const IPC::Message& msg) { OnCreateVideoDecoder) IPC_MESSAGE_HANDLER(GpuChannelMsg_DestroyVideoDecoder, OnDestroyVideoDecoder) - IPC_MESSAGE_UNHANDLED_ERROR() + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + DCHECK(handled); + return handled; } int GpuChannel::GenerateRouteID() { diff --git a/chrome/gpu/gpu_channel.h b/chrome/gpu/gpu_channel.h index e449dc4..1706e03 100644 --- a/chrome/gpu/gpu_channel.h +++ b/chrome/gpu/gpu_channel.h @@ -46,7 +46,7 @@ class GpuChannel : public IPC::Channel::Listener, } // IPC::Channel::Listener implementation: - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); virtual void OnChannelConnected(int32 peer_pid); virtual void OnChannelError(); @@ -62,7 +62,7 @@ class GpuChannel : public IPC::Channel::Listener, #endif private: - void OnControlMessageReceived(const IPC::Message& msg); + bool OnControlMessageReceived(const IPC::Message& msg); int GenerateRouteID(); diff --git a/chrome/gpu/gpu_command_buffer_stub.cc b/chrome/gpu/gpu_command_buffer_stub.cc index bf3b2d0..592e04f 100644 --- a/chrome/gpu/gpu_command_buffer_stub.cc +++ b/chrome/gpu/gpu_command_buffer_stub.cc @@ -169,7 +169,8 @@ GpuCommandBufferStub::~GpuCommandBufferStub() { #endif // defined(OS_WIN) } -void GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) { +bool GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(GpuCommandBufferStub, message) IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Initialize, OnInitialize); IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_GetState, OnGetState); @@ -187,8 +188,10 @@ void GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) { #if defined(OS_MACOSX) IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetWindowSize, OnSetWindowSize); #endif // defined(OS_MACOSX) - IPC_MESSAGE_UNHANDLED_ERROR() + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + DCHECK(handled); + return handled; } bool GpuCommandBufferStub::Send(IPC::Message* message) { diff --git a/chrome/gpu/gpu_command_buffer_stub.h b/chrome/gpu/gpu_command_buffer_stub.h index 66d1759..b903412 100644 --- a/chrome/gpu/gpu_command_buffer_stub.h +++ b/chrome/gpu/gpu_command_buffer_stub.h @@ -41,7 +41,7 @@ class GpuCommandBufferStub virtual ~GpuCommandBufferStub(); // IPC::Channel::Listener implementation: - virtual void OnMessageReceived(const IPC::Message& message); + virtual bool OnMessageReceived(const IPC::Message& message); // IPC::Message::Sender implementation: virtual bool Send(IPC::Message* msg); diff --git a/chrome/gpu/gpu_thread.cc b/chrome/gpu/gpu_thread.cc index b8c532b..e95d27f 100644 --- a/chrome/gpu/gpu_thread.cc +++ b/chrome/gpu/gpu_thread.cc @@ -52,8 +52,9 @@ void GpuThread::RemoveChannel(int renderer_id) { gpu_channels_.erase(renderer_id); } -void GpuThread::OnControlMessageReceived(const IPC::Message& msg) { +bool GpuThread::OnControlMessageReceived(const IPC::Message& msg) { bool msg_is_ok = true; + bool handled = true; IPC_BEGIN_MESSAGE_MAP_EX(GpuThread, msg, msg_is_ok) IPC_MESSAGE_HANDLER(GpuMsg_EstablishChannel, OnEstablishChannel) IPC_MESSAGE_HANDLER(GpuMsg_CloseChannel, OnCloseChannel) @@ -67,7 +68,9 @@ void GpuThread::OnControlMessageReceived(const IPC::Message& msg) { #endif IPC_MESSAGE_HANDLER(GpuMsg_Crash, OnCrash) IPC_MESSAGE_HANDLER(GpuMsg_Hang, OnHang) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP_EX() + return handled; } void GpuThread::OnEstablishChannel(int renderer_id) { diff --git a/chrome/gpu/gpu_thread.h b/chrome/gpu/gpu_thread.h index 2f2a1f9..07302d3 100644 --- a/chrome/gpu/gpu_thread.h +++ b/chrome/gpu/gpu_thread.h @@ -33,7 +33,7 @@ class GpuThread : public ChildThread { private: // ChildThread overrides. - virtual void OnControlMessageReceived(const IPC::Message& msg); + virtual bool OnControlMessageReceived(const IPC::Message& msg); // Message handlers. void OnEstablishChannel(int renderer_id); diff --git a/chrome/gpu/gpu_video_decoder.cc b/chrome/gpu/gpu_video_decoder.cc index d16064c..ee213bf 100644 --- a/chrome/gpu/gpu_video_decoder.cc +++ b/chrome/gpu/gpu_video_decoder.cc @@ -35,7 +35,8 @@ void GpuVideoDecoder::OnChannelConnected(int32 peer_pid) { void GpuVideoDecoder::OnChannelError() { } -void GpuVideoDecoder::OnMessageReceived(const IPC::Message& msg) { +bool GpuVideoDecoder::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(GpuVideoDecoder, msg) IPC_MESSAGE_HANDLER(GpuVideoDecoderMsg_Initialize, OnInitialize) @@ -51,8 +52,10 @@ void GpuVideoDecoder::OnMessageReceived(const IPC::Message& msg) { OnProduceVideoFrame) IPC_MESSAGE_HANDLER(GpuVideoDecoderMsg_VideoFrameAllocated, OnVideoFrameAllocated) - IPC_MESSAGE_UNHANDLED_ERROR() + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + DCHECK(handled); + return handled; } bool GpuVideoDecoder::CreateInputTransferBuffer( diff --git a/chrome/gpu/gpu_video_decoder.h b/chrome/gpu/gpu_video_decoder.h index 79b9bdb..ae1da3b 100644 --- a/chrome/gpu/gpu_video_decoder.h +++ b/chrome/gpu/gpu_video_decoder.h @@ -102,7 +102,7 @@ class GpuVideoDecoder // IPC::Channel::Listener implementation. virtual void OnChannelConnected(int32 peer_pid); virtual void OnChannelError(); - virtual void OnMessageReceived(const IPC::Message& message); + virtual bool OnMessageReceived(const IPC::Message& message); // VideoDecodeEngine::EventHandler implementation. virtual void OnInitializeComplete(const VideoCodecInfo& info); diff --git a/chrome/gpu/gpu_video_service.cc b/chrome/gpu/gpu_video_service.cc index ca9d482..fb76e02 100644 --- a/chrome/gpu/gpu_video_service.cc +++ b/chrome/gpu/gpu_video_service.cc @@ -36,12 +36,13 @@ void GpuVideoService::OnChannelError() { LOG(ERROR) << "GpuVideoService::OnChannelError"; } -void GpuVideoService::OnMessageReceived(const IPC::Message& msg) { +bool GpuVideoService::OnMessageReceived(const IPC::Message& msg) { #if 0 IPC_BEGIN_MESSAGE_MAP(GpuVideoService, msg) IPC_MESSAGE_UNHANDLED_ERROR() IPC_END_MESSAGE_MAP() #endif + return false; } bool GpuVideoService::IntializeGpuVideoService() { diff --git a/chrome/gpu/gpu_video_service.h b/chrome/gpu/gpu_video_service.h index b9ad6da..371cf4b 100644 --- a/chrome/gpu/gpu_video_service.h +++ b/chrome/gpu/gpu_video_service.h @@ -21,7 +21,7 @@ class GpuVideoService : public IPC::Channel::Listener { // IPC::Channel::Listener. virtual void OnChannelConnected(int32 peer_pid); virtual void OnChannelError(); - virtual void OnMessageReceived(const IPC::Message& message); + virtual bool OnMessageReceived(const IPC::Message& message); // TODO(hclam): Remove return value. bool CreateVideoDecoder(GpuChannel* channel, diff --git a/chrome/nacl/broker_thread.cc b/chrome/nacl/broker_thread.cc index b0cdba5..984acb3 100644 --- a/chrome/nacl/broker_thread.cc +++ b/chrome/nacl/broker_thread.cc @@ -28,12 +28,15 @@ NaClBrokerThread* NaClBrokerThread::current() { return static_cast<NaClBrokerThread*>(ChildThread::current()); } -void NaClBrokerThread::OnControlMessageReceived(const IPC::Message& msg) { +bool NaClBrokerThread::OnControlMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(NaClBrokerThread, msg) IPC_MESSAGE_HANDLER(NaClProcessMsg_LaunchLoaderThroughBroker, OnLaunchLoaderThroughBroker) IPC_MESSAGE_HANDLER(NaClProcessMsg_StopBroker, OnStopBroker) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + return handled; } void NaClBrokerThread::OnLaunchLoaderThroughBroker( diff --git a/chrome/nacl/broker_thread.h b/chrome/nacl/broker_thread.h index 6590635..8b2d7c5 100644 --- a/chrome/nacl/broker_thread.h +++ b/chrome/nacl/broker_thread.h @@ -26,7 +26,7 @@ class NaClBrokerThread : public ChildThread { virtual void OnChannelConnected(int32 peer_pid); private: - virtual void OnControlMessageReceived(const IPC::Message& msg); + virtual bool OnControlMessageReceived(const IPC::Message& msg); void OnLaunchLoaderThroughBroker(const std::wstring& loader_channel_id); void OnShareBrowserHandle(int browser_handle); void OnStopBroker(); diff --git a/chrome/nacl/nacl_thread.cc b/chrome/nacl/nacl_thread.cc index 15c25b9..3ea0f82 100644 --- a/chrome/nacl/nacl_thread.cc +++ b/chrome/nacl/nacl_thread.cc @@ -76,10 +76,13 @@ NaClThread* NaClThread::current() { return static_cast<NaClThread*>(ChildThread::current()); } -void NaClThread::OnControlMessageReceived(const IPC::Message& msg) { +bool NaClThread::OnControlMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(NaClThread, msg) IPC_MESSAGE_HANDLER(NaClProcessMsg_Start, OnStartSelLdr) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + return handled; } void NaClThread::OnStartSelLdr(std::vector<nacl::FileDescriptor> handles) { diff --git a/chrome/nacl/nacl_thread.h b/chrome/nacl/nacl_thread.h index f87fc969..b330794 100644 --- a/chrome/nacl/nacl_thread.h +++ b/chrome/nacl/nacl_thread.h @@ -20,7 +20,7 @@ class NaClThread : public ChildThread { static NaClThread* current(); private: - virtual void OnControlMessageReceived(const IPC::Message& msg); + virtual bool OnControlMessageReceived(const IPC::Message& msg); void OnStartSelLdr(std::vector<nacl::FileDescriptor> handles); int debug_enabled_; diff --git a/chrome/plugin/command_buffer_stub.cc b/chrome/plugin/command_buffer_stub.cc index 5818414..de9bbdb 100644 --- a/chrome/plugin/command_buffer_stub.cc +++ b/chrome/plugin/command_buffer_stub.cc @@ -27,7 +27,8 @@ CommandBufferStub::~CommandBufferStub() { channel_->RemoveRoute(route_id_); } -void CommandBufferStub::OnMessageReceived(const IPC::Message& message) { +bool CommandBufferStub::OnMessageReceived(const IPC::Message& message) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(CommandBufferStub, message) IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Initialize, OnInitialize); IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_GetState, OnGetState); @@ -43,8 +44,10 @@ void CommandBufferStub::OnMessageReceived(const IPC::Message& message) { #if defined(OS_MACOSX) IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetWindowSize, OnSetWindowSize); #endif - IPC_MESSAGE_UNHANDLED_ERROR() + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + DCHECK(handled); + return handled; } void CommandBufferStub::OnChannelError() { diff --git a/chrome/plugin/command_buffer_stub.h b/chrome/plugin/command_buffer_stub.h index 7519659..e9f65c6 100644 --- a/chrome/plugin/command_buffer_stub.h +++ b/chrome/plugin/command_buffer_stub.h @@ -31,7 +31,7 @@ class CommandBufferStub : public IPC::Channel::Listener, virtual ~CommandBufferStub(); // IPC::Channel::Listener implementation: - virtual void OnMessageReceived(const IPC::Message& message); + virtual bool OnMessageReceived(const IPC::Message& message); virtual void OnChannelError(); // IPC::Message::Sender implementation: diff --git a/chrome/plugin/npobject_proxy.cc b/chrome/plugin/npobject_proxy.cc index 0b7ff45..8a429fb 100644 --- a/chrome/plugin/npobject_proxy.cc +++ b/chrome/plugin/npobject_proxy.cc @@ -104,8 +104,9 @@ void NPObjectProxy::NPDeallocate(NPObject* npObj) { delete obj; } -void NPObjectProxy::OnMessageReceived(const IPC::Message& msg) { +bool NPObjectProxy::OnMessageReceived(const IPC::Message& msg) { NOTREACHED(); + return false; } void NPObjectProxy::OnChannelError() { diff --git a/chrome/plugin/npobject_proxy.h b/chrome/plugin/npobject_proxy.h index 6b6e7ff..4b6b595 100644 --- a/chrome/plugin/npobject_proxy.h +++ b/chrome/plugin/npobject_proxy.h @@ -102,7 +102,7 @@ class NPObjectProxy : public IPC::Channel::Listener, const GURL& page_url); // IPC::Channel::Listener implementation: - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); virtual void OnChannelError(); static NPObject* NPAllocate(NPP, NPClass*); diff --git a/chrome/plugin/npobject_stub.cc b/chrome/plugin/npobject_stub.cc index e0a8436..7fd18dd 100644 --- a/chrome/plugin/npobject_stub.cc +++ b/chrome/plugin/npobject_stub.cc @@ -62,7 +62,7 @@ IPC::Channel::Listener* NPObjectStub::GetChannelListener() { return static_cast<IPC::Channel::Listener*>(this); } -void NPObjectStub::OnMessageReceived(const IPC::Message& msg) { +bool NPObjectStub::OnMessageReceived(const IPC::Message& msg) { child_process_logging::SetActiveURL(page_url_); if (!npobject_) { @@ -74,9 +74,10 @@ void NPObjectStub::OnMessageReceived(const IPC::Message& msg) { Send(reply); } - return; + return true; } + bool handled = true; IPC_BEGIN_MESSAGE_MAP(NPObjectStub, msg) IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_Release, OnRelease); IPC_MESSAGE_HANDLER(NPObjectMsg_HasMethod, OnHasMethod); @@ -89,8 +90,10 @@ void NPObjectStub::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(NPObjectMsg_Enumeration, OnEnumeration); IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_Construct, OnConstruct); IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_Evaluate, OnEvaluate); - IPC_MESSAGE_UNHANDLED_ERROR() + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + DCHECK(handled); + return handled; } void NPObjectStub::OnChannelError() { diff --git a/chrome/plugin/npobject_stub.h b/chrome/plugin/npobject_stub.h index 248d001..d43fbad 100644 --- a/chrome/plugin/npobject_stub.h +++ b/chrome/plugin/npobject_stub.h @@ -53,7 +53,7 @@ class NPObjectStub : public IPC::Channel::Listener, private: // IPC::Channel::Listener implementation: - virtual void OnMessageReceived(const IPC::Message& message); + virtual bool OnMessageReceived(const IPC::Message& message); virtual void OnChannelError(); // message handlers diff --git a/chrome/plugin/plugin_channel.cc b/chrome/plugin/plugin_channel.cc index bc5e61e..fc789353 100644 --- a/chrome/plugin/plugin_channel.cc +++ b/chrome/plugin/plugin_channel.cc @@ -190,23 +190,26 @@ bool PluginChannel::Send(IPC::Message* msg) { return result; } -void PluginChannel::OnMessageReceived(const IPC::Message& msg) { +bool PluginChannel::OnMessageReceived(const IPC::Message& msg) { if (log_messages_) { VLOG(1) << "received message @" << &msg << " on channel @" << this << " with type " << msg.type(); } - PluginChannelBase::OnMessageReceived(msg); + return PluginChannelBase::OnMessageReceived(msg); } -void PluginChannel::OnControlMessageReceived(const IPC::Message& msg) { +bool PluginChannel::OnControlMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(PluginChannel, msg) IPC_MESSAGE_HANDLER(PluginMsg_CreateInstance, OnCreateInstance) IPC_MESSAGE_HANDLER_DELAY_REPLY(PluginMsg_DestroyInstance, OnDestroyInstance) IPC_MESSAGE_HANDLER(PluginMsg_GenerateRouteID, OnGenerateRouteID) IPC_MESSAGE_HANDLER(PluginMsg_ClearSiteData, OnClearSiteData) - IPC_MESSAGE_UNHANDLED_ERROR() + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + DCHECK(handled); + return handled; } void PluginChannel::OnCreateInstance(const std::string& mime_type, diff --git a/chrome/plugin/plugin_channel.h b/chrome/plugin/plugin_channel.h index 519e03c..102d4d6 100644 --- a/chrome/plugin/plugin_channel.h +++ b/chrome/plugin/plugin_channel.h @@ -33,7 +33,7 @@ class PluginChannel : public PluginChannelBase { virtual ~PluginChannel(); virtual bool Send(IPC::Message* msg); - virtual void OnMessageReceived(const IPC::Message& message); + virtual bool OnMessageReceived(const IPC::Message& message); base::ProcessHandle renderer_handle() const { return renderer_handle_; } int renderer_id() { return renderer_id_; } @@ -69,7 +69,7 @@ class PluginChannel : public PluginChannelBase { // Called on the plugin thread PluginChannel(); - virtual void OnControlMessageReceived(const IPC::Message& msg); + virtual bool OnControlMessageReceived(const IPC::Message& msg); static PluginChannelBase* ClassFactory() { return new PluginChannel(); } diff --git a/chrome/plugin/plugin_channel_base.cc b/chrome/plugin/plugin_channel_base.cc index 37bc1c4..e251e9e 100644 --- a/chrome/plugin/plugin_channel_base.cc +++ b/chrome/plugin/plugin_channel_base.cc @@ -140,19 +140,20 @@ int PluginChannelBase::Count() { return static_cast<int>(g_plugin_channels_.size()); } -void PluginChannelBase::OnMessageReceived(const IPC::Message& message) { +bool PluginChannelBase::OnMessageReceived(const IPC::Message& message) { // This call might cause us to be deleted, so keep an extra reference to // ourself so that we can send the reply and decrement back in_dispatch_. lazy_plugin_channel_stack_.Pointer()->push( scoped_refptr<PluginChannelBase>(this)); + bool handled; if (message.should_unblock()) in_unblock_dispatch_++; if (message.routing_id() == MSG_ROUTING_CONTROL) { - OnControlMessageReceived(message); + handled = OnControlMessageReceived(message); } else { - bool routed = router_.RouteMessage(message); - if (!routed && message.is_sync()) { + handled = router_.RouteMessage(message); + if (!handled && message.is_sync()) { // The listener has gone away, so we must respond or else the caller will // hang waiting for a reply. IPC::Message* reply = IPC::SyncMessage::GenerateReply(&message); @@ -164,6 +165,7 @@ void PluginChannelBase::OnMessageReceived(const IPC::Message& message) { in_unblock_dispatch_--; lazy_plugin_channel_stack_.Pointer()->pop(); + return handled; } void PluginChannelBase::OnChannelConnected(int32 peer_pid) { @@ -228,9 +230,10 @@ void PluginChannelBase::RemoveRoute(int route_id) { } } -void PluginChannelBase::OnControlMessageReceived(const IPC::Message& msg) { +bool PluginChannelBase::OnControlMessageReceived(const IPC::Message& msg) { NOTREACHED() << "should override in subclass if you care about control messages"; + return false; } void PluginChannelBase::OnChannelError() { diff --git a/chrome/plugin/plugin_channel_base.h b/chrome/plugin/plugin_channel_base.h index 22103e8..d1a1a1c 100644 --- a/chrome/plugin/plugin_channel_base.h +++ b/chrome/plugin/plugin_channel_base.h @@ -89,10 +89,10 @@ class PluginChannelBase : public IPC::Channel::Listener, virtual void CleanUp() { } // Implemented by derived classes to handle control messages - virtual void OnControlMessageReceived(const IPC::Message& msg); + virtual bool OnControlMessageReceived(const IPC::Message& msg); // IPC::Channel::Listener implementation: - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); virtual void OnChannelConnected(int32 peer_pid); virtual void OnChannelError(); diff --git a/chrome/plugin/plugin_thread.cc b/chrome/plugin/plugin_thread.cc index 8edcbbd..d5757e1 100644 --- a/chrome/plugin/plugin_thread.cc +++ b/chrome/plugin/plugin_thread.cc @@ -128,13 +128,16 @@ PluginThread* PluginThread::current() { return lazy_tls.Pointer()->Get(); } -void PluginThread::OnControlMessageReceived(const IPC::Message& msg) { +bool PluginThread::OnControlMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(PluginThread, msg) IPC_MESSAGE_HANDLER(PluginProcessMsg_CreateChannel, OnCreateChannel) IPC_MESSAGE_HANDLER(PluginProcessMsg_PluginMessage, OnPluginMessage) IPC_MESSAGE_HANDLER(PluginProcessMsg_NotifyRenderersOfPendingShutdown, OnNotifyRenderersOfPendingShutdown) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + return handled; } void PluginThread::OnCreateChannel(int renderer_id, diff --git a/chrome/plugin/plugin_thread.h b/chrome/plugin/plugin_thread.h index 4d24e3c..f5ef267 100644 --- a/chrome/plugin/plugin_thread.h +++ b/chrome/plugin/plugin_thread.h @@ -31,7 +31,7 @@ class PluginThread : public ChildThread { FilePath plugin_path() { return plugin_path_; } private: - virtual void OnControlMessageReceived(const IPC::Message& msg); + virtual bool OnControlMessageReceived(const IPC::Message& msg); // Callback for when a channel has been created. void OnCreateChannel(int renderer_id, bool off_the_record); diff --git a/chrome/plugin/webplugin_delegate_stub.cc b/chrome/plugin/webplugin_delegate_stub.cc index 0540adf..41b0256 100644 --- a/chrome/plugin/webplugin_delegate_stub.cc +++ b/chrome/plugin/webplugin_delegate_stub.cc @@ -88,7 +88,7 @@ WebPluginDelegateStub::~WebPluginDelegateStub() { } } -void WebPluginDelegateStub::OnMessageReceived(const IPC::Message& msg) { +bool WebPluginDelegateStub::OnMessageReceived(const IPC::Message& msg) { child_process_logging::SetActiveURL(page_url_); // A plugin can execute a script to delete itself in any of its NPP methods. @@ -98,6 +98,7 @@ void WebPluginDelegateStub::OnMessageReceived(const IPC::Message& msg) { if (!in_destructor_) AddRef(); + bool handled = true; IPC_BEGIN_MESSAGE_MAP(WebPluginDelegateStub, msg) IPC_MESSAGE_HANDLER(PluginMsg_Init, OnInit) IPC_MESSAGE_HANDLER(PluginMsg_WillSendRequest, OnWillSendRequest) @@ -146,11 +147,14 @@ void WebPluginDelegateStub::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(PluginMsg_SetFakeAcceleratedSurfaceWindowHandle, OnSetFakeAcceleratedSurfaceWindowHandle) #endif - IPC_MESSAGE_UNHANDLED_ERROR() + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() if (!in_destructor_) Release(); + + DCHECK(handled); + return handled; } bool WebPluginDelegateStub::Send(IPC::Message* msg) { diff --git a/chrome/plugin/webplugin_delegate_stub.h b/chrome/plugin/webplugin_delegate_stub.h index c310467..0a95587 100644 --- a/chrome/plugin/webplugin_delegate_stub.h +++ b/chrome/plugin/webplugin_delegate_stub.h @@ -45,7 +45,7 @@ class WebPluginDelegateStub : public IPC::Channel::Listener, PluginChannel* channel); // IPC::Channel::Listener implementation: - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); // IPC::Message::Sender implementation: virtual bool Send(IPC::Message* msg); diff --git a/chrome/ppapi_plugin/ppapi_thread.cc b/chrome/ppapi_plugin/ppapi_thread.cc index be6075d..0fc5ace 100644 --- a/chrome/ppapi_plugin/ppapi_thread.cc +++ b/chrome/ppapi_plugin/ppapi_thread.cc @@ -35,7 +35,7 @@ PpapiThread::~PpapiThread() { // Note that this function is called only for messages from the channel to the // browser process. Messages from the renderer process are sent via a different // channel that ends up at Dispatcher::OnMessageReceived. -void PpapiThread::OnMessageReceived(const IPC::Message& msg) { +bool PpapiThread::OnMessageReceived(const IPC::Message& msg) { IPC_BEGIN_MESSAGE_MAP(PpapiThread, msg) IPC_MESSAGE_HANDLER(PpapiMsg_LoadPlugin, OnMsgLoadPlugin) @@ -45,6 +45,7 @@ void PpapiThread::OnMessageReceived(const IPC::Message& msg) { dispatcher_->OnMessageReceived(msg) )*/ IPC_END_MESSAGE_MAP() + return true; } void PpapiThread::OnMsgLoadPlugin(base::ProcessHandle host_process_handle, diff --git a/chrome/ppapi_plugin/ppapi_thread.h b/chrome/ppapi_plugin/ppapi_thread.h index 215d1bd..08e62fc 100644 --- a/chrome/ppapi_plugin/ppapi_thread.h +++ b/chrome/ppapi_plugin/ppapi_thread.h @@ -32,7 +32,7 @@ class PpapiThread : public ChildThread { private: // ChildThread overrides. - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); // Message handlers. void OnMsgLoadPlugin(base::ProcessHandle renderer_handle, diff --git a/chrome/profile_import/profile_import_thread.cc b/chrome/profile_import/profile_import_thread.cc index 2368573..f7a665b 100644 --- a/chrome/profile_import/profile_import_thread.cc +++ b/chrome/profile_import/profile_import_thread.cc @@ -34,7 +34,8 @@ ProfileImportThread::ProfileImportThread() ProfileImportThread::~ProfileImportThread() {} -void ProfileImportThread::OnControlMessageReceived(const IPC::Message& msg) { +bool ProfileImportThread::OnControlMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(ProfileImportThread, msg) IPC_MESSAGE_HANDLER(ProfileImportProcessMsg_StartImport, OnImportStart) @@ -42,7 +43,9 @@ void ProfileImportThread::OnControlMessageReceived(const IPC::Message& msg) { OnImportCancel) IPC_MESSAGE_HANDLER(ProfileImportProcessMsg_ReportImportItemFinished, OnImportItemFinished) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + return handled; } void ProfileImportThread::OnImportStart( diff --git a/chrome/profile_import/profile_import_thread.h b/chrome/profile_import/profile_import_thread.h index 079fa4c..0c86885 100644 --- a/chrome/profile_import/profile_import_thread.h +++ b/chrome/profile_import/profile_import_thread.h @@ -56,7 +56,7 @@ class ProfileImportThread : public ChildThread { private: // IPC messages - virtual void OnControlMessageReceived(const IPC::Message& msg); + virtual bool OnControlMessageReceived(const IPC::Message& msg); // Creates the importer and launches it in a new thread. Import is run on // a separate thread so that this thread can receive messages from the diff --git a/chrome/renderer/command_buffer_proxy.cc b/chrome/renderer/command_buffer_proxy.cc index 0cc1e6a..21eee90 100644 --- a/chrome/renderer/command_buffer_proxy.cc +++ b/chrome/renderer/command_buffer_proxy.cc @@ -34,14 +34,17 @@ CommandBufferProxy::~CommandBufferProxy() { } } -void CommandBufferProxy::OnMessageReceived(const IPC::Message& message) { +bool CommandBufferProxy::OnMessageReceived(const IPC::Message& message) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(CommandBufferProxy, message) IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_UpdateState, OnUpdateState); IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SwapBuffers, OnSwapBuffers); IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_NotifyRepaint, OnNotifyRepaint); - IPC_MESSAGE_UNHANDLED_ERROR() + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + DCHECK(handled); + return handled; } void CommandBufferProxy::OnChannelError() { diff --git a/chrome/renderer/command_buffer_proxy.h b/chrome/renderer/command_buffer_proxy.h index 245c0580..6f3688f 100644 --- a/chrome/renderer/command_buffer_proxy.h +++ b/chrome/renderer/command_buffer_proxy.h @@ -38,7 +38,7 @@ class CommandBufferProxy : public gpu::CommandBuffer, virtual ~CommandBufferProxy(); // IPC::Channel::Listener implementation: - virtual void OnMessageReceived(const IPC::Message& message); + virtual bool OnMessageReceived(const IPC::Message& message); virtual void OnChannelError(); int route_id() const { return route_id_; } diff --git a/chrome/renderer/device_orientation_dispatcher.h b/chrome/renderer/device_orientation_dispatcher.h index e2abf37..88c1ef5 100644 --- a/chrome/renderer/device_orientation_dispatcher.h +++ b/chrome/renderer/device_orientation_dispatcher.h @@ -8,18 +8,20 @@ #include "third_party/WebKit/WebKit/chromium/public/WebDeviceOrientationClient.h" #include "base/scoped_ptr.h" +#include "ipc/ipc_channel.h" class RenderView; -namespace IPC { class Message; } namespace WebKit { class WebDeviceOrientation; } struct ViewMsg_DeviceOrientationUpdated_Params; -class DeviceOrientationDispatcher : public WebKit::WebDeviceOrientationClient { +class DeviceOrientationDispatcher : public WebKit::WebDeviceOrientationClient, + public IPC::Channel::Listener { public: explicit DeviceOrientationDispatcher(RenderView* render_view); virtual ~DeviceOrientationDispatcher(); + // IPC::Channel::Implementation. bool OnMessageReceived(const IPC::Message& msg); // From WebKit::WebDeviceOrientationClient. diff --git a/chrome/renderer/devtools_agent.h b/chrome/renderer/devtools_agent.h index ebb06dd..14a7247 100644 --- a/chrome/renderer/devtools_agent.h +++ b/chrome/renderer/devtools_agent.h @@ -11,12 +11,9 @@ #include "base/basictypes.h" #include "chrome/common/devtools_messages.h" +#include "ipc/ipc_channel.h" #include "third_party/WebKit/WebKit/chromium/public/WebDevToolsAgentClient.h" -namespace IPC { -class Message; -} - namespace WebKit { class WebDevToolsAgent; } @@ -28,14 +25,15 @@ struct DevToolsMessageData; // agents with the communication capabilities. All messages from/to Glue's // agents infrastructure are flowing through this comminucation agent. // There is a corresponding DevToolsClient object on the client side. -class DevToolsAgent : public WebKit::WebDevToolsAgentClient { +class DevToolsAgent : public WebKit::WebDevToolsAgentClient, + public IPC::Channel::Listener { public: DevToolsAgent(int routing_id, RenderView* view); virtual ~DevToolsAgent(); void OnNavigate(); - // IPC message interceptor. Called on the Render thread. + // IPC::Channel::Listener implementation. virtual bool OnMessageReceived(const IPC::Message& message); // WebDevToolsAgentClient implementation diff --git a/chrome/renderer/devtools_client.h b/chrome/renderer/devtools_client.h index 577e189..463dc35 100644 --- a/chrome/renderer/devtools_client.h +++ b/chrome/renderer/devtools_client.h @@ -10,11 +10,9 @@ #include "base/basictypes.h" #include "base/scoped_ptr.h" +#include "ipc/ipc_channel.h" #include "third_party/WebKit/WebKit/chromium/public/WebDevToolsFrontendClient.h" -namespace IPC { -class Message; -} class MessageLoop; class RenderView; @@ -31,13 +29,13 @@ struct DevToolsMessageData; // corresponding DevToolsAgent object. // TODO(yurys): now the client is almost empty later it will delegate calls to // code in glue -class DevToolsClient : public WebKit::WebDevToolsFrontendClient { +class DevToolsClient : public WebKit::WebDevToolsFrontendClient, + public IPC::Channel::Listener { public: explicit DevToolsClient(RenderView* view); virtual ~DevToolsClient(); - // Called to possibly handle the incoming IPC message. Returns true if - // handled. Called in render thread. + // IPC::Channel::Listener implementation. bool OnMessageReceived(const IPC::Message& message); // WebDevToolsFrontendClient implementation diff --git a/chrome/renderer/geolocation_dispatcher_old.h b/chrome/renderer/geolocation_dispatcher_old.h index 51567ef..ab93c14 100644 --- a/chrome/renderer/geolocation_dispatcher_old.h +++ b/chrome/renderer/geolocation_dispatcher_old.h @@ -12,7 +12,7 @@ #include "base/basictypes.h" #include "base/id_map.h" -#include "ipc/ipc_message.h" +#include "ipc/ipc_channel.h" #include "googleurl/src/gurl.h" #include "third_party/WebKit/WebKit/chromium/public/WebGeolocationService.h" @@ -25,13 +25,13 @@ struct Geoposition; // It's the complement of GeolocationDispatcherHostOld (owned by // RenderViewHost). -class GeolocationDispatcherOld : public WebKit::WebGeolocationService { +class GeolocationDispatcherOld : public WebKit::WebGeolocationService, + public IPC::Channel::Listener { public: explicit GeolocationDispatcherOld(RenderView* render_view); virtual ~GeolocationDispatcherOld(); - // Called to possibly handle the incoming IPC message. Returns true if - // handled. Called in render thread. + // IPC::Channel::Listener implementation bool OnMessageReceived(const IPC::Message& msg); // WebKit::WebGeolocationService. diff --git a/chrome/renderer/gpu_channel_host.cc b/chrome/renderer/gpu_channel_host.cc index 80baea9..ecf7bfc 100644 --- a/chrome/renderer/gpu_channel_host.cc +++ b/chrome/renderer/gpu_channel_host.cc @@ -37,14 +37,14 @@ const GPUInfo& GpuChannelHost::gpu_info() const { return gpu_info_; } -void GpuChannelHost::OnMessageReceived(const IPC::Message& message) { +bool GpuChannelHost::OnMessageReceived(const IPC::Message& message) { DCHECK(message.routing_id() != MSG_ROUTING_CONTROL); // The object to which the message is addressed might have been destroyed. // This is expected, for example an asynchronous SwapBuffers notification // to a command buffer proxy that has since been destroyed. This function // fails silently in that case. - router_.RouteMessage(message); + return router_.RouteMessage(message); } void GpuChannelHost::OnChannelConnected(int32 peer_pid) { diff --git a/chrome/renderer/gpu_channel_host.h b/chrome/renderer/gpu_channel_host.h index 8d9c684..42eebba 100644 --- a/chrome/renderer/gpu_channel_host.h +++ b/chrome/renderer/gpu_channel_host.h @@ -53,7 +53,7 @@ class GpuChannelHost : public IPC::Channel::Listener, const GPUInfo& gpu_info() const; // IPC::Channel::Listener implementation: - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); virtual void OnChannelConnected(int32 peer_pid); virtual void OnChannelError(); diff --git a/chrome/renderer/gpu_video_decoder_host.cc b/chrome/renderer/gpu_video_decoder_host.cc index 44599f3..9d9ba04 100644 --- a/chrome/renderer/gpu_video_decoder_host.cc +++ b/chrome/renderer/gpu_video_decoder_host.cc @@ -32,7 +32,8 @@ void GpuVideoDecoderHost::OnChannelError() { ipc_sender_ = NULL; } -void GpuVideoDecoderHost::OnMessageReceived(const IPC::Message& msg) { +bool GpuVideoDecoderHost::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(GpuVideoDecoderHost, msg) IPC_MESSAGE_HANDLER(GpuVideoDecoderHostMsg_CreateVideoDecoderDone, OnCreateVideoDecoderDone) @@ -54,8 +55,10 @@ void GpuVideoDecoderHost::OnMessageReceived(const IPC::Message& msg) { OnAllocateVideoFrames) IPC_MESSAGE_HANDLER(GpuVideoDecoderHostMsg_ReleaseAllVideoFrames, OnReleaseAllVideoFrames) - IPC_MESSAGE_UNHANDLED_ERROR() + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + DCHECK(handled); + return handled; } void GpuVideoDecoderHost::Initialize( diff --git a/chrome/renderer/gpu_video_decoder_host.h b/chrome/renderer/gpu_video_decoder_host.h index c32a9f0..a7a3a71 100644 --- a/chrome/renderer/gpu_video_decoder_host.h +++ b/chrome/renderer/gpu_video_decoder_host.h @@ -50,7 +50,7 @@ class GpuVideoDecoderHost : public media::VideoDecodeEngine, // IPC::Channel::Listener. virtual void OnChannelConnected(int32 peer_pid) {} virtual void OnChannelError(); - virtual void OnMessageReceived(const IPC::Message& message); + virtual bool OnMessageReceived(const IPC::Message& message); // media::VideoDecodeEngine implementation. virtual void Initialize(MessageLoop* message_loop, diff --git a/chrome/renderer/indexed_db_dispatcher.h b/chrome/renderer/indexed_db_dispatcher.h index 1210551..8012015 100644 --- a/chrome/renderer/indexed_db_dispatcher.h +++ b/chrome/renderer/indexed_db_dispatcher.h @@ -8,7 +8,7 @@ #include "base/id_map.h" #include "base/nullable_string16.h" -#include "ipc/ipc_message.h" +#include "ipc/ipc_channel.h" #include "third_party/WebKit/WebKit/chromium/public/WebExceptionCode.h" #include "third_party/WebKit/WebKit/chromium/public/WebIDBCallbacks.h" #include "third_party/WebKit/WebKit/chromium/public/WebIDBDatabase.h" @@ -24,13 +24,12 @@ class WebIDBTransaction; } // Handle the indexed db related communication for this entire renderer. -class IndexedDBDispatcher { +class IndexedDBDispatcher : public IPC::Channel::Listener { public: IndexedDBDispatcher(); ~IndexedDBDispatcher(); - // Called to possibly handle the incoming IPC message. Returns true if - // handled. + // IPC::Channel::Listener implementation. bool OnMessageReceived(const IPC::Message& msg); void RequestIDBFactoryOpen( diff --git a/chrome/renderer/mock_render_thread.cc b/chrome/renderer/mock_render_thread.cc index c188f34..1d98d6e 100644 --- a/chrome/renderer/mock_render_thread.cc +++ b/chrome/renderer/mock_render_thread.cc @@ -81,7 +81,7 @@ void MockRenderThread::SendCloseMessage() { widget_->OnMessageReceived(msg); } -void MockRenderThread::OnMessageReceived(const IPC::Message& msg) { +bool MockRenderThread::OnMessageReceived(const IPC::Message& msg) { // Save the message in the sink. sink_.OnMessageReceived(msg); @@ -116,6 +116,7 @@ void MockRenderThread::OnMessageReceived(const IPC::Message& msg) { #endif IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP_EX() + return handled; } // The Widget expects to be returned valid route_id. diff --git a/chrome/renderer/mock_render_thread.h b/chrome/renderer/mock_render_thread.h index a1b58a5..2a6dc60 100644 --- a/chrome/renderer/mock_render_thread.h +++ b/chrome/renderer/mock_render_thread.h @@ -82,7 +82,7 @@ class MockRenderThread : public RenderThreadBase { private: // This function operates as a regular IPC listener. - void OnMessageReceived(const IPC::Message& msg); + bool OnMessageReceived(const IPC::Message& msg); // The Widget expects to be returned valid route_id. void OnMsgCreateWidget(int opener_id, diff --git a/chrome/renderer/notification_provider.h b/chrome/renderer/notification_provider.h index ccd6cf3..1ba84b2 100644 --- a/chrome/renderer/notification_provider.h +++ b/chrome/renderer/notification_provider.h @@ -18,7 +18,8 @@ class WebNotificationPermissionCallback; // NotificationProvider class is owned by the RenderView. Only // to be used on the UI thread. -class NotificationProvider : public WebKit::WebNotificationPresenter { +class NotificationProvider : public WebKit::WebNotificationPresenter, + public IPC::Channel::Listener { public: explicit NotificationProvider(RenderView* view); virtual ~NotificationProvider(); @@ -32,7 +33,7 @@ class NotificationProvider : public WebKit::WebNotificationPresenter { virtual void requestPermission(const WebKit::WebSecurityOrigin& origin, WebKit::WebNotificationPermissionCallback* callback); - // IPC message handler called from RenderView. + // IPC::Channel::Listener implementation. bool OnMessageReceived(const IPC::Message& message); // Called when the RenderView navigates. diff --git a/chrome/renderer/plugin_channel_host.cc b/chrome/renderer/plugin_channel_host.cc index b6a93c0..34d1461 100644 --- a/chrome/renderer/plugin_channel_host.cc +++ b/chrome/renderer/plugin_channel_host.cc @@ -114,12 +114,15 @@ void PluginChannelHost::RemoveRoute(int route_id) { PluginChannelBase::RemoveRoute(route_id); } -void PluginChannelHost::OnControlMessageReceived(const IPC::Message& message) { +bool PluginChannelHost::OnControlMessageReceived(const IPC::Message& message) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(PluginChannelHost, message) IPC_MESSAGE_HANDLER(PluginHostMsg_SetException, OnSetException) IPC_MESSAGE_HANDLER(PluginHostMsg_PluginShuttingDown, OnPluginShuttingDown) - IPC_MESSAGE_UNHANDLED_ERROR() + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + DCHECK(handled); + return handled; } void PluginChannelHost::OnSetException(const std::string& message) { diff --git a/chrome/renderer/plugin_channel_host.h b/chrome/renderer/plugin_channel_host.h index 241833f..5f6d556 100644 --- a/chrome/renderer/plugin_channel_host.h +++ b/chrome/renderer/plugin_channel_host.h @@ -48,7 +48,7 @@ class PluginChannelHost : public PluginChannelBase { static PluginChannelBase* ClassFactory() { return new PluginChannelHost(); } - virtual void OnControlMessageReceived(const IPC::Message& message); + virtual bool OnControlMessageReceived(const IPC::Message& message); void OnSetException(const std::string& message); void OnPluginShuttingDown(const IPC::Message& message); diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc index 5fc265e..f1f1008 100644 --- a/chrome/renderer/render_thread.cc +++ b/chrome/renderer/render_thread.cc @@ -593,13 +593,14 @@ void RenderThread::OnDOMStorageEvent( params.storage_type == DOM_STORAGE_LOCAL); } -void RenderThread::OnControlMessageReceived(const IPC::Message& msg) { +bool RenderThread::OnControlMessageReceived(const IPC::Message& msg) { // Some messages are handled by delegates. if (appcache_dispatcher_->OnMessageReceived(msg)) - return; + return true; if (indexed_db_dispatcher_->OnMessageReceived(msg)) - return; + return true; + bool handled = true; IPC_BEGIN_MESSAGE_MAP(RenderThread, msg) IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_NewTable, OnUpdateVisitedLinks) IPC_MESSAGE_HANDLER(ViewMsg_VisitedLink_Add, OnAddVisitedLinks) @@ -660,7 +661,9 @@ void RenderThread::OnControlMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(ViewMsg_SetPhishingModel, OnSetPhishingModel) IPC_MESSAGE_HANDLER(ViewMsg_SpeechInput_SetFeatureEnabled, OnSetSpeechInputEnabled) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + return handled; } void RenderThread::OnSetSpeechInputEnabled(bool enabled) { diff --git a/chrome/renderer/render_thread.h b/chrome/renderer/render_thread.h index 6946a47..6817cfb 100644 --- a/chrome/renderer/render_thread.h +++ b/chrome/renderer/render_thread.h @@ -254,7 +254,7 @@ class RenderThread : public RenderThreadBase, int extension_group); private: - virtual void OnControlMessageReceived(const IPC::Message& msg); + virtual bool OnControlMessageReceived(const IPC::Message& msg); void Init(); diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 7a84c11..1a9aef5 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -944,31 +944,32 @@ void RenderView::Init(gfx::NativeViewId parent_hwnd, render_thread_->AddFilter(audio_message_filter_); } -void RenderView::OnMessageReceived(const IPC::Message& message) { +bool RenderView::OnMessageReceived(const IPC::Message& message) { WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL; if (main_frame) child_process_logging::SetActiveURL(main_frame->url()); // If this is developer tools renderer intercept tools messages first. if (devtools_client_.get() && devtools_client_->OnMessageReceived(message)) - return; + return true; if (devtools_agent_.get() && devtools_agent_->OnMessageReceived(message)) - return; + return true; if (notification_provider_->OnMessageReceived(message)) - return; + return true; if (geolocation_dispatcher_.get() && geolocation_dispatcher_->OnMessageReceived(message)) { - return; + return true; } if (speech_input_dispatcher_.get() && speech_input_dispatcher_->OnMessageReceived(message)) { - return; + return true; } if (device_orientation_dispatcher_.get() && device_orientation_dispatcher_->OnMessageReceived(message)) { - return; + return true; } + bool handled = true; IPC_BEGIN_MESSAGE_MAP(RenderView, message) IPC_MESSAGE_HANDLER(ViewMsg_CaptureThumbnail, OnCaptureThumbnail) IPC_MESSAGE_HANDLER(ViewMsg_CaptureSnapshot, OnCaptureSnapshot) @@ -1102,8 +1103,9 @@ void RenderView::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER(ViewMsg_PrintPreview, OnPrintPreview) // Have the super handle all other messages. - IPC_MESSAGE_UNHANDLED(RenderWidget::OnMessageReceived(message)) + IPC_MESSAGE_UNHANDLED(handled = RenderWidget::OnMessageReceived(message)) IPC_END_MESSAGE_MAP() + return handled; } void RenderView::OnCaptureThumbnail() { diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h index 1f97fa6..862ed6c 100644 --- a/chrome/renderer/render_view.h +++ b/chrome/renderer/render_view.h @@ -388,7 +388,7 @@ class RenderView : public RenderWidget, // IPC::Channel::Listener implementation ------------------------------------- - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); // WebKit::WebWidgetClient implementation ------------------------------------ diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc index 9cf323c..2f14576 100644 --- a/chrome/renderer/render_widget.cc +++ b/chrome/renderer/render_widget.cc @@ -153,25 +153,29 @@ void RenderWidget::CompleteInit(gfx::NativeViewId parent_hwnd) { Send(new ViewHostMsg_RenderViewReady(routing_id_)); } -IPC_DEFINE_MESSAGE_MAP(RenderWidget) - IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) - IPC_MESSAGE_HANDLER(ViewMsg_CreatingNew_ACK, OnCreatingNewAck) - IPC_MESSAGE_HANDLER(ViewMsg_Resize, OnResize) - IPC_MESSAGE_HANDLER(ViewMsg_WasHidden, OnWasHidden) - IPC_MESSAGE_HANDLER(ViewMsg_WasRestored, OnWasRestored) - IPC_MESSAGE_HANDLER(ViewMsg_UpdateRect_ACK, OnUpdateRectAck) - IPC_MESSAGE_HANDLER(ViewMsg_HandleInputEvent, OnHandleInputEvent) - IPC_MESSAGE_HANDLER(ViewMsg_MouseCaptureLost, OnMouseCaptureLost) - IPC_MESSAGE_HANDLER(ViewMsg_SetFocus, OnSetFocus) - IPC_MESSAGE_HANDLER(ViewMsg_SetInputMethodActive, OnSetInputMethodActive) - IPC_MESSAGE_HANDLER(ViewMsg_ImeSetComposition, OnImeSetComposition) - IPC_MESSAGE_HANDLER(ViewMsg_ImeConfirmComposition, OnImeConfirmComposition) - IPC_MESSAGE_HANDLER(ViewMsg_PaintAtSize, OnMsgPaintAtSize) - IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnMsgRepaint) - IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection) - IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck) - IPC_MESSAGE_UNHANDLED_ERROR() -IPC_END_MESSAGE_MAP() +bool RenderWidget::OnMessageReceived(const IPC::Message& message) { + bool handled = true; + IPC_BEGIN_MESSAGE_MAP(RenderWidget, message) + IPC_MESSAGE_HANDLER(ViewMsg_Close, OnClose) + IPC_MESSAGE_HANDLER(ViewMsg_CreatingNew_ACK, OnCreatingNewAck) + IPC_MESSAGE_HANDLER(ViewMsg_Resize, OnResize) + IPC_MESSAGE_HANDLER(ViewMsg_WasHidden, OnWasHidden) + IPC_MESSAGE_HANDLER(ViewMsg_WasRestored, OnWasRestored) + IPC_MESSAGE_HANDLER(ViewMsg_UpdateRect_ACK, OnUpdateRectAck) + IPC_MESSAGE_HANDLER(ViewMsg_HandleInputEvent, OnHandleInputEvent) + IPC_MESSAGE_HANDLER(ViewMsg_MouseCaptureLost, OnMouseCaptureLost) + IPC_MESSAGE_HANDLER(ViewMsg_SetFocus, OnSetFocus) + IPC_MESSAGE_HANDLER(ViewMsg_SetInputMethodActive, OnSetInputMethodActive) + IPC_MESSAGE_HANDLER(ViewMsg_ImeSetComposition, OnImeSetComposition) + IPC_MESSAGE_HANDLER(ViewMsg_ImeConfirmComposition, OnImeConfirmComposition) + IPC_MESSAGE_HANDLER(ViewMsg_PaintAtSize, OnMsgPaintAtSize) + IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnMsgRepaint) + IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection) + IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck) + IPC_MESSAGE_UNHANDLED(handled = false) + IPC_END_MESSAGE_MAP() + return handled; +} bool RenderWidget::Send(IPC::Message* message) { // Don't send any messages after the browser has told us to close. diff --git a/chrome/renderer/render_widget.h b/chrome/renderer/render_widget.h index bf542bf..f847ce2 100644 --- a/chrome/renderer/render_widget.h +++ b/chrome/renderer/render_widget.h @@ -92,7 +92,7 @@ class RenderWidget : public IPC::Channel::Listener, bool has_focus() const { return has_focus_; } // IPC::Channel::Listener - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); // IPC::Message::Sender virtual bool Send(IPC::Message* msg); diff --git a/chrome/renderer/renderer_main_unittest.cc b/chrome/renderer/renderer_main_unittest.cc index 464419b..653e02f 100644 --- a/chrome/renderer/renderer_main_unittest.cc +++ b/chrome/renderer/renderer_main_unittest.cc @@ -89,9 +89,10 @@ class SuicidalListener : public IPC::Channel::Listener { MessageLoop::current()->Quit(); } - void OnMessageReceived(const IPC::Message& message) { + bool OnMessageReceived(const IPC::Message& message) { // We shouldn't receive any messages - ASSERT_TRUE(false); + NOTREACHED(); + return false; } }; diff --git a/chrome/renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc b/chrome/renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc index f84b0bd..edb5394 100644 --- a/chrome/renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc +++ b/chrome/renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc @@ -59,13 +59,15 @@ class MockScorer : public Scorer { class PhishingClassifierDelegateTest : public RenderViewFakeResourcesTest { protected: - void OnMessageReceived(const IPC::Message& message) { + bool OnMessageReceived(const IPC::Message& message) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(PhishingClassifierDelegateTest, message) IPC_MESSAGE_HANDLER(ViewHostMsg_DetectedPhishingSite, OnDetectedPhishingSite) IPC_MESSAGE_UNHANDLED( - RenderViewFakeResourcesTest::OnMessageReceived(message)) + handled = RenderViewFakeResourcesTest::OnMessageReceived(message)) IPC_END_MESSAGE_MAP() + return handled; } void OnDetectedPhishingSite(GURL phishing_url, diff --git a/chrome/renderer/safe_browsing/render_view_fake_resources_test.cc b/chrome/renderer/safe_browsing/render_view_fake_resources_test.cc index e745373..bc52ef2 100644 --- a/chrome/renderer/safe_browsing/render_view_fake_resources_test.cc +++ b/chrome/renderer/safe_browsing/render_view_fake_resources_test.cc @@ -36,13 +36,14 @@ const int32 RenderViewFakeResourcesTest::kViewId = 5; RenderViewFakeResourcesTest::RenderViewFakeResourcesTest() {} RenderViewFakeResourcesTest::~RenderViewFakeResourcesTest() {} -void RenderViewFakeResourcesTest::OnMessageReceived( +bool RenderViewFakeResourcesTest::OnMessageReceived( const IPC::Message& message) { IPC_BEGIN_MESSAGE_MAP(RenderViewFakeResourcesTest, message) IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnRenderViewReady) IPC_MESSAGE_HANDLER(ViewHostMsg_DidStopLoading, OnDidStopLoading) IPC_MESSAGE_HANDLER(ViewHostMsg_RequestResource, OnRequestResource) IPC_END_MESSAGE_MAP() + return true; } bool RenderViewFakeResourcesTest::Visit(RenderView* render_view) { diff --git a/chrome/renderer/safe_browsing/render_view_fake_resources_test.h b/chrome/renderer/safe_browsing/render_view_fake_resources_test.h index 953b0cb..a92fb28 100644 --- a/chrome/renderer/safe_browsing/render_view_fake_resources_test.h +++ b/chrome/renderer/safe_browsing/render_view_fake_resources_test.h @@ -71,7 +71,7 @@ class RenderViewFakeResourcesTest : public ::testing::Test, public RenderViewVisitor { public: // IPC::Channel::Listener implementation. - virtual void OnMessageReceived(const IPC::Message& message); + virtual bool OnMessageReceived(const IPC::Message& message); // RenderViewVisitor implementation. virtual bool Visit(RenderView* render_view); diff --git a/chrome/renderer/speech_input_dispatcher.h b/chrome/renderer/speech_input_dispatcher.h index 09133d2..e993226 100644 --- a/chrome/renderer/speech_input_dispatcher.h +++ b/chrome/renderer/speech_input_dispatcher.h @@ -7,7 +7,7 @@ #include "base/basictypes.h" #include "chrome/common/speech_input_result.h" -#include "ipc/ipc_message.h" +#include "ipc/ipc_channel.h" #include "third_party/WebKit/WebKit/chromium/public/WebSpeechInputController.h" class GURL; @@ -21,13 +21,13 @@ struct WebRect; // SpeechInputDispatcher is a delegate for speech input messages used by WebKit. // It's the complement of SpeechInputDispatcherHost (owned by RenderViewHost). -class SpeechInputDispatcher : public WebKit::WebSpeechInputController { +class SpeechInputDispatcher : public WebKit::WebSpeechInputController, + public IPC::Channel::Listener { public: SpeechInputDispatcher(RenderView* render_view, WebKit::WebSpeechInputListener* listener); - // Called to possibly handle the incoming IPC message. Returns true if - // handled. Called in render thread. + // IPC::Channel::Listener implementation. bool OnMessageReceived(const IPC::Message& msg); // WebKit::WebSpeechInputController. diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc index 1b2e7d7..e76977f 100644 --- a/chrome/renderer/webplugin_delegate_proxy.cc +++ b/chrome/renderer/webplugin_delegate_proxy.cc @@ -424,9 +424,10 @@ void WebPluginDelegateProxy::InstallMissingPlugin() { Send(new PluginMsg_InstallMissingPlugin(instance_id_)); } -void WebPluginDelegateProxy::OnMessageReceived(const IPC::Message& msg) { +bool WebPluginDelegateProxy::OnMessageReceived(const IPC::Message& msg) { child_process_logging::SetActiveURL(page_url_); + bool handled = true; IPC_BEGIN_MESSAGE_MAP(WebPluginDelegateProxy, msg) IPC_MESSAGE_HANDLER(PluginHostMsg_SetWindow, OnSetWindow) #if defined(OS_WIN) @@ -478,9 +479,10 @@ void WebPluginDelegateProxy::OnMessageReceived(const IPC::Message& msg) { #endif IPC_MESSAGE_HANDLER(PluginHostMsg_URLRedirectResponse, OnURLRedirectResponse) - - IPC_MESSAGE_UNHANDLED_ERROR() + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + DCHECK(handled); + return handled; } void WebPluginDelegateProxy::OnChannelError() { diff --git a/chrome/renderer/webplugin_delegate_proxy.h b/chrome/renderer/webplugin_delegate_proxy.h index 30e212e..49bcc70 100644 --- a/chrome/renderer/webplugin_delegate_proxy.h +++ b/chrome/renderer/webplugin_delegate_proxy.h @@ -95,7 +95,7 @@ class WebPluginDelegateProxy #endif // IPC::Channel::Listener implementation: - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); virtual void OnChannelError(); // IPC::Message::Sender implementation: diff --git a/chrome/renderer/websharedworker_proxy.cc b/chrome/renderer/websharedworker_proxy.cc index 8c79cb8..84043d8 100644 --- a/chrome/renderer/websharedworker_proxy.cc +++ b/chrome/renderer/websharedworker_proxy.cc @@ -67,10 +67,13 @@ void WebSharedWorkerProxy::connect(WebKit::WebMessagePortChannel* channel, } } -void WebSharedWorkerProxy::OnMessageReceived(const IPC::Message& message) { +bool WebSharedWorkerProxy::OnMessageReceived(const IPC::Message& message) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(WebSharedWorkerProxy, message) IPC_MESSAGE_HANDLER(ViewMsg_WorkerCreated, OnWorkerCreated) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + return handled; } void WebSharedWorkerProxy::OnWorkerCreated() { diff --git a/chrome/renderer/websharedworker_proxy.h b/chrome/renderer/websharedworker_proxy.h index 78b1167..d818264 100644 --- a/chrome/renderer/websharedworker_proxy.h +++ b/chrome/renderer/websharedworker_proxy.h @@ -41,7 +41,7 @@ class WebSharedWorkerProxy : public WebKit::WebSharedWorker, virtual void clientDestroyed(); // IPC::Channel::Listener implementation. - virtual void OnMessageReceived(const IPC::Message& message); + virtual bool OnMessageReceived(const IPC::Message& message); private: void OnWorkerCreated(); diff --git a/chrome/renderer/webworker_proxy.cc b/chrome/renderer/webworker_proxy.cc index abbb51f..3ae1749 100644 --- a/chrome/renderer/webworker_proxy.cc +++ b/chrome/renderer/webworker_proxy.cc @@ -84,10 +84,11 @@ void WebWorkerProxy::workerObjectDestroyed() { void WebWorkerProxy::clientDestroyed() { } -void WebWorkerProxy::OnMessageReceived(const IPC::Message& message) { +bool WebWorkerProxy::OnMessageReceived(const IPC::Message& message) { if (!client_) - return; + return false; + bool handled = true; IPC_BEGIN_MESSAGE_MAP(WebWorkerProxy, message) IPC_MESSAGE_HANDLER(ViewMsg_WorkerCreated, OnWorkerCreated) IPC_MESSAGE_HANDLER(WorkerMsg_PostMessage, OnPostMessage) @@ -105,7 +106,9 @@ void WebWorkerProxy::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_FORWARD(WorkerHostMsg_WorkerContextDestroyed, static_cast<WebCommonWorkerClient*>(client_), WebCommonWorkerClient::workerContextDestroyed) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + return handled; } void WebWorkerProxy::OnWorkerCreated() { diff --git a/chrome/renderer/webworker_proxy.h b/chrome/renderer/webworker_proxy.h index 556f3dc..4b51b4f 100644 --- a/chrome/renderer/webworker_proxy.h +++ b/chrome/renderer/webworker_proxy.h @@ -43,7 +43,7 @@ class WebWorkerProxy : public WebKit::WebWorker, private WebWorkerBase { virtual void clientDestroyed(); // IPC::Channel::Listener implementation. - virtual void OnMessageReceived(const IPC::Message& message); + virtual bool OnMessageReceived(const IPC::Message& message); private: void CancelCreation(); diff --git a/chrome/service/service_ipc_server.cc b/chrome/service/service_ipc_server.cc index c7280c3..aa4d8ec 100644 --- a/chrome/service/service_ipc_server.cc +++ b/chrome/service/service_ipc_server.cc @@ -77,7 +77,8 @@ bool ServiceIPCServer::Send(IPC::Message* msg) { return channel_->Send(msg); } -void ServiceIPCServer::OnMessageReceived(const IPC::Message& msg) { +bool ServiceIPCServer::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(ServiceIPCServer, msg) IPC_MESSAGE_HANDLER(ServiceMsg_EnableCloudPrintProxy, OnEnableCloudPrintProxy) @@ -100,7 +101,9 @@ void ServiceIPCServer::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(ServiceMsg_Hello, OnHello); IPC_MESSAGE_HANDLER(ServiceMsg_Shutdown, OnShutdown); IPC_MESSAGE_HANDLER(ServiceMsg_UpdateAvailable, OnUpdateAvailable); + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + return handled; } void ServiceIPCServer::OnEnableCloudPrintProxy(const std::string& lsid) { diff --git a/chrome/service/service_ipc_server.h b/chrome/service/service_ipc_server.h index af19f7b..bff4f45 100644 --- a/chrome/service/service_ipc_server.h +++ b/chrome/service/service_ipc_server.h @@ -35,7 +35,7 @@ class ServiceIPCServer : public IPC::Channel::Listener, private: // IPC::Channel::Listener implementation: - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); virtual void OnChannelConnected(int32 peer_pid); virtual void OnChannelError(); diff --git a/chrome/service/service_utility_process_host.cc b/chrome/service/service_utility_process_host.cc index d6b4dbe..859e725 100644 --- a/chrome/service/service_utility_process_host.cc +++ b/chrome/service/service_utility_process_host.cc @@ -128,7 +128,7 @@ void ServiceUtilityProcessHost::OnChildDied() { ServiceChildProcessHost::OnChildDied(); } -void ServiceUtilityProcessHost::OnMessageReceived(const IPC::Message& message) { +bool ServiceUtilityProcessHost::OnMessageReceived(const IPC::Message& message) { bool msg_is_ok = false; IPC_BEGIN_MESSAGE_MAP_EX(ServiceUtilityProcessHost, message, msg_is_ok) #if defined(OS_WIN) // This hack is Windows-specific. @@ -138,6 +138,7 @@ void ServiceUtilityProcessHost::OnMessageReceived(const IPC::Message& message) { OnRenderPDFPagesToMetafileSucceeded) IPC_MESSAGE_UNHANDLED(msg_is_ok__ = MessageForClient(message)) IPC_END_MESSAGE_MAP_EX() + return true; } bool ServiceUtilityProcessHost::MessageForClient(const IPC::Message& message) { @@ -172,8 +173,9 @@ void ServiceUtilityProcessHost::OnRenderPDFPagesToMetafileSucceeded( waiting_for_reply_ = false; } -void ServiceUtilityProcessHost::Client::OnMessageReceived( +bool ServiceUtilityProcessHost::Client::OnMessageReceived( const IPC::Message& message) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(ServiceUtilityProcessHost, message) IPC_MESSAGE_HANDLER(UtilityHostMsg_RenderPDFPagesToMetafile_Failed, Client::OnRenderPDFPagesToMetafileFailed) @@ -181,7 +183,9 @@ void ServiceUtilityProcessHost::Client::OnMessageReceived( Client::OnGetPrinterCapsAndDefaultsSucceeded) IPC_MESSAGE_HANDLER(UtilityHostMsg_GetPrinterCapsAndDefaults_Failed, Client::OnGetPrinterCapsAndDefaultsFailed) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP_EX() + return handled; } void ServiceUtilityProcessHost::Client::MetafileAvailable( diff --git a/chrome/service/service_utility_process_host.h b/chrome/service/service_utility_process_host.h index 54e039c..b770e1a 100644 --- a/chrome/service/service_utility_process_host.h +++ b/chrome/service/service_utility_process_host.h @@ -80,7 +80,7 @@ class ServiceUtilityProcessHost : public ServiceChildProcessHost { friend class base::RefCountedThreadSafe<Client>; friend class ServiceUtilityProcessHost; - void OnMessageReceived(const IPC::Message& message); + bool OnMessageReceived(const IPC::Message& message); // Invoked when a metafile file is ready. void MetafileAvailable(const FilePath& metafile_path, int highest_rendered_page_number); @@ -122,7 +122,7 @@ class ServiceUtilityProcessHost : public ServiceChildProcessHost { bool StartProcess(bool no_sandbox, const FilePath& exposed_dir); // IPC messages: - virtual void OnMessageReceived(const IPC::Message& message); + virtual bool OnMessageReceived(const IPC::Message& message); // Called when at least one page in the specified PDF has been rendered // successfully into metafile_path_; void OnRenderPDFPagesToMetafileSucceeded(int highest_rendered_page_number); diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc index bf00ea6..cf9391d 100644 --- a/chrome/test/automation/automation_proxy.cc +++ b/chrome/test/automation/automation_proxy.cc @@ -42,17 +42,16 @@ class AutomationMessageFilter : public IPC::ChannelProxy::MessageFilter { // the message be handled in the default way. virtual bool OnMessageReceived(const IPC::Message& message) { bool handled = true; - IPC_BEGIN_MESSAGE_MAP(AutomationMessageFilter, message) IPC_MESSAGE_HANDLER_GENERIC(AutomationMsg_Hello, - OnAutomationHello(message)); + OnAutomationHello(message)) IPC_MESSAGE_HANDLER_GENERIC( - AutomationMsg_InitialLoadsComplete, server_->SignalInitialLoads()); + AutomationMsg_InitialLoadsComplete, server_->SignalInitialLoads()) IPC_MESSAGE_HANDLER(AutomationMsg_InitialNewTabUILoadComplete, - NewTabLoaded); + NewTabLoaded) IPC_MESSAGE_HANDLER_GENERIC( - AutomationMsg_InvalidateHandle, server_->InvalidateHandle(message)); - IPC_MESSAGE_UNHANDLED(handled = false); + AutomationMsg_InvalidateHandle, server_->InvalidateHandle(message)) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; @@ -379,10 +378,11 @@ void AutomationProxy::Disconnect() { channel_.reset(); } -void AutomationProxy::OnMessageReceived(const IPC::Message& msg) { +bool AutomationProxy::OnMessageReceived(const IPC::Message& msg) { // This won't get called unless AutomationProxy is run from // inside a message loop. NOTREACHED(); + return false; } void AutomationProxy::OnChannelError() { diff --git a/chrome/test/automation/automation_proxy.h b/chrome/test/automation/automation_proxy.h index b0cd74c..ee77016 100644 --- a/chrome/test/automation/automation_proxy.h +++ b/chrome/test/automation/automation_proxy.h @@ -70,7 +70,7 @@ class AutomationProxy : public IPC::Channel::Listener, bool use_named_interface); // IPC callback - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); virtual void OnChannelError(); // Close the automation IPC channel. diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc index 9c36fe1..8568e5e 100644 --- a/chrome/test/automation/automation_proxy_uitest.cc +++ b/chrome/test/automation/automation_proxy_uitest.cc @@ -762,7 +762,8 @@ const AutomationURLResponse ExternalTabUITestMockClient::http_200( "", 0); -void ExternalTabUITestMockClient::OnMessageReceived(const IPC::Message& msg) { +bool ExternalTabUITestMockClient::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(ExternalTabUITestMockClient, msg) IPC_MESSAGE_HANDLER(AutomationMsg_DidNavigate, OnDidNavigate) IPC_MESSAGE_HANDLER(AutomationMsg_ForwardMessageToExternalHost, @@ -776,7 +777,9 @@ void ExternalTabUITestMockClient::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(AutomationMsg_OpenURL, OnOpenURL) IPC_MESSAGE_HANDLER(AutomationMsg_NavigationStateChanged, OnNavigationStateChanged) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + return handled; } scoped_refptr<TabProxy> ExternalTabUITestMockClient::CreateHostWindowAndTab( diff --git a/chrome/test/automation/automation_proxy_uitest.h b/chrome/test/automation/automation_proxy_uitest.h index 35de197..6f87c4e 100644 --- a/chrome/test/automation/automation_proxy_uitest.h +++ b/chrome/test/automation/automation_proxy_uitest.h @@ -101,7 +101,7 @@ class ExternalTabUITestMockClient : public AutomationProxy { gfx::NativeWindow host_window_; // Simple dispatcher to above OnXXX methods. - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); virtual void InvalidateHandle(const IPC::Message& message); }; diff --git a/chrome/test/automation/tab_proxy.cc b/chrome/test/automation/tab_proxy.cc index dbf298c..ce7ed16 100644 --- a/chrome/test/automation/tab_proxy.cc +++ b/chrome/test/automation/tab_proxy.cc @@ -790,10 +790,11 @@ void TabProxy::RemoveObserver(TabProxyDelegate* observer) { } // Called on Channel background thread, if TabMessages filter is installed. -void TabProxy::OnMessageReceived(const IPC::Message& message) { +bool TabProxy::OnMessageReceived(const IPC::Message& message) { AutoLock lock(list_lock_); FOR_EACH_OBSERVER(TabProxyDelegate, observers_list_, OnMessageReceived(this, message)); + return true; } void TabProxy::OnChannelError() { diff --git a/chrome/test/automation/tab_proxy.h b/chrome/test/automation/tab_proxy.h index 8c70abd3..82f65ac 100644 --- a/chrome/test/automation/tab_proxy.h +++ b/chrome/test/automation/tab_proxy.h @@ -405,7 +405,7 @@ class TabProxy : public AutomationResourceProxy, // Calls delegates void AddObserver(TabProxyDelegate* observer); void RemoveObserver(TabProxyDelegate* observer); - void OnMessageReceived(const IPC::Message& message); + bool OnMessageReceived(const IPC::Message& message); void OnChannelError(); protected: virtual ~TabProxy(); diff --git a/chrome/utility/utility_thread.cc b/chrome/utility/utility_thread.cc index baf831f..2349f07 100644 --- a/chrome/utility/utility_thread.cc +++ b/chrome/utility/utility_thread.cc @@ -51,7 +51,8 @@ UtilityThread::UtilityThread() UtilityThread::~UtilityThread() { } -void UtilityThread::OnControlMessageReceived(const IPC::Message& msg) { +bool UtilityThread::OnControlMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(UtilityThread, msg) IPC_MESSAGE_HANDLER(UtilityMsg_UnpackExtension, OnUnpackExtension) IPC_MESSAGE_HANDLER(UtilityMsg_UnpackWebResource, OnUnpackWebResource) @@ -65,7 +66,9 @@ void UtilityThread::OnControlMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(UtilityMsg_BatchMode_Finished, OnBatchModeFinished) IPC_MESSAGE_HANDLER(UtilityMsg_GetPrinterCapsAndDefaults, OnGetPrinterCapsAndDefaults) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + return handled; } void UtilityThread::OnUnpackExtension(const FilePath& extension_path) { diff --git a/chrome/utility/utility_thread.h b/chrome/utility/utility_thread.h index 187f914..ce4cc25 100644 --- a/chrome/utility/utility_thread.h +++ b/chrome/utility/utility_thread.h @@ -38,7 +38,7 @@ class UtilityThread : public ChildThread { private: // IPC messages - virtual void OnControlMessageReceived(const IPC::Message& msg); + virtual bool OnControlMessageReceived(const IPC::Message& msg); void OnUnpackExtension(const FilePath& extension_path); // IPC messages for web resource service. diff --git a/chrome/worker/websharedworker_stub.cc b/chrome/worker/websharedworker_stub.cc index 8cb167a..0c03ba0 100644 --- a/chrome/worker/websharedworker_stub.cc +++ b/chrome/worker/websharedworker_stub.cc @@ -26,13 +26,16 @@ WebSharedWorkerStub::~WebSharedWorkerStub() { impl_->clientDestroyed(); } -void WebSharedWorkerStub::OnMessageReceived(const IPC::Message& message) { +bool WebSharedWorkerStub::OnMessageReceived(const IPC::Message& message) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(WebSharedWorkerStub, message) IPC_MESSAGE_HANDLER(WorkerMsg_StartWorkerContext, OnStartWorkerContext) IPC_MESSAGE_HANDLER(WorkerMsg_TerminateWorkerContext, OnTerminateWorkerContext) IPC_MESSAGE_HANDLER(WorkerMsg_Connect, OnConnect) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + return handled; } void WebSharedWorkerStub::OnChannelError() { diff --git a/chrome/worker/websharedworker_stub.h b/chrome/worker/websharedworker_stub.h index b9cb60c..04f07af 100644 --- a/chrome/worker/websharedworker_stub.h +++ b/chrome/worker/websharedworker_stub.h @@ -22,7 +22,7 @@ class WebSharedWorkerStub : public WebWorkerStubBase { const WorkerAppCacheInitInfo& appcache_init_info); // IPC::Channel::Listener implementation. - virtual void OnMessageReceived(const IPC::Message& message); + virtual bool OnMessageReceived(const IPC::Message& message); virtual void OnChannelError(); virtual const GURL& url() const; diff --git a/chrome/worker/webworker_stub.cc b/chrome/worker/webworker_stub.cc index cd58cab..a3d3ba4 100644 --- a/chrome/worker/webworker_stub.cc +++ b/chrome/worker/webworker_stub.cc @@ -60,10 +60,11 @@ const GURL& WebWorkerStub::url() const { return url_; } -void WebWorkerStub::OnMessageReceived(const IPC::Message& message) { +bool WebWorkerStub::OnMessageReceived(const IPC::Message& message) { if (!impl_) - return; + return false; + bool handled = true; IPC_BEGIN_MESSAGE_MAP(WebWorkerStub, message) IPC_MESSAGE_FORWARD(WorkerMsg_StartWorkerContext, impl_, WebWorker::startWorkerContext) @@ -72,7 +73,9 @@ void WebWorkerStub::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER(WorkerMsg_PostMessage, OnPostMessage) IPC_MESSAGE_FORWARD(WorkerMsg_WorkerObjectDestroyed, impl_, WebWorker::workerObjectDestroyed) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + return handled; } void WebWorkerStub::OnTerminateWorkerContext() { diff --git a/chrome/worker/webworker_stub.h b/chrome/worker/webworker_stub.h index 76e1058..cc0d75d 100644 --- a/chrome/worker/webworker_stub.h +++ b/chrome/worker/webworker_stub.h @@ -22,7 +22,7 @@ class WebWorkerStub : public WebWorkerStubBase { const WorkerAppCacheInitInfo& appcache_init_info); // IPC::Channel::Listener implementation. - virtual void OnMessageReceived(const IPC::Message& message); + virtual bool OnMessageReceived(const IPC::Message& message); virtual void OnChannelError(); virtual const GURL& url() const; diff --git a/chrome/worker/worker_thread.cc b/chrome/worker/worker_thread.cc index cafd482..f7a1e4a 100644 --- a/chrome/worker/worker_thread.cc +++ b/chrome/worker/worker_thread.cc @@ -77,14 +77,17 @@ WorkerThread* WorkerThread::current() { return lazy_tls.Pointer()->Get(); } -void WorkerThread::OnControlMessageReceived(const IPC::Message& msg) { +bool WorkerThread::OnControlMessageReceived(const IPC::Message& msg) { // Appcache messages are handled by a delegate. if (appcache_dispatcher_->OnMessageReceived(msg)) - return; + return true; + bool handled = true; IPC_BEGIN_MESSAGE_MAP(WorkerThread, msg) IPC_MESSAGE_HANDLER(WorkerProcessMsg_CreateWorker, OnCreateWorker) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + return handled; } void WorkerThread::OnCreateWorker( diff --git a/chrome/worker/worker_thread.h b/chrome/worker/worker_thread.h index da154b4..1bde9b5 100644 --- a/chrome/worker/worker_thread.h +++ b/chrome/worker/worker_thread.h @@ -35,7 +35,7 @@ class WorkerThread : public ChildThread { } private: - virtual void OnControlMessageReceived(const IPC::Message& msg); + virtual bool OnControlMessageReceived(const IPC::Message& msg); virtual void OnChannelError(); void OnCreateWorker(const WorkerProcessMsg_CreateWorker_Params& params); diff --git a/chrome_frame/cfproxy.h b/chrome_frame/cfproxy.h index ae404b2..b32bf78 100644 --- a/chrome_frame/cfproxy.h +++ b/chrome_frame/cfproxy.h @@ -148,9 +148,6 @@ class ChromeProxyDelegate : public IPC::Channel::Listener { CHANNEL_ERROR }; - // IPC::Channel::Listener. - void OnMessageReceived(const IPC::Message& message) = 0; - virtual void Connected(ChromeProxy* proxy) = 0; virtual void Disconnected() = 0; virtual void PeerLost(ChromeProxy* proxy, DisconnectReason reason) = 0; diff --git a/chrome_frame/cfproxy_private.h b/chrome_frame/cfproxy_private.h index 6ec0080..165e231 100644 --- a/chrome_frame/cfproxy_private.h +++ b/chrome_frame/cfproxy_private.h @@ -163,7 +163,7 @@ class CFProxy : public Interface2IPCMessage, ////////////////////////////////////////////////////////////////////////// // IPC::Channel::Listener - virtual void OnMessageReceived(const IPC::Message& message); + virtual bool OnMessageReceived(const IPC::Message& message); virtual void OnChannelConnected(int32 peer_pid); virtual void OnChannelError(); diff --git a/chrome_frame/cfproxy_proxy.cc b/chrome_frame/cfproxy_proxy.cc index 0f59d8a..46ac821 100644 --- a/chrome_frame/cfproxy_proxy.cc +++ b/chrome_frame/cfproxy_proxy.cc @@ -208,11 +208,11 @@ void CFProxy::Tab_RunUnloadHandlers(int tab) { } // IPC::Channel::Listener -void CFProxy::OnMessageReceived(const IPC::Message& message) { +bool CFProxy::OnMessageReceived(const IPC::Message& message) { // Handle sync message reply. bool done = sync_dispatcher_.OnReplyReceived(&message); if (done) - return; + return true; // Handle tab related message. ChromeProxyDelegate* d = Tab2Delegate(message.routing_id()); @@ -220,6 +220,7 @@ void CFProxy::OnMessageReceived(const IPC::Message& message) { return d->OnMessageReceived(message); DLOG(WARNING) << "Unknown message received!"; + return false; } void CFProxy::OnChannelConnected(int32 peer_pid) { diff --git a/chrome_frame/cfproxy_test.cc b/chrome_frame/cfproxy_test.cc index d6be8b1..46e716d 100644 --- a/chrome_frame/cfproxy_test.cc +++ b/chrome_frame/cfproxy_test.cc @@ -1,3 +1,4 @@ + // Copyright (c) 2010 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. @@ -28,7 +29,7 @@ struct MockFactory : public ChromeProxyFactory { }; struct MockChromeProxyDelegate : public ChromeProxyDelegate { - MOCK_METHOD1(OnMessageReceived, void(const IPC::Message& message)); + MOCK_METHOD1(OnMessageReceived, bool(const IPC::Message& message)); MOCK_METHOD1(Connected, void(ChromeProxy* proxy)); MOCK_METHOD2(PeerLost, void(ChromeProxy*, enum DisconnectReason reason)); MOCK_METHOD0(Disconnected, void()); diff --git a/chrome_frame/chrome_frame_delegate.cc b/chrome_frame/chrome_frame_delegate.cc index cd54c5f..a2e84b6 100644 --- a/chrome_frame/chrome_frame_delegate.cc +++ b/chrome_frame/chrome_frame_delegate.cc @@ -33,13 +33,14 @@ bool ChromeFrameDelegateImpl::IsTabMessage(const IPC::Message& message) { return is_tab_message; } -void ChromeFrameDelegateImpl::OnMessageReceived(const IPC::Message& msg) { +bool ChromeFrameDelegateImpl::OnMessageReceived(const IPC::Message& msg) { if (!IsValid()) { DLOG(WARNING) << __FUNCTION__ << " Msgs received for a NULL automation client instance"; - return; + return false; } + bool handled = true; IPC_BEGIN_MESSAGE_MAP(ChromeFrameDelegateImpl, msg) IPC_MESSAGE_HANDLER(AutomationMsg_NavigationStateChanged, OnNavigationStateChanged) @@ -66,5 +67,8 @@ void ChromeFrameDelegateImpl::OnMessageReceived(const IPC::Message& msg) { OnGoToHistoryEntryOffset) IPC_MESSAGE_HANDLER(AutomationMsg_GetCookiesFromHost, OnGetCookiesFromHost) IPC_MESSAGE_HANDLER(AutomationMsg_CloseExternalTab, OnCloseTab) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + + return handled; } diff --git a/chrome_frame/chrome_frame_delegate.h b/chrome_frame/chrome_frame_delegate.h index 647f0d0..1a0f34b 100644 --- a/chrome_frame/chrome_frame_delegate.h +++ b/chrome_frame/chrome_frame_delegate.h @@ -35,7 +35,7 @@ class ChromeFrameDelegate { virtual void OnGetEnabledExtensionsComplete( void* user_data, const std::vector<FilePath>& extension_directories) = 0; - virtual void OnMessageReceived(const IPC::Message& msg) = 0; + virtual bool OnMessageReceived(const IPC::Message& msg) = 0; virtual void OnChannelError() = 0; // This remains in interface since we call it if Navigate() @@ -76,7 +76,7 @@ class ChromeFrameDelegateImpl : public ChromeFrameDelegate { void* user_data, const std::vector<FilePath>& extension_directories) {} virtual void OnLoadFailed(int error_code, const std::string& url) {} - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); virtual void OnChannelError() {} static bool IsTabMessage(const IPC::Message& message); diff --git a/chrome_frame/external_tab.cc b/chrome_frame/external_tab.cc index 99477ef..9be4935 100644 --- a/chrome_frame/external_tab.cc +++ b/chrome_frame/external_tab.cc @@ -34,7 +34,8 @@ ExternalTabProxy::~ExternalTabProxy() { Destroy(); } -void ExternalTabProxy::OnMessageReceived(const IPC::Message& message) { +bool ExternalTabProxy::OnMessageReceived(const IPC::Message& message) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(ExternalTabProxy, message) IPC_MESSAGE_HANDLER(AutomationMsg_NavigationStateChanged, OnNavigationStateChanged) @@ -60,7 +61,9 @@ void ExternalTabProxy::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER(AutomationMsg_RequestGoToHistoryEntryOffset, OnGoToHistoryOffset) IPC_MESSAGE_HANDLER(AutomationMsg_CloseExternalTab, OnTabClosed) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + return handled; } void ExternalTabProxy::Init() { diff --git a/chrome_frame/external_tab.h b/chrome_frame/external_tab.h index c3dcbab..4fbb5d3 100644 --- a/chrome_frame/external_tab.h +++ b/chrome_frame/external_tab.h @@ -94,7 +94,7 @@ class ExternalTabProxy : public CWindowImpl<ExternalTabProxy>, #endif // IPC::Channel::Listener implementation. - void OnMessageReceived(const IPC::Message& message); + bool OnMessageReceived(const IPC::Message& message); // virtual void CreateTab(const CreateTabParams& create_params, diff --git a/chrome_frame/test/net/test_automation_provider.cc b/chrome_frame/test/net/test_automation_provider.cc index 4b4d2a1..c015d2b 100644 --- a/chrome_frame/test/net/test_automation_provider.cc +++ b/chrome_frame/test/net/test_automation_provider.cc @@ -48,11 +48,11 @@ TestAutomationProvider::~TestAutomationProvider() { g_provider_instance_ = NULL; } -void TestAutomationProvider::OnMessageReceived(const IPC::Message& msg) { +bool TestAutomationProvider::OnMessageReceived(const IPC::Message& msg) { if (automation_resource_message_filter_->OnMessageReceived(msg)) - return; // Message handled by the filter. + return true; // Message handled by the filter. - __super::OnMessageReceived(msg); + return __super::OnMessageReceived(msg); } // IPC override to grab the tab handle. diff --git a/chrome_frame/test/net/test_automation_provider.h b/chrome_frame/test/net/test_automation_provider.h index bc98b3a..209a069 100644 --- a/chrome_frame/test/net/test_automation_provider.h +++ b/chrome_frame/test/net/test_automation_provider.h @@ -36,7 +36,7 @@ class TestAutomationProvider virtual ~TestAutomationProvider(); // AutomationProvider overrides. - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); virtual bool Send(IPC::Message* msg); // Protocol factory for handling http/https requests over automation. diff --git a/ipc/ipc_channel.h b/ipc/ipc_channel.h index c257a8e..3b8afd8 100644 --- a/ipc/ipc_channel.h +++ b/ipc/ipc_channel.h @@ -39,8 +39,9 @@ class Channel : public Message::Sender { public: virtual ~Listener() {} - // Called when a message is received. - virtual void OnMessageReceived(const Message& message) = 0; + // Called when a message is received. Returns true iff the message was + // handled. + virtual bool OnMessageReceived(const Message& message) = 0; // Called when the channel is connected and we have received the internal // Hello message from the peer. diff --git a/ipc/ipc_channel_posix_unittest.cc b/ipc/ipc_channel_posix_unittest.cc index 09c635f..459aafb 100644 --- a/ipc/ipc_channel_posix_unittest.cc +++ b/ipc/ipc_channel_posix_unittest.cc @@ -43,10 +43,11 @@ class IPCChannelPosixTestListener : public IPC::Channel::Listener { virtual ~IPCChannelPosixTestListener() {} - virtual void OnMessageReceived(const IPC::Message& message) { + virtual bool OnMessageReceived(const IPC::Message& message) { EXPECT_EQ(message.type(), QUIT_MESSAGE); status_ = MESSAGE_RECEIVED; QuitRunLoop(); + return true; } virtual void OnChannelConnected(int32 peer_pid) { diff --git a/ipc/ipc_channel_proxy.cc b/ipc/ipc_channel_proxy.cc index aba6bf5e..b9533e6 100644 --- a/ipc/ipc_channel_proxy.cc +++ b/ipc/ipc_channel_proxy.cc @@ -96,20 +96,22 @@ bool ChannelProxy::Context::TryFilters(const Message& message) { } // Called on the IPC::Channel thread -void ChannelProxy::Context::OnMessageReceived(const Message& message) { +bool ChannelProxy::Context::OnMessageReceived(const Message& message) { // First give a chance to the filters to process this message. if (!TryFilters(message)) OnMessageReceivedNoFilter(message); + return true; } // Called on the IPC::Channel thread -void ChannelProxy::Context::OnMessageReceivedNoFilter(const Message& message) { +bool ChannelProxy::Context::OnMessageReceivedNoFilter(const Message& message) { // NOTE: This code relies on the listener's message loop not going away while // this thread is active. That should be a reasonable assumption, but it // feels risky. We may want to invent some more indirect way of referring to // a MessageLoop if this becomes a problem. listener_message_loop_->PostTask(FROM_HERE, NewRunnableMethod( this, &Context::OnDispatchMessage, message)); + return true; } // Called on the IPC::Channel thread diff --git a/ipc/ipc_channel_proxy.h b/ipc/ipc_channel_proxy.h index a256ab6..82a243b 100644 --- a/ipc/ipc_channel_proxy.h +++ b/ipc/ipc_channel_proxy.h @@ -176,12 +176,12 @@ class ChannelProxy : public Message::Sender { virtual ~Context() { } // IPC::Channel::Listener methods: - virtual void OnMessageReceived(const Message& message); + virtual bool OnMessageReceived(const Message& message); virtual void OnChannelConnected(int32 peer_pid); virtual void OnChannelError(); // Like OnMessageReceived but doesn't try the filters. - void OnMessageReceivedNoFilter(const Message& message); + bool OnMessageReceivedNoFilter(const Message& message); // Gives the filters a chance at processing |message|. // Returns true if the message was processed, false otherwise. diff --git a/ipc/ipc_fuzzing_tests.cc b/ipc/ipc_fuzzing_tests.cc index 4b5e938..5dd916f 100644 --- a/ipc/ipc_fuzzing_tests.cc +++ b/ipc/ipc_fuzzing_tests.cc @@ -158,7 +158,7 @@ class FuzzerServerListener : public SimpleListener { public: FuzzerServerListener() : message_count_(2), pending_messages_(0) { } - virtual void OnMessageReceived(const IPC::Message& msg) { + virtual bool OnMessageReceived(const IPC::Message& msg) { if (msg.routing_id() == MSG_ROUTING_CONTROL) { ++pending_messages_; IPC_BEGIN_MESSAGE_MAP(FuzzerServerListener, msg) @@ -170,6 +170,7 @@ class FuzzerServerListener : public SimpleListener { ReplyMsgNotHandled(msg.type()); } } + return true; } private: @@ -221,9 +222,10 @@ class FuzzerClientListener : public SimpleListener { FuzzerClientListener() : last_msg_(NULL) { } - virtual void OnMessageReceived(const IPC::Message& msg) { + virtual bool OnMessageReceived(const IPC::Message& msg) { last_msg_ = new IPC::Message(msg); MessageLoop::current()->Quit(); + return true; } bool ExpectMessage(int value, uint32 type_id) { diff --git a/ipc/ipc_message_macros.h b/ipc/ipc_message_macros.h index 504be00..af2901a 100644 --- a/ipc/ipc_message_macros.h +++ b/ipc/ipc_message_macros.h @@ -1163,23 +1163,22 @@ LogFunctionMap g_log_function_mapping; // Prefer to use the IPC_BEGIN_MESSAGE_MAP_EX to the older macros since they // allow you to detect when a message could not be de-serialized. Usage: // -// void MyClass::OnMessageReceived(const IPC::Message& msg) { +// bool MyClass::OnMessageReceived(const IPC::Message& msg) { +// bool handled = true; // bool msg_is_good = false; // IPC_BEGIN_MESSAGE_MAP_EX(MyClass, msg, msg_is_good) // IPC_MESSAGE_HANDLER(MsgClassOne, OnMsgClassOne) // ...more handlers here ... // IPC_MESSAGE_HANDLER(MsgClassTen, OnMsgClassTen) +// IPC_MESSAGE_UNHANDLED(handled = false) // IPC_END_MESSAGE_MAP_EX() // if (!msg_is_good) { // // Signal error here or terminate offending process. // } +// return handled; // } -#define IPC_DEFINE_MESSAGE_MAP(class_name) \ -void class_name::OnMessageReceived(const IPC::Message& msg) \ - IPC_BEGIN_MESSAGE_MAP(class_name, msg) - #define IPC_BEGIN_MESSAGE_MAP_EX(class_name, msg, msg_is_ok) \ { \ typedef class_name _IpcMessageHandlerClass; \ diff --git a/ipc/ipc_send_fds_test.cc b/ipc/ipc_send_fds_test.cc index 809f4f5..3b845f8 100644 --- a/ipc/ipc_send_fds_test.cc +++ b/ipc/ipc_send_fds_test.cc @@ -51,20 +51,20 @@ class MyChannelDescriptorListener : public IPC::Channel::Listener { : expected_inode_num_(expected_inode_num), num_fds_received_(0) {} - virtual void OnMessageReceived(const IPC::Message& message) { + virtual bool OnMessageReceived(const IPC::Message& message) { void* iter = NULL; ++num_fds_received_; base::FileDescriptor descriptor; - ASSERT_TRUE( - IPC::ParamTraits<base::FileDescriptor>::Read( - &message, &iter, &descriptor)); + IPC::ParamTraits<base::FileDescriptor>::Read( + &message, &iter, &descriptor); VerifyAndCloseDescriptor(descriptor.fd, expected_inode_num_); if (num_fds_received_ == kNumFDsToSend) { MessageLoop::current()->Quit(); } + return true; } virtual void OnChannelError() { diff --git a/ipc/ipc_sync_channel.cc b/ipc/ipc_sync_channel.cc index 7425a9b..79b1e60 100644 --- a/ipc/ipc_sync_channel.cc +++ b/ipc/ipc_sync_channel.cc @@ -285,22 +285,22 @@ void SyncChannel::SyncContext::Clear() { Context::Clear(); } -void SyncChannel::SyncContext::OnMessageReceived(const Message& msg) { +bool SyncChannel::SyncContext::OnMessageReceived(const Message& msg) { // Give the filters a chance at processing this message. if (TryFilters(msg)) - return; + return true; if (TryToUnblockListener(&msg)) - return; + return true; if (msg.should_unblock()) { received_sync_msgs_->QueueMessage(msg, this); - return; + return true; } if (msg.is_reply()) { received_sync_msgs_->QueueReply(msg, this); - return; + return true; } return Context::OnMessageReceivedNoFilter(msg); diff --git a/ipc/ipc_sync_channel.h b/ipc/ipc_sync_channel.h index fce2e38..d1cef93 100644 --- a/ipc/ipc_sync_channel.h +++ b/ipc/ipc_sync_channel.h @@ -106,7 +106,7 @@ class SyncChannel : public ChannelProxy, virtual void Clear(); // Called on the IPC thread. - virtual void OnMessageReceived(const Message& msg); + virtual bool OnMessageReceived(const Message& msg); virtual void OnChannelError(); virtual void OnChannelOpened(); virtual void OnChannelClosed(); diff --git a/ipc/ipc_sync_channel_unittest.cc b/ipc/ipc_sync_channel_unittest.cc index 772df0b..e580ba4 100644 --- a/ipc/ipc_sync_channel_unittest.cc +++ b/ipc/ipc_sync_channel_unittest.cc @@ -195,7 +195,7 @@ class Worker : public Channel::Listener, public Message::Sender { listener_event->Signal(); } - void OnMessageReceived(const Message& message) { + bool OnMessageReceived(const Message& message) { IPC_BEGIN_MESSAGE_MAP(Worker, message) IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncChannelTestMsg_Double, OnDoubleDelay) IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncChannelTestMsg_AnswerToLife, @@ -203,6 +203,7 @@ class Worker : public Channel::Listener, public Message::Sender { IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncChannelNestedTestMsg_String, OnNestedTestMsg) IPC_END_MESSAGE_MAP() + return true; } void StartThread(base::Thread* thread, MessageLoop::Type type) { diff --git a/ipc/ipc_sync_message_unittest.cc b/ipc/ipc_sync_message_unittest.cc index e64e0c3..9a72aa3 100644 --- a/ipc/ipc_sync_message_unittest.cc +++ b/ipc/ipc_sync_message_unittest.cc @@ -108,7 +108,7 @@ class TestMessageReceiver { return true; } - void OnMessageReceived(const IPC::Message& msg) { + bool OnMessageReceived(const IPC::Message& msg) { IPC_BEGIN_MESSAGE_MAP(TestMessageReceiver, msg) IPC_MESSAGE_HANDLER(Msg_C_0_1, On_0_1) IPC_MESSAGE_HANDLER(Msg_C_0_2, On_0_2) @@ -137,6 +137,7 @@ class TestMessageReceiver { IPC_MESSAGE_HANDLER(Msg_R_3_3, On_3_3) IPC_MESSAGE_HANDLER(Msg_R_3_4, On_3_4) IPC_END_MESSAGE_MAP() + return true; } }; diff --git a/ipc/ipc_tests.cc b/ipc/ipc_tests.cc index aee01f5..925aeab 100644 --- a/ipc/ipc_tests.cc +++ b/ipc/ipc_tests.cc @@ -182,7 +182,7 @@ static void Send(IPC::Message::Sender* sender, const char* text) { class MyChannelListener : public IPC::Channel::Listener { public: - virtual void OnMessageReceived(const IPC::Message& message) { + virtual bool OnMessageReceived(const IPC::Message& message) { IPC::MessageIterator iter(message); iter.NextInt(); @@ -196,6 +196,7 @@ class MyChannelListener : public IPC::Channel::Listener { } else { Send(sender_, "Foo"); } + return true; } virtual void OnChannelError() { @@ -291,7 +292,7 @@ class ChannelListenerWithOnConnectedSend : public IPC::Channel::Listener { SendNextMessage(); } - virtual void OnMessageReceived(const IPC::Message& message) { + virtual bool OnMessageReceived(const IPC::Message& message) { IPC::MessageIterator iter(message); iter.NextInt(); @@ -299,6 +300,7 @@ class ChannelListenerWithOnConnectedSend : public IPC::Channel::Listener { const std::string big_string = iter.NextString(); EXPECT_EQ(kLongMessageStringNumBytes - 1, big_string.length()); SendNextMessage(); + return true; } virtual void OnChannelError() { @@ -402,7 +404,7 @@ class ChannelReflectorListener : public IPC::Channel::Listener { std::cout << "Client Latency: " << latency_messages_ << std::endl; } - virtual void OnMessageReceived(const IPC::Message& message) { + virtual bool OnMessageReceived(const IPC::Message& message) { count_messages_++; IPC::MessageIterator iter(message); int time = iter.NextInt(); @@ -421,6 +423,7 @@ class ChannelReflectorListener : public IPC::Channel::Listener { msg->WriteInt(msgid); msg->WriteString(payload); channel_->Send(msg); + return true; } private: IPC::Channel *channel_; @@ -446,7 +449,7 @@ class ChannelPerfListener : public IPC::Channel::Listener { std::cout << "Server Latency: " << latency_messages_ << std::endl; } - virtual void OnMessageReceived(const IPC::Message& message) { + virtual bool OnMessageReceived(const IPC::Message& message) { count_messages_++; // decode the string so this gets counted in the total time IPC::MessageIterator iter(message); @@ -467,7 +470,7 @@ class ChannelPerfListener : public IPC::Channel::Listener { msg->WriteString("quit"); channel_->Send(msg); SetTimer(NULL, 1, 250, (TIMERPROC) PostQuitMessage); - return; + return true; } IPC::Message* msg = new IPC::Message(0, @@ -477,6 +480,7 @@ class ChannelPerfListener : public IPC::Channel::Listener { msg->WriteInt(count_down_); msg->WriteString(payload_); channel_->Send(msg); + return true; } private: diff --git a/ipc/sync_socket_unittest.cc b/ipc/sync_socket_unittest.cc index 451f307..3598cf3 100644 --- a/ipc/sync_socket_unittest.cc +++ b/ipc/sync_socket_unittest.cc @@ -107,13 +107,14 @@ class SyncSocketServerListener : public IPC::Channel::Listener { chan_ = chan; } - virtual void OnMessageReceived(const IPC::Message& msg) { + virtual bool OnMessageReceived(const IPC::Message& msg) { if (msg.routing_id() == MSG_ROUTING_CONTROL) { IPC_BEGIN_MESSAGE_MAP(SyncSocketServerListener, msg) IPC_MESSAGE_HANDLER(MsgClassSetHandle, OnMsgClassSetHandle) IPC_MESSAGE_HANDLER(MsgClassShutdown, OnMsgClassShutdown) IPC_END_MESSAGE_MAP() } + return true; } private: @@ -175,12 +176,13 @@ class SyncSocketClientListener : public IPC::Channel::Listener { chan_ = chan; } - virtual void OnMessageReceived(const IPC::Message& msg) { + virtual bool OnMessageReceived(const IPC::Message& msg) { if (msg.routing_id() == MSG_ROUTING_CONTROL) { IPC_BEGIN_MESSAGE_MAP(SyncSocketClientListener, msg) IPC_MESSAGE_HANDLER(MsgClassResponse, OnMsgClassResponse) IPC_END_MESSAGE_MAP() } + return true; } private: diff --git a/ppapi/proxy/dispatcher.cc b/ppapi/proxy/dispatcher.cc index 9b7958c..e6637db1 100644 --- a/ppapi/proxy/dispatcher.cc +++ b/ppapi/proxy/dispatcher.cc @@ -87,28 +87,32 @@ bool Dispatcher::InitWithChannel(MessageLoop* ipc_message_loop, return true; } -void Dispatcher::OnMessageReceived(const IPC::Message& msg) { +bool Dispatcher::OnMessageReceived(const IPC::Message& msg) { // Control messages. if (msg.routing_id() == MSG_ROUTING_CONTROL) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(Dispatcher, msg) IPC_MESSAGE_HANDLER(PpapiMsg_DeclareInterfaces, OnMsgDeclareInterfaces) IPC_MESSAGE_HANDLER(PpapiMsg_SupportsInterface, OnMsgSupportsInterface) IPC_MESSAGE_FORWARD(PpapiMsg_ExecuteCallback, &callback_tracker_, CallbackTracker::ReceiveExecuteSerializedCallback) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() - return; + return handled; } // Interface-specific messages. if (msg.routing_id() > 0 && msg.routing_id() < INTERFACE_ID_COUNT) { InterfaceProxy* proxy = id_to_proxy_[msg.routing_id()]; if (proxy) - proxy->OnMessageReceived(msg); - else - NOTREACHED(); + return proxy->OnMessageReceived(msg); + + NOTREACHED(); // TODO(brettw): kill the plugin if it starts sending invalid messages? } + + return false; } void Dispatcher::SetSerializationRules( diff --git a/ppapi/proxy/dispatcher.h b/ppapi/proxy/dispatcher.h index 1c76cb8..2aec49c 100644 --- a/ppapi/proxy/dispatcher.h +++ b/ppapi/proxy/dispatcher.h @@ -103,7 +103,7 @@ class Dispatcher : public IPC::Channel::Listener, virtual bool Send(IPC::Message* msg); // IPC::Channel::Listener implementation. - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); IPC::SyncChannel* channel() const { return channel_.get(); diff --git a/ppapi/proxy/interface_proxy.h b/ppapi/proxy/interface_proxy.h index 33e19bb..672e268 100644 --- a/ppapi/proxy/interface_proxy.h +++ b/ppapi/proxy/interface_proxy.h @@ -59,7 +59,7 @@ class InterfaceProxy : public IPC::Channel::Listener, virtual InterfaceID GetInterfaceId() const = 0; // Sub-classes must implement IPC::Channel::Listener which contains this: - //virtual void OnMessageReceived(const IPC::Message& msg); + //virtual bool OnMessageReceived(const IPC::Message& msg); protected: uint32 SendCallback(PP_CompletionCallback callback); diff --git a/ppapi/proxy/plugin_dispatcher.cc b/ppapi/proxy/plugin_dispatcher.cc index a6c97a0..ff7ccb7 100644 --- a/ppapi/proxy/plugin_dispatcher.cc +++ b/ppapi/proxy/plugin_dispatcher.cc @@ -70,21 +70,22 @@ bool PluginDispatcher::IsPlugin() const { return true; } -void PluginDispatcher::OnMessageReceived(const IPC::Message& msg) { +bool PluginDispatcher::OnMessageReceived(const IPC::Message& msg) { if (msg.routing_id() == MSG_ROUTING_CONTROL) { // Handle some plugin-specific control messages. + bool handled = true; IPC_BEGIN_MESSAGE_MAP(PluginDispatcher, msg) IPC_MESSAGE_HANDLER(PpapiMsg_InitializeModule, OnMsgInitializeModule) IPC_MESSAGE_HANDLER(PpapiMsg_Shutdown, OnMsgShutdown) // Forward all other control messages to the superclass. - IPC_MESSAGE_UNHANDLED(Dispatcher::OnMessageReceived(msg)) + IPC_MESSAGE_UNHANDLED(handled = Dispatcher::OnMessageReceived(msg)) IPC_END_MESSAGE_MAP() - return; + return handled; } // All non-control messages get handled by the superclass. - Dispatcher::OnMessageReceived(msg); + return Dispatcher::OnMessageReceived(msg); } void PluginDispatcher::OnMsgInitializeModule(PP_Module pp_module, diff --git a/ppapi/proxy/plugin_dispatcher.h b/ppapi/proxy/plugin_dispatcher.h index 5b8ffb7..924b611 100644 --- a/ppapi/proxy/plugin_dispatcher.h +++ b/ppapi/proxy/plugin_dispatcher.h @@ -46,7 +46,7 @@ class PluginDispatcher : public Dispatcher { virtual bool IsPlugin() const; // IPC::Channel::Listener implementation. - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); // Returns the resource tracker for the plugin. In the browser process this // will return NULL. diff --git a/ppapi/proxy/ppb_audio_config_proxy.cc b/ppapi/proxy/ppb_audio_config_proxy.cc index 7ec3e8f..40abd4f 100644 --- a/ppapi/proxy/ppb_audio_config_proxy.cc +++ b/ppapi/proxy/ppb_audio_config_proxy.cc @@ -107,13 +107,16 @@ InterfaceID PPB_AudioConfig_Proxy::GetInterfaceId() const { return INTERFACE_ID_PPB_AUDIO_CONFIG; } -void PPB_AudioConfig_Proxy::OnMessageReceived(const IPC::Message& msg) { +bool PPB_AudioConfig_Proxy::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(PPB_AudioConfig_Proxy, msg) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBAudioConfig_Create, OnMsgCreateStereo16Bit) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBAudioConfig_RecommendSampleFrameCount, OnMsgRecommendSampleFrameCount) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + return handled; } void PPB_AudioConfig_Proxy::OnMsgCreateStereo16Bit(PP_Module module, diff --git a/ppapi/proxy/ppb_audio_config_proxy.h b/ppapi/proxy/ppb_audio_config_proxy.h index b80ea31..0236216 100644 --- a/ppapi/proxy/ppb_audio_config_proxy.h +++ b/ppapi/proxy/ppb_audio_config_proxy.h @@ -27,7 +27,7 @@ class PPB_AudioConfig_Proxy : public InterfaceProxy { // InterfaceProxy implementation. virtual const void* GetSourceInterface() const; virtual InterfaceID GetInterfaceId() const; - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); private: // Message handlers. diff --git a/ppapi/proxy/ppb_audio_proxy.cc b/ppapi/proxy/ppb_audio_proxy.cc index 84db37a..4468c4e 100644 --- a/ppapi/proxy/ppb_audio_proxy.cc +++ b/ppapi/proxy/ppb_audio_proxy.cc @@ -132,15 +132,17 @@ InterfaceID PPB_Audio_Proxy::GetInterfaceId() const { return INTERFACE_ID_PPB_AUDIO; } -void PPB_Audio_Proxy::OnMessageReceived(const IPC::Message& msg) { +bool PPB_Audio_Proxy::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(PPB_Audio_Proxy, msg) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBAudio_Create, OnMsgCreate) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBAudio_StartOrStop, OnMsgStartOrStop) - IPC_MESSAGE_HANDLER(PpapiMsg_PPBAudio_NotifyAudioStreamCreated, OnMsgNotifyAudioStreamCreated) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + return handled; } void PPB_Audio_Proxy::OnMsgCreate(PP_Instance instance_id, diff --git a/ppapi/proxy/ppb_audio_proxy.h b/ppapi/proxy/ppb_audio_proxy.h index a6d2738..a8dc748 100644 --- a/ppapi/proxy/ppb_audio_proxy.h +++ b/ppapi/proxy/ppb_audio_proxy.h @@ -33,7 +33,7 @@ class PPB_Audio_Proxy : public InterfaceProxy { // InterfaceProxy implementation. virtual const void* GetSourceInterface() const; virtual InterfaceID GetInterfaceId() const; - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); private: // Plugin->renderer message handlers. diff --git a/ppapi/proxy/ppb_buffer_proxy.cc b/ppapi/proxy/ppb_buffer_proxy.cc index 4decffd..0015f5e 100644 --- a/ppapi/proxy/ppb_buffer_proxy.cc +++ b/ppapi/proxy/ppb_buffer_proxy.cc @@ -131,11 +131,14 @@ InterfaceID PPB_Buffer_Proxy::GetInterfaceId() const { return INTERFACE_ID_PPB_BUFFER; } -void PPB_Buffer_Proxy::OnMessageReceived(const IPC::Message& msg) { +bool PPB_Buffer_Proxy::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(PPB_Buffer_Proxy, msg) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBBuffer_Create, OnMsgCreate) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() // TODO(brettw) handle bad messages! + return handled; } void PPB_Buffer_Proxy::OnMsgCreate(PP_Module module, diff --git a/ppapi/proxy/ppb_buffer_proxy.h b/ppapi/proxy/ppb_buffer_proxy.h index d273193..ccd6721 100644 --- a/ppapi/proxy/ppb_buffer_proxy.h +++ b/ppapi/proxy/ppb_buffer_proxy.h @@ -25,7 +25,7 @@ class PPB_Buffer_Proxy : public InterfaceProxy { // InterfaceProxy implementation. virtual const void* GetSourceInterface() const; virtual InterfaceID GetInterfaceId() const; - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); private: // Message handlers. diff --git a/ppapi/proxy/ppb_char_set_proxy.cc b/ppapi/proxy/ppb_char_set_proxy.cc index d5be4c5..ad65084 100644 --- a/ppapi/proxy/ppb_char_set_proxy.cc +++ b/ppapi/proxy/ppb_char_set_proxy.cc @@ -88,7 +88,8 @@ InterfaceID PPB_CharSet_Proxy::GetInterfaceId() const { return INTERFACE_ID_PPB_CHAR_SET; } -void PPB_CharSet_Proxy::OnMessageReceived(const IPC::Message& msg) { +bool PPB_CharSet_Proxy::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(PPB_CharSet_Proxy, msg) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCharSet_UTF16ToCharSet, OnMsgUTF16ToCharSet) @@ -96,7 +97,9 @@ void PPB_CharSet_Proxy::OnMessageReceived(const IPC::Message& msg) { OnMsgCharSetToUTF16) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCharSet_GetDefaultCharSet, OnMsgGetDefaultCharSet) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + return handled; } void PPB_CharSet_Proxy::OnMsgUTF16ToCharSet(const string16& utf16, diff --git a/ppapi/proxy/ppb_char_set_proxy.h b/ppapi/proxy/ppb_char_set_proxy.h index 17dddd5..d944373 100644 --- a/ppapi/proxy/ppb_char_set_proxy.h +++ b/ppapi/proxy/ppb_char_set_proxy.h @@ -30,7 +30,7 @@ class PPB_CharSet_Proxy : public InterfaceProxy { // InterfaceProxy implementation. virtual const void* GetSourceInterface() const; virtual InterfaceID GetInterfaceId() const; - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); private: // Message handlers. diff --git a/ppapi/proxy/ppb_core_proxy.cc b/ppapi/proxy/ppb_core_proxy.cc index 51d24d7..32cad67 100644 --- a/ppapi/proxy/ppb_core_proxy.cc +++ b/ppapi/proxy/ppb_core_proxy.cc @@ -96,14 +96,17 @@ InterfaceID PPB_Core_Proxy::GetInterfaceId() const { return INTERFACE_ID_PPB_CORE; } -void PPB_Core_Proxy::OnMessageReceived(const IPC::Message& msg) { +bool PPB_Core_Proxy::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(PPB_Core_Proxy, msg) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCore_AddRefResource, OnMsgAddRefResource) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCore_ReleaseResource, OnMsgReleaseResource) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() // TODO(brettw) handle bad messages! + return handled; } void PPB_Core_Proxy::OnMsgAddRefResource(PP_Resource resource) { diff --git a/ppapi/proxy/ppb_core_proxy.h b/ppapi/proxy/ppb_core_proxy.h index 66f17d8a..ece12dc 100644 --- a/ppapi/proxy/ppb_core_proxy.h +++ b/ppapi/proxy/ppb_core_proxy.h @@ -27,7 +27,7 @@ class PPB_Core_Proxy : public InterfaceProxy { // InterfaceProxy implementation. virtual const void* GetSourceInterface() const; virtual InterfaceID GetInterfaceId() const; - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); private: // Message handlers. diff --git a/ppapi/proxy/ppb_cursor_control_proxy.cc b/ppapi/proxy/ppb_cursor_control_proxy.cc index 4c6eaae..f576ae0 100644 --- a/ppapi/proxy/ppb_cursor_control_proxy.cc +++ b/ppapi/proxy/ppb_cursor_control_proxy.cc @@ -80,7 +80,8 @@ InterfaceID PPB_CursorControl_Proxy::GetInterfaceId() const { return INTERFACE_ID_PPB_CURSORCONTROL; } -void PPB_CursorControl_Proxy::OnMessageReceived(const IPC::Message& msg) { +bool PPB_CursorControl_Proxy::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(PPB_CursorControl_Proxy, msg) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCursorControl_SetCursor, OnMsgSetCursor) @@ -92,8 +93,10 @@ void PPB_CursorControl_Proxy::OnMessageReceived(const IPC::Message& msg) { OnMsgHasCursorLock) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBCursorControl_CanLockCursor, OnMsgCanLockCursor) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() // TODO(brettw): handle bad messages! + return handled; } void PPB_CursorControl_Proxy::OnMsgSetCursor(PP_Instance instance, diff --git a/ppapi/proxy/ppb_cursor_control_proxy.h b/ppapi/proxy/ppb_cursor_control_proxy.h index f540c0a..033e6c1 100644 --- a/ppapi/proxy/ppb_cursor_control_proxy.h +++ b/ppapi/proxy/ppb_cursor_control_proxy.h @@ -29,7 +29,7 @@ class PPB_CursorControl_Proxy : public InterfaceProxy { // InterfaceProxy implementation. virtual const void* GetSourceInterface() const; virtual InterfaceID GetInterfaceId() const; - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); private: // Message handlers. diff --git a/ppapi/proxy/ppb_flash_proxy.cc b/ppapi/proxy/ppb_flash_proxy.cc index 5614e6a..13fe1d0 100644 --- a/ppapi/proxy/ppb_flash_proxy.cc +++ b/ppapi/proxy/ppb_flash_proxy.cc @@ -224,7 +224,8 @@ InterfaceID PPB_Flash_Proxy::GetInterfaceId() const { return INTERFACE_ID_PPB_FLASH; } -void PPB_Flash_Proxy::OnMessageReceived(const IPC::Message& msg) { +bool PPB_Flash_Proxy::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(PPB_Flash_Proxy, msg) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_SetInstanceAlwaysOnTop, OnMsgSetInstanceAlwaysOnTop) @@ -245,8 +246,10 @@ void PPB_Flash_Proxy::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetModuleLocalDirContents, OnMsgGetModuleLocalDirContents) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_NavigateToURL, OnMsgNavigateToURL) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() // TODO(brettw) handle bad messages! + return handled; } void PPB_Flash_Proxy::OnMsgSetInstanceAlwaysOnTop( diff --git a/ppapi/proxy/ppb_flash_proxy.h b/ppapi/proxy/ppb_flash_proxy.h index 8961a47..629761f 100644 --- a/ppapi/proxy/ppb_flash_proxy.h +++ b/ppapi/proxy/ppb_flash_proxy.h @@ -35,7 +35,7 @@ class PPB_Flash_Proxy : public InterfaceProxy { // InterfaceProxy implementation. virtual const void* GetSourceInterface() const; virtual InterfaceID GetInterfaceId() const; - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); private: // Message handlers. diff --git a/ppapi/proxy/ppb_font_proxy.cc b/ppapi/proxy/ppb_font_proxy.cc index 9a4dbf5..1c72622 100644 --- a/ppapi/proxy/ppb_font_proxy.cc +++ b/ppapi/proxy/ppb_font_proxy.cc @@ -187,7 +187,8 @@ InterfaceID PPB_Font_Proxy::GetInterfaceId() const { return INTERFACE_ID_PPB_FONT; } -void PPB_Font_Proxy::OnMessageReceived(const IPC::Message& msg) { +bool PPB_Font_Proxy::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(PPB_Font_Proxy, msg) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFont_Create, OnMsgCreate) @@ -199,7 +200,9 @@ void PPB_Font_Proxy::OnMessageReceived(const IPC::Message& msg) { OnMsgCharacterOffsetForPixel) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFont_PixelOffsetForCharacter, OnMsgPixelOffsetForCharacter) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + return handled; } void PPB_Font_Proxy::OnMsgCreate( diff --git a/ppapi/proxy/ppb_font_proxy.h b/ppapi/proxy/ppb_font_proxy.h index 25e14ed..4e68d70 100644 --- a/ppapi/proxy/ppb_font_proxy.h +++ b/ppapi/proxy/ppb_font_proxy.h @@ -31,7 +31,7 @@ class PPB_Font_Proxy : public InterfaceProxy { // InterfaceProxy implementation. virtual const void* GetSourceInterface() const; virtual InterfaceID GetInterfaceId() const; - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); private: // Message handlers. diff --git a/ppapi/proxy/ppb_fullscreen_proxy.cc b/ppapi/proxy/ppb_fullscreen_proxy.cc index ddf0cdb..ab537ea 100644 --- a/ppapi/proxy/ppb_fullscreen_proxy.cc +++ b/ppapi/proxy/ppb_fullscreen_proxy.cc @@ -50,14 +50,17 @@ InterfaceID PPB_Fullscreen_Proxy::GetInterfaceId() const { return INTERFACE_ID_PPB_FULLSCREEN; } -void PPB_Fullscreen_Proxy::OnMessageReceived(const IPC::Message& msg) { +bool PPB_Fullscreen_Proxy::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(PPB_Fullscreen_Proxy, msg) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFullscreen_IsFullscreen, OnMsgIsFullscreen) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFullscreen_SetFullscreen, OnMsgSetFullscreen) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() // TODO(brettw): handle bad messages! + return handled; } void PPB_Fullscreen_Proxy::OnMsgIsFullscreen(PP_Instance instance, diff --git a/ppapi/proxy/ppb_fullscreen_proxy.h b/ppapi/proxy/ppb_fullscreen_proxy.h index f24eb7e..502d5b1 100644 --- a/ppapi/proxy/ppb_fullscreen_proxy.h +++ b/ppapi/proxy/ppb_fullscreen_proxy.h @@ -27,7 +27,7 @@ class PPB_Fullscreen_Proxy : public InterfaceProxy { // InterfaceProxy implementation. virtual const void* GetSourceInterface() const; virtual InterfaceID GetInterfaceId() const; - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); private: // Message handlers. diff --git a/ppapi/proxy/ppb_graphics_2d_proxy.cc b/ppapi/proxy/ppb_graphics_2d_proxy.cc index 74f8b91..06d5d0a 100644 --- a/ppapi/proxy/ppb_graphics_2d_proxy.cc +++ b/ppapi/proxy/ppb_graphics_2d_proxy.cc @@ -166,7 +166,8 @@ InterfaceID PPB_Graphics2D_Proxy::GetInterfaceId() const { return INTERFACE_ID_PPB_GRAPHICS_2D; } -void PPB_Graphics2D_Proxy::OnMessageReceived(const IPC::Message& msg) { +bool PPB_Graphics2D_Proxy::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(PPB_Graphics2D_Proxy, msg) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics2D_Create, OnMsgCreate) @@ -181,8 +182,10 @@ void PPB_Graphics2D_Proxy::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(PpapiMsg_PPBGraphics2D_FlushACK, OnMsgFlushACK) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() // FIXME(brettw) handle bad messages! + return handled; } void PPB_Graphics2D_Proxy::OnMsgCreate(PP_Module module, diff --git a/ppapi/proxy/ppb_graphics_2d_proxy.h b/ppapi/proxy/ppb_graphics_2d_proxy.h index 66226b9..96d3277 100644 --- a/ppapi/proxy/ppb_graphics_2d_proxy.h +++ b/ppapi/proxy/ppb_graphics_2d_proxy.h @@ -35,7 +35,7 @@ class PPB_Graphics2D_Proxy : public InterfaceProxy { // InterfaceProxy implementation. virtual const void* GetSourceInterface() const; virtual InterfaceID GetInterfaceId() const; - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); private: // Plugin->renderer message handlers. diff --git a/ppapi/proxy/ppb_image_data_proxy.cc b/ppapi/proxy/ppb_image_data_proxy.cc index 4fa4205..14b0479 100644 --- a/ppapi/proxy/ppb_image_data_proxy.cc +++ b/ppapi/proxy/ppb_image_data_proxy.cc @@ -119,15 +119,18 @@ InterfaceID PPB_ImageData_Proxy::GetInterfaceId() const { return INTERFACE_ID_PPB_IMAGE_DATA; } -void PPB_ImageData_Proxy::OnMessageReceived(const IPC::Message& msg) { +bool PPB_ImageData_Proxy::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(PPB_ImageData_Proxy, msg) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBImageData_GetNativeImageDataFormat, OnMsgGetNativeImageDataFormat) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBImageData_IsImageDataFormatSupported, OnMsgIsImageDataFormatSupported) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBImageData_Create, OnMsgCreate) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() // FIXME(brettw) handle bad messages! + return handled; } void PPB_ImageData_Proxy::OnMsgGetNativeImageDataFormat(int32* result) { diff --git a/ppapi/proxy/ppb_image_data_proxy.h b/ppapi/proxy/ppb_image_data_proxy.h index 5ff617c..beec054 100644 --- a/ppapi/proxy/ppb_image_data_proxy.h +++ b/ppapi/proxy/ppb_image_data_proxy.h @@ -32,7 +32,7 @@ class PPB_ImageData_Proxy : public InterfaceProxy { // InterfaceProxy implementation. virtual const void* GetSourceInterface() const; virtual InterfaceID GetInterfaceId() const; - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); private: // Message handlers. diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc index 1703b74..b26a028 100644 --- a/ppapi/proxy/ppb_instance_proxy.cc +++ b/ppapi/proxy/ppb_instance_proxy.cc @@ -84,7 +84,8 @@ InterfaceID PPB_Instance_Proxy::GetInterfaceId() const { return INTERFACE_ID_PPB_INSTANCE; } -void PPB_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) { +bool PPB_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(PPB_Instance_Proxy, msg) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetWindowObject, OnMsgGetWindowObject) @@ -96,7 +97,9 @@ void PPB_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) { OnMsgIsFullFrame) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ExecuteScript, OnMsgExecuteScript) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + return handled; } void PPB_Instance_Proxy::OnMsgGetWindowObject( diff --git a/ppapi/proxy/ppb_instance_proxy.h b/ppapi/proxy/ppb_instance_proxy.h index 578f38b..b01e9b0 100644 --- a/ppapi/proxy/ppb_instance_proxy.h +++ b/ppapi/proxy/ppb_instance_proxy.h @@ -31,7 +31,7 @@ class PPB_Instance_Proxy : public InterfaceProxy { // InterfaceProxy implementation. virtual const void* GetSourceInterface() const; virtual InterfaceID GetInterfaceId() const; - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); private: // Message handlers. diff --git a/ppapi/proxy/ppb_pdf_proxy.cc b/ppapi/proxy/ppb_pdf_proxy.cc index 0ba638e..cbd1f31 100644 --- a/ppapi/proxy/ppb_pdf_proxy.cc +++ b/ppapi/proxy/ppb_pdf_proxy.cc @@ -125,14 +125,17 @@ InterfaceID PPB_PDF_Proxy::GetInterfaceId() const { return INTERFACE_ID_PPB_PDF; } -void PPB_PDF_Proxy::OnMessageReceived(const IPC::Message& msg) { +bool PPB_PDF_Proxy::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(PPB_PDF_Proxy, msg) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBPDF_GetFontFileWithFallback, OnMsgGetFontFileWithFallback) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBPDF_GetFontTableForPrivateFontFile, OnMsgGetFontTableForPrivateFontFile) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() // TODO(brettw): handle bad messages! + return handled; } void PPB_PDF_Proxy::OnMsgGetFontFileWithFallback( diff --git a/ppapi/proxy/ppb_pdf_proxy.h b/ppapi/proxy/ppb_pdf_proxy.h index f229df2..071a493 100644 --- a/ppapi/proxy/ppb_pdf_proxy.h +++ b/ppapi/proxy/ppb_pdf_proxy.h @@ -27,7 +27,7 @@ class PPB_PDF_Proxy : public InterfaceProxy { // InterfaceProxy implementation. virtual const void* GetSourceInterface() const; virtual InterfaceID GetInterfaceId() const; - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); private: // Message handlers. diff --git a/ppapi/proxy/ppb_testing_proxy.cc b/ppapi/proxy/ppb_testing_proxy.cc index d4ab8cc..946cecb 100644 --- a/ppapi/proxy/ppb_testing_proxy.cc +++ b/ppapi/proxy/ppb_testing_proxy.cc @@ -66,7 +66,8 @@ InterfaceID PPB_Testing_Proxy::GetInterfaceId() const { return INTERFACE_ID_PPB_TESTING; } -void PPB_Testing_Proxy::OnMessageReceived(const IPC::Message& msg) { +bool PPB_Testing_Proxy::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(PPB_Testing_Proxy, msg) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_ReadImageData, OnMsgReadImageData) @@ -76,7 +77,9 @@ void PPB_Testing_Proxy::OnMessageReceived(const IPC::Message& msg) { OnMsgQuitMessageLoop) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBTesting_GetLiveObjectCount, OnMsgGetLiveObjectCount) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + return handled; } void PPB_Testing_Proxy::OnMsgReadImageData(PP_Resource device_context_2d, diff --git a/ppapi/proxy/ppb_testing_proxy.h b/ppapi/proxy/ppb_testing_proxy.h index 547f8ab..23314a8 100644 --- a/ppapi/proxy/ppb_testing_proxy.h +++ b/ppapi/proxy/ppb_testing_proxy.h @@ -28,7 +28,7 @@ class PPB_Testing_Proxy : public InterfaceProxy { // InterfaceProxy implementation. virtual const void* GetSourceInterface() const; virtual InterfaceID GetInterfaceId() const; - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); private: // Message handlers. diff --git a/ppapi/proxy/ppb_url_loader_proxy.cc b/ppapi/proxy/ppb_url_loader_proxy.cc index 0d5bbb2..e60afd1 100644 --- a/ppapi/proxy/ppb_url_loader_proxy.cc +++ b/ppapi/proxy/ppb_url_loader_proxy.cc @@ -248,7 +248,8 @@ InterfaceID PPB_URLLoader_Proxy::GetInterfaceId() const { return INTERFACE_ID_PPB_URL_LOADER; } -void PPB_URLLoader_Proxy::OnMessageReceived(const IPC::Message& msg) { +bool PPB_URLLoader_Proxy::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(PPB_URLLoader_Proxy, msg) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLLoader_Create, OnMsgCreate) @@ -269,8 +270,10 @@ void PPB_URLLoader_Proxy::OnMessageReceived(const IPC::Message& msg) { OnMsgUpdateProgress) IPC_MESSAGE_HANDLER(PpapiMsg_PPBURLLoader_ReadResponseBody_Ack, OnMsgReadResponseBodyAck) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() // TODO(brettw) handle bad messages! + return handled; } void PPB_URLLoader_Proxy::OnMsgCreate(PP_Instance instance, @@ -427,12 +430,15 @@ InterfaceID PPB_URLLoaderTrusted_Proxy::GetInterfaceId() const { return INTERFACE_ID_PPB_URL_LOADER_TRUSTED; } -void PPB_URLLoaderTrusted_Proxy::OnMessageReceived(const IPC::Message& msg) { +bool PPB_URLLoaderTrusted_Proxy::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(PPB_URLLoaderTrusted_Proxy, msg) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLLoaderTrusted_GrantUniversalAccess, OnMsgGrantUniversalAccess) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP(); // TODO(brettw) handle bad messages! + return handled; } void PPB_URLLoaderTrusted_Proxy::OnMsgGrantUniversalAccess(PP_Resource loader) { diff --git a/ppapi/proxy/ppb_url_loader_proxy.h b/ppapi/proxy/ppb_url_loader_proxy.h index ca9a83d..3755d46 100644 --- a/ppapi/proxy/ppb_url_loader_proxy.h +++ b/ppapi/proxy/ppb_url_loader_proxy.h @@ -39,7 +39,7 @@ class PPB_URLLoader_Proxy : public InterfaceProxy { // InterfaceProxy implementation. virtual const void* GetSourceInterface() const; virtual InterfaceID GetInterfaceId() const; - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); private: // Data associated with callbacks for ReadResponseBody. @@ -92,7 +92,7 @@ class PPB_URLLoaderTrusted_Proxy : public InterfaceProxy { // InterfaceProxy implementation. virtual const void* GetSourceInterface() const; virtual InterfaceID GetInterfaceId() const; - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); private: // Plugin->renderer message handlers. diff --git a/ppapi/proxy/ppb_url_request_info_proxy.cc b/ppapi/proxy/ppb_url_request_info_proxy.cc index 6a91286..02bd3e6 100644 --- a/ppapi/proxy/ppb_url_request_info_proxy.cc +++ b/ppapi/proxy/ppb_url_request_info_proxy.cc @@ -111,7 +111,8 @@ InterfaceID PPB_URLRequestInfo_Proxy::GetInterfaceId() const { return INTERFACE_ID_PPB_URL_REQUEST_INFO; } -void PPB_URLRequestInfo_Proxy::OnMessageReceived(const IPC::Message& msg) { +bool PPB_URLRequestInfo_Proxy::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(PPB_URLRequestInfo_Proxy, msg) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLRequestInfo_Create, OnMsgCreate) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLRequestInfo_SetProperty, @@ -120,8 +121,10 @@ void PPB_URLRequestInfo_Proxy::OnMessageReceived(const IPC::Message& msg) { OnMsgAppendDataToBody) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLRequestInfo_AppendFileToBody, OnMsgAppendFileToBody) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() // TODO(brettw): handle bad messages. + return handled; } void PPB_URLRequestInfo_Proxy::OnMsgCreate( diff --git a/ppapi/proxy/ppb_url_request_info_proxy.h b/ppapi/proxy/ppb_url_request_info_proxy.h index b620f4a..47e2e27 100644 --- a/ppapi/proxy/ppb_url_request_info_proxy.h +++ b/ppapi/proxy/ppb_url_request_info_proxy.h @@ -30,7 +30,7 @@ class PPB_URLRequestInfo_Proxy : public InterfaceProxy { // InterfaceProxy implementation. virtual const void* GetSourceInterface() const; virtual InterfaceID GetInterfaceId() const; - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); private: // Message handlers. diff --git a/ppapi/proxy/ppb_url_response_info_proxy.cc b/ppapi/proxy/ppb_url_response_info_proxy.cc index c85150e..01e1763 100644 --- a/ppapi/proxy/ppb_url_response_info_proxy.cc +++ b/ppapi/proxy/ppb_url_response_info_proxy.cc @@ -85,14 +85,17 @@ InterfaceID PPB_URLResponseInfo_Proxy::GetInterfaceId() const { return INTERFACE_ID_PPB_URL_RESPONSE_INFO; } -void PPB_URLResponseInfo_Proxy::OnMessageReceived(const IPC::Message& msg) { +bool PPB_URLResponseInfo_Proxy::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(PPB_URLResponseInfo_Proxy, msg) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLResponseInfo_GetProperty, OnMsgGetProperty) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLResponseInfo_GetBodyAsFileRef, OnMsgGetBodyAsFileRef) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() // TODO(brettw): handle bad messages. + return handled; } void PPB_URLResponseInfo_Proxy::OnMsgGetProperty( diff --git a/ppapi/proxy/ppb_url_response_info_proxy.h b/ppapi/proxy/ppb_url_response_info_proxy.h index 423ca3e..c1de259 100644 --- a/ppapi/proxy/ppb_url_response_info_proxy.h +++ b/ppapi/proxy/ppb_url_response_info_proxy.h @@ -35,7 +35,7 @@ class PPB_URLResponseInfo_Proxy : public InterfaceProxy { // InterfaceProxy implementation. virtual const void* GetSourceInterface() const; virtual InterfaceID GetInterfaceId() const; - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); private: // Message handlers. diff --git a/ppapi/proxy/ppb_var_deprecated_proxy.cc b/ppapi/proxy/ppb_var_deprecated_proxy.cc index 42abbc7..f37b0e3 100644 --- a/ppapi/proxy/ppb_var_deprecated_proxy.cc +++ b/ppapi/proxy/ppb_var_deprecated_proxy.cc @@ -247,7 +247,8 @@ InterfaceID PPB_Var_Deprecated_Proxy::GetInterfaceId() const { return INTERFACE_ID_PPB_VAR_DEPRECATED; } -void PPB_Var_Deprecated_Proxy::OnMessageReceived(const IPC::Message& msg) { +bool PPB_Var_Deprecated_Proxy::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(PPB_Var_Deprecated_Proxy, msg) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVar_HasProperty, OnMsgHasProperty) @@ -269,8 +270,10 @@ void PPB_Var_Deprecated_Proxy::OnMessageReceived(const IPC::Message& msg) { OnMsgIsInstanceOfDeprecated) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBVar_CreateObjectDeprecated, OnMsgCreateObjectDeprecated) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() // TODO(brettw) handle bad messages! + return handled; } void PPB_Var_Deprecated_Proxy::OnMsgHasProperty( diff --git a/ppapi/proxy/ppb_var_deprecated_proxy.h b/ppapi/proxy/ppb_var_deprecated_proxy.h index 4148447..c712460 100644 --- a/ppapi/proxy/ppb_var_deprecated_proxy.h +++ b/ppapi/proxy/ppb_var_deprecated_proxy.h @@ -37,7 +37,7 @@ class PPB_Var_Deprecated_Proxy : public InterfaceProxy { // InterfaceProxy implementation. virtual const void* GetSourceInterface() const; virtual InterfaceID GetInterfaceId() const; - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); private: // Message handlers. diff --git a/ppapi/proxy/ppp_class_proxy.cc b/ppapi/proxy/ppp_class_proxy.cc index b2fad17..ab71565 100644 --- a/ppapi/proxy/ppp_class_proxy.cc +++ b/ppapi/proxy/ppp_class_proxy.cc @@ -200,7 +200,8 @@ InterfaceID PPP_Class_Proxy::GetInterfaceId() const { return INTERFACE_ID_PPP_CLASS; } -void PPP_Class_Proxy::OnMessageReceived(const IPC::Message& msg) { +bool PPP_Class_Proxy::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(PPP_Class_Proxy, msg) IPC_MESSAGE_HANDLER(PpapiMsg_PPPClass_HasProperty, OnMsgHasProperty) @@ -218,7 +219,9 @@ void PPP_Class_Proxy::OnMessageReceived(const IPC::Message& msg) { OnMsgConstruct) IPC_MESSAGE_HANDLER(PpapiMsg_PPPClass_Deallocate, OnMsgDeallocate) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + return handled; } void PPP_Class_Proxy::OnMsgHasProperty(int64 ppp_class, int64 object, diff --git a/ppapi/proxy/ppp_class_proxy.h b/ppapi/proxy/ppp_class_proxy.h index b22d86a..d4e2102 100644 --- a/ppapi/proxy/ppp_class_proxy.h +++ b/ppapi/proxy/ppp_class_proxy.h @@ -42,7 +42,7 @@ class PPP_Class_Proxy : public InterfaceProxy { // InterfaceProxy implementation. virtual const void* GetSourceInterface() const; virtual InterfaceID GetInterfaceId() const; - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); private: // IPC message handlers. diff --git a/ppapi/proxy/ppp_instance_proxy.cc b/ppapi/proxy/ppp_instance_proxy.cc index 8551d2b..886b7f1 100644 --- a/ppapi/proxy/ppp_instance_proxy.cc +++ b/ppapi/proxy/ppp_instance_proxy.cc @@ -109,7 +109,8 @@ InterfaceID PPP_Instance_Proxy::GetInterfaceId() const { return INTERFACE_ID_PPP_INSTANCE; } -void PPP_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) { +bool PPP_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; IPC_BEGIN_MESSAGE_MAP(PPP_Instance_Proxy, msg) IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstance_DidCreate, OnMsgDidCreate) @@ -125,7 +126,9 @@ void PPP_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) { OnMsgHandleDocumentLoad) IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstance_GetInstanceObject, OnMsgGetInstanceObject) + IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() + return handled; } void PPP_Instance_Proxy::OnMsgDidCreate( diff --git a/ppapi/proxy/ppp_instance_proxy.h b/ppapi/proxy/ppp_instance_proxy.h index 9df247b..5d02fc8 100644 --- a/ppapi/proxy/ppp_instance_proxy.h +++ b/ppapi/proxy/ppp_instance_proxy.h @@ -34,7 +34,7 @@ class PPP_Instance_Proxy : public InterfaceProxy { // InterfaceProxy implementation. virtual const void* GetSourceInterface() const; virtual InterfaceID GetInterfaceId() const; - virtual void OnMessageReceived(const IPC::Message& msg); + virtual bool OnMessageReceived(const IPC::Message& msg); private: // Message handlers. |