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

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

Issue 46433002: Support using TrackedCallbacks as hints to determine the handling thread of resource reply messages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 7 years 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
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef PPAPI_PROXY_RESOURCE_REPLY_THREAD_REGISTRAR_H_
6 #define PPAPI_PROXY_RESOURCE_REPLY_THREAD_REGISTRAR_H_
7
8 #include <map>
9
10 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/synchronization/lock.h"
13 #include "ppapi/c/pp_resource.h"
14 #include "ppapi/proxy/ppapi_proxy_export.h"
15
16
17 namespace base {
18 class MessageLoopProxy;
19 }
20
21 namespace ppapi {
22
23 class TrackedCallback;
24
25 namespace proxy {
26
27 // ResourceReplyThreadRegistrar records handling thread for
dmichael (off chromium) 2013/12/10 23:38:01 nit: records +the+ handling
yzshen1 2013/12/11 00:21:49 Done.
28 // PpapiPluginMsg_ResourceReply messages.
29 // This class is thread safe.
30 class PPAPI_PROXY_EXPORT ResourceReplyThreadRegistrar
31 : public base::RefCountedThreadSafe<ResourceReplyThreadRegistrar> {
32 public:
33 explicit ResourceReplyThreadRegistrar(
34 scoped_refptr<base::MessageLoopProxy> default_thread);
35
36 void Register(PP_Resource resource,
37 int32_t sequence_number,
38 scoped_refptr<TrackedCallback> reply_thread_hint);
39 void Unregister(PP_Resource resource);
40
41 scoped_refptr<base::MessageLoopProxy> GetTargetThreadAndUnregister(
dmichael (off chromium) 2013/12/10 23:38:01 As I understand it, Unregister and this method sho
yzshen1 2013/12/11 00:21:49 All methods except Register() don't care about whe
42 PP_Resource resource,
43 int32_t sequence_number);
44
45 private:
46 friend class base::RefCountedThreadSafe<ResourceReplyThreadRegistrar>;
47
48 typedef std::map<int32_t, scoped_refptr<base::MessageLoopProxy> >
49 SequenceNumberMap;
50 typedef std::map<PP_Resource, SequenceNumberMap> ResourceMap;
51
52 ~ResourceReplyThreadRegistrar();
53
54 base::Lock lock_;
dmichael (off chromium) 2013/12/10 23:38:01 I find this a little bit scary, like we might mess
yzshen1 2013/12/11 00:21:49 Yeah, GetTargetThreadAndUnregister() will be calle
55 ResourceMap map_;
56 scoped_refptr<base::MessageLoopProxy> default_thread_;
57
58 DISALLOW_COPY_AND_ASSIGN(ResourceReplyThreadRegistrar);
59 };
60
61 } // namespace proxy
62 } // namespace ppapi
63
64 #endif // PPAPI_PROXY_RESOURCE_REPLY_THREAD_REGISTRAR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698