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

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

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_message_filter.h ('k') | ppapi/proxy/resource_reply_thread_registrar.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 #ifndef PPAPI_PROXY_RESOURCE_REPLY_THREAD_REGISTRAR_H_ 5 #ifndef PPAPI_PROXY_RESOURCE_REPLY_THREAD_REGISTRAR_H_
6 #define PPAPI_PROXY_RESOURCE_REPLY_THREAD_REGISTRAR_H_ 6 #define PPAPI_PROXY_RESOURCE_REPLY_THREAD_REGISTRAR_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 10
(...skipping 29 matching lines...) Expand all
40 explicit ResourceReplyThreadRegistrar( 40 explicit ResourceReplyThreadRegistrar(
41 scoped_refptr<base::MessageLoopProxy> main_thread); 41 scoped_refptr<base::MessageLoopProxy> main_thread);
42 42
43 // This method can only be called while holding the Pepper proxy lock; the 43 // This method can only be called while holding the Pepper proxy lock; the
44 // other methods can be called with/without the Pepper proxy lock. 44 // other methods can be called with/without the Pepper proxy lock.
45 void Register(PP_Resource resource, 45 void Register(PP_Resource resource,
46 int32_t sequence_number, 46 int32_t sequence_number,
47 scoped_refptr<TrackedCallback> reply_thread_hint); 47 scoped_refptr<TrackedCallback> reply_thread_hint);
48 void Unregister(PP_Resource resource); 48 void Unregister(PP_Resource resource);
49 49
50 // This results in Resource::OnReplyReceived() for the specified message type
51 // to be called on the IO thread directly, while holding the Pepper proxy
52 // lock.
53 void HandleOnIOThread(uint32 nested_msg_type);
54
55 // This method returns NULL if the target thread is the IO thread (because
56 // that is the thread on which this method is supposed to be called).
57 scoped_refptr<base::MessageLoopProxy> GetTargetThread( 50 scoped_refptr<base::MessageLoopProxy> GetTargetThread(
58 const ResourceMessageReplyParams& reply_params, 51 const ResourceMessageReplyParams& reply_params,
59 const IPC::Message& nested_msg); 52 const IPC::Message& nested_msg);
60 53
61 private: 54 private:
62 friend class base::RefCountedThreadSafe<ResourceReplyThreadRegistrar>; 55 friend class base::RefCountedThreadSafe<ResourceReplyThreadRegistrar>;
63 56
64 typedef std::map<int32_t, scoped_refptr<base::MessageLoopProxy> > 57 typedef std::map<int32_t, scoped_refptr<base::MessageLoopProxy> >
65 SequenceThreadMap; 58 SequenceThreadMap;
66 typedef std::map<PP_Resource, SequenceThreadMap> ResourceMap; 59 typedef std::map<PP_Resource, SequenceThreadMap> ResourceMap;
67 60
68 ~ResourceReplyThreadRegistrar(); 61 ~ResourceReplyThreadRegistrar();
69 62
70 // The lock that protects the data members below. 63 // The lock that protects the data members below.
71 // Please note that we should never try to acquire the Pepper proxy lock while 64 // Please note that we should never try to acquire the Pepper proxy lock while
72 // holding |lock_|, otherwise we will cause deadlock. 65 // holding |lock_|, otherwise we will cause deadlock.
73 base::Lock lock_; 66 base::Lock lock_;
74 ResourceMap map_; 67 ResourceMap map_;
75 std::set<uint32> io_thread_message_types_;
76 scoped_refptr<base::MessageLoopProxy> main_thread_; 68 scoped_refptr<base::MessageLoopProxy> main_thread_;
77 69
78 DISALLOW_COPY_AND_ASSIGN(ResourceReplyThreadRegistrar); 70 DISALLOW_COPY_AND_ASSIGN(ResourceReplyThreadRegistrar);
79 }; 71 };
80 72
81 } // namespace proxy 73 } // namespace proxy
82 } // namespace ppapi 74 } // namespace ppapi
83 75
84 #endif // PPAPI_PROXY_RESOURCE_REPLY_THREAD_REGISTRAR_H_ 76 #endif // PPAPI_PROXY_RESOURCE_REPLY_THREAD_REGISTRAR_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/resource_message_filter.h ('k') | ppapi/proxy/resource_reply_thread_registrar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698