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

Side by Side Diff: ppapi/proxy/resource_reply_thread_registrar.cc

Issue 869883003: Never lock the Pepper proxy lock on the IO thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix size_t vs int32_t Created 5 years, 8 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
« no previous file with comments | « ppapi/proxy/resource_reply_thread_registrar.h ('k') | ppapi/proxy/tracked_callback_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ppapi/proxy/resource_reply_thread_registrar.h" 5 #include "ppapi/proxy/resource_reply_thread_registrar.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop/message_loop_proxy.h" 8 #include "base/message_loop/message_loop_proxy.h"
9 #include "ipc/ipc_message.h" 9 #include "ipc/ipc_message.h"
10 #include "ppapi/proxy/resource_message_params.h" 10 #include "ppapi/proxy/resource_message_params.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 map_[resource][sequence_number] = reply_thread; 44 map_[resource][sequence_number] = reply_thread;
45 } 45 }
46 } 46 }
47 47
48 void ResourceReplyThreadRegistrar::Unregister(PP_Resource resource) { 48 void ResourceReplyThreadRegistrar::Unregister(PP_Resource resource) {
49 base::AutoLock auto_lock(lock_); 49 base::AutoLock auto_lock(lock_);
50 map_.erase(resource); 50 map_.erase(resource);
51 } 51 }
52 52
53 void ResourceReplyThreadRegistrar::HandleOnIOThread(uint32 nested_msg_type) {
54 base::AutoLock auto_lock(lock_);
55 io_thread_message_types_.insert(nested_msg_type);
56 }
57
58 scoped_refptr<base::MessageLoopProxy> 53 scoped_refptr<base::MessageLoopProxy>
59 ResourceReplyThreadRegistrar::GetTargetThread( 54 ResourceReplyThreadRegistrar::GetTargetThread(
60 const ResourceMessageReplyParams& reply_params, 55 const ResourceMessageReplyParams& reply_params,
61 const IPC::Message& nested_msg) { 56 const IPC::Message& nested_msg) {
62 base::AutoLock auto_lock(lock_); 57 base::AutoLock auto_lock(lock_);
63 ResourceMap::iterator resource_iter = map_.find(reply_params.pp_resource()); 58 ResourceMap::iterator resource_iter = map_.find(reply_params.pp_resource());
64 if (resource_iter != map_.end()) { 59 if (resource_iter != map_.end()) {
65 SequenceThreadMap::iterator sequence_thread_iter = 60 SequenceThreadMap::iterator sequence_thread_iter =
66 resource_iter->second.find(reply_params.sequence()); 61 resource_iter->second.find(reply_params.sequence());
67 if (sequence_thread_iter != resource_iter->second.end()) { 62 if (sequence_thread_iter != resource_iter->second.end()) {
68 scoped_refptr<base::MessageLoopProxy> target = 63 scoped_refptr<base::MessageLoopProxy> target =
69 sequence_thread_iter->second; 64 sequence_thread_iter->second;
70 resource_iter->second.erase(sequence_thread_iter); 65 resource_iter->second.erase(sequence_thread_iter);
71 return target; 66 return target;
72 } 67 }
73 } 68 }
74 69
75 if (io_thread_message_types_.count(nested_msg.type()) != 0)
76 return scoped_refptr<base::MessageLoopProxy>();
77
78 return main_thread_; 70 return main_thread_;
79 } 71 }
80 72
81 } // namespace proxy 73 } // namespace proxy
82 } // namespace ppapi 74 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/resource_reply_thread_registrar.h ('k') | ppapi/proxy/tracked_callback_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698