summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiman@google.com <piman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-08 00:36:08 +0000
committerpiman@google.com <piman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-08 00:36:08 +0000
commit4fc7a45da7d64b28e6ddb0e85837021b7855bca6 (patch)
tree658bc104a0df53b471b04772527602e4002d883f
parente93e318996e5fdaed22a3f6d4ae9811814b2eec8 (diff)
downloadchromium_src-4fc7a45da7d64b28e6ddb0e85837021b7855bca6.zip
chromium_src-4fc7a45da7d64b28e6ddb0e85837021b7855bca6.tar.gz
chromium_src-4fc7a45da7d64b28e6ddb0e85837021b7855bca6.tar.bz2
Fix thread-related PepperMessageFilter issues
- Profile::GetRequestContext() needs to be called from the UI thread, i.e. from the PepperMessageFilter constructor. - MessageLoop::current() asserts on the worker thread (because accessing the LazyTls instance is invalid), so we can't actually check that we're on a worker thread. BUG=none TEST=with pepper flash Review URL: http://codereview.chromium.org/6246154 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74066 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/renderer_host/pepper_message_filter.cc9
-rw-r--r--chrome/browser/renderer_host/pepper_message_filter.h2
2 files changed, 5 insertions, 6 deletions
diff --git a/chrome/browser/renderer_host/pepper_message_filter.cc b/chrome/browser/renderer_host/pepper_message_filter.cc
index 5558cb3..edafa05 100644
--- a/chrome/browser/renderer_host/pepper_message_filter.cc
+++ b/chrome/browser/renderer_host/pepper_message_filter.cc
@@ -34,7 +34,8 @@ COMPILE_ASSERT(sizeof(reinterpret_cast<PP_Flash_NetAddress*>(0)->data) >=
const PP_Flash_NetAddress kInvalidNetAddress = { 0 };
PepperMessageFilter::PepperMessageFilter(Profile* profile)
- : profile_(profile) {
+ : profile_(profile),
+ request_context_(profile_->GetRequestContext()) {
}
bool PepperMessageFilter::OnMessageReceived(const IPC::Message& msg,
@@ -170,7 +171,7 @@ void PepperMessageFilter::OnConnectTcp(int routing_id,
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
net::URLRequestContext* req_context =
- profile_->GetRequestContext()->GetURLRequestContext();
+ request_context_->GetURLRequestContext();
net::HostResolver::RequestInfo request_info(net::HostPortPair(host, port));
// The lookup request will delete itself on completion.
@@ -228,8 +229,6 @@ void PepperMessageFilter::ConnectTcpLookupFinished(
void PepperMessageFilter::ConnectTcpOnWorkerThread(int routing_id,
int request_id,
net::AddressList addresses) {
- DCHECK(!MessageLoop::current()); // Check we are on a worker thread.
-
IPC::PlatformFileForTransit socket_for_transit =
IPC::InvalidPlatformFileForTransit();
PP_Flash_NetAddress local_addr = kInvalidNetAddress;
@@ -259,8 +258,6 @@ void PepperMessageFilter::ConnectTcpAddressOnWorkerThread(
int routing_id,
int request_id,
PP_Flash_NetAddress addr) {
- DCHECK(!MessageLoop::current()); // Check we are on a worker thread.
-
IPC::PlatformFileForTransit socket_for_transit =
IPC::InvalidPlatformFileForTransit();
PP_Flash_NetAddress local_addr = kInvalidNetAddress;
diff --git a/chrome/browser/renderer_host/pepper_message_filter.h b/chrome/browser/renderer_host/pepper_message_filter.h
index d907361..0e2284d 100644
--- a/chrome/browser/renderer_host/pepper_message_filter.h
+++ b/chrome/browser/renderer_host/pepper_message_filter.h
@@ -15,6 +15,7 @@
#include "ppapi/c/private/ppb_flash.h"
class Profile;
+class URLRequestContextGetter;
namespace net {
class AddressList;
@@ -62,6 +63,7 @@ class PepperMessageFilter : public BrowserMessageFilter {
#endif // ENABLE_FLAPPER_HACKS
Profile* profile_;
+ scoped_refptr<URLRequestContextGetter> request_context_;
};
#endif // CHROME_BROWSER_RENDERER_HOST_PEPPER_MESSAGE_FILTER_H_