| Index: ppapi/proxy/resource_reply_thread_registrar.h
|
| diff --git a/ppapi/proxy/resource_reply_thread_registrar.h b/ppapi/proxy/resource_reply_thread_registrar.h
|
| index eef6d615965cf6a4656ecba302f028b541ff3b2d..4c0d7a992984ad23da8b3316ce397b6b28c2047d 100644
|
| --- a/ppapi/proxy/resource_reply_thread_registrar.h
|
| +++ b/ppapi/proxy/resource_reply_thread_registrar.h
|
| @@ -6,6 +6,7 @@
|
| #define PPAPI_PROXY_RESOURCE_REPLY_THREAD_REGISTRAR_H_
|
|
|
| #include <map>
|
| +#include <set>
|
|
|
| #include "base/basictypes.h"
|
| #include "base/memory/ref_counted.h"
|
| @@ -18,12 +19,18 @@ namespace base {
|
| class MessageLoopProxy;
|
| }
|
|
|
| +namespace IPC {
|
| +class Message;
|
| +}
|
| +
|
| namespace ppapi {
|
|
|
| class TrackedCallback;
|
|
|
| namespace proxy {
|
|
|
| +class ResourceMessageReplyParams;
|
| +
|
| // ResourceReplyThreadRegistrar records the handling thread for
|
| // PpapiPluginMsg_ResourceReply messages.
|
| // This class is thread safe.
|
| @@ -31,7 +38,7 @@ class PPAPI_PROXY_EXPORT ResourceReplyThreadRegistrar
|
| : public base::RefCountedThreadSafe<ResourceReplyThreadRegistrar> {
|
| public:
|
| explicit ResourceReplyThreadRegistrar(
|
| - scoped_refptr<base::MessageLoopProxy> default_thread);
|
| + scoped_refptr<base::MessageLoopProxy> main_thread);
|
|
|
| // This method can only be called while holding the Pepper proxy lock; the
|
| // other methods can be called with/without the Pepper proxy lock.
|
| @@ -39,18 +46,31 @@ class PPAPI_PROXY_EXPORT ResourceReplyThreadRegistrar
|
| int32_t sequence_number,
|
| scoped_refptr<TrackedCallback> reply_thread_hint);
|
|
|
| + // This results in Resource::OnReplyReceived() for the specified resource and
|
| + // message type to be called on the IO thread directly, while holding the
|
| + // Pepper proxy lock.
|
| + void HandleOnIOThread(PP_Resource resource, uint32 nested_msg_type);
|
| +
|
| void Unregister(PP_Resource resource);
|
|
|
| - scoped_refptr<base::MessageLoopProxy> GetTargetThreadAndUnregister(
|
| - PP_Resource resource,
|
| - int32_t sequence_number);
|
| + // This method returns NULL if the target thread is the IO thread (because
|
| + // that is the thread on which this method is supposed to be called).
|
| + scoped_refptr<base::MessageLoopProxy> GetTargetThread(
|
| + const ResourceMessageReplyParams& reply_params,
|
| + const IPC::Message& nested_msg);
|
|
|
| private:
|
| friend class base::RefCountedThreadSafe<ResourceReplyThreadRegistrar>;
|
|
|
| typedef std::map<int32_t, scoped_refptr<base::MessageLoopProxy> >
|
| - SequenceNumberMap;
|
| - typedef std::map<PP_Resource, SequenceNumberMap> ResourceMap;
|
| + SequenceThreadMap;
|
| +
|
| + struct ResourceInfo {
|
| + SequenceThreadMap thread_map;
|
| + std::set<uint32> io_thread_message_types;
|
| + };
|
| +
|
| + typedef std::map<PP_Resource, ResourceInfo> ResourceMap;
|
|
|
| ~ResourceReplyThreadRegistrar();
|
|
|
| @@ -59,7 +79,7 @@ class PPAPI_PROXY_EXPORT ResourceReplyThreadRegistrar
|
| // holding |lock_|, otherwise we will cause deadlock.
|
| base::Lock lock_;
|
| ResourceMap map_;
|
| - scoped_refptr<base::MessageLoopProxy> default_thread_;
|
| + scoped_refptr<base::MessageLoopProxy> main_thread_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(ResourceReplyThreadRegistrar);
|
| };
|
|
|