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

Side by Side Diff: content/browser/browser_message_filter.cc

Issue 9111032: Change over IgnoreReturn to IgnoreResult. remove IgnoreReturn. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix it for realz Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/browser_message_filter.h" 5 #include "content/browser/browser_message_filter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/process.h" 10 #include "base/process.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // but it seems better to not allow sending synchronous messages from the 45 // but it seems better to not allow sending synchronous messages from the
46 // browser, since it might allow a corrupt/malicious renderer to hang us. 46 // browser, since it might allow a corrupt/malicious renderer to hang us.
47 NOTREACHED() << "Can't send sync message through BrowserMessageFilter!"; 47 NOTREACHED() << "Can't send sync message through BrowserMessageFilter!";
48 return false; 48 return false;
49 } 49 }
50 50
51 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { 51 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
52 BrowserThread::PostTask( 52 BrowserThread::PostTask(
53 BrowserThread::IO, 53 BrowserThread::IO,
54 FROM_HERE, 54 FROM_HERE,
55 base::IgnoreReturn<bool>( 55 base::Bind(base::IgnoreResult(&BrowserMessageFilter::Send), this,
56 base::Bind(&BrowserMessageFilter::Send, this, message))); 56 message));
57 return true; 57 return true;
58 } 58 }
59 59
60 if (channel_) 60 if (channel_)
61 return channel_->Send(message); 61 return channel_->Send(message);
62 62
63 delete message; 63 delete message;
64 return false; 64 return false;
65 } 65 }
66 66
67 void BrowserMessageFilter::OverrideThreadForMessage(const IPC::Message& message, 67 void BrowserMessageFilter::OverrideThreadForMessage(const IPC::Message& message,
68 BrowserThread::ID* thread) { 68 BrowserThread::ID* thread) {
69 } 69 }
70 70
71 bool BrowserMessageFilter::OnMessageReceived(const IPC::Message& message) { 71 bool BrowserMessageFilter::OnMessageReceived(const IPC::Message& message) {
72 BrowserThread::ID thread = BrowserThread::IO; 72 BrowserThread::ID thread = BrowserThread::IO;
73 OverrideThreadForMessage(message, &thread); 73 OverrideThreadForMessage(message, &thread);
74 if (thread == BrowserThread::IO) 74 if (thread == BrowserThread::IO)
75 return DispatchMessage(message); 75 return DispatchMessage(message);
76 76
77 if (thread == BrowserThread::UI && !CheckCanDispatchOnUI(message, this)) 77 if (thread == BrowserThread::UI && !CheckCanDispatchOnUI(message, this))
78 return true; 78 return true;
79 79
80 BrowserThread::PostTask( 80 BrowserThread::PostTask(
81 thread, FROM_HERE, 81 thread, FROM_HERE,
82 base::IgnoreReturn<bool>( 82 base::Bind(base::IgnoreResult(&BrowserMessageFilter::DispatchMessage),
83 base::Bind(&BrowserMessageFilter::DispatchMessage, this, message))); 83 this, message));
84 return true; 84 return true;
85 } 85 }
86 86
87 bool BrowserMessageFilter::DispatchMessage(const IPC::Message& message) { 87 bool BrowserMessageFilter::DispatchMessage(const IPC::Message& message) {
88 bool message_was_ok = true; 88 bool message_was_ok = true;
89 bool rv = OnMessageReceived(message, &message_was_ok); 89 bool rv = OnMessageReceived(message, &message_was_ok);
90 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO) || rv) << 90 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO) || rv) <<
91 "Must handle messages that were dispatched to another thread!"; 91 "Must handle messages that were dispatched to another thread!";
92 if (!message_was_ok) { 92 if (!message_was_ok) {
93 content::RecordAction(UserMetricsAction("BadMessageTerminate_BMF")); 93 content::RecordAction(UserMetricsAction("BadMessageTerminate_BMF"));
(...skipping 25 matching lines...) Expand all
119 "messages in the renderer or else deadlocks can occur if the page " 119 "messages in the renderer or else deadlocks can occur if the page "
120 "has windowed plugins! (message type " << message.type() << ")"; 120 "has windowed plugins! (message type " << message.type() << ")";
121 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&message); 121 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&message);
122 reply->set_reply_error(); 122 reply->set_reply_error();
123 sender->Send(reply); 123 sender->Send(reply);
124 return false; 124 return false;
125 } 125 }
126 #endif 126 #endif
127 return true; 127 return true;
128 } 128 }
OLDNEW
« no previous file with comments | « chrome_frame/vtable_patch_manager_unittest.cc ('k') | content/browser/renderer_host/pepper_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698