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

Unified Diff: ppapi/proxy/resource_reply_thread_registrar.h

Issue 563073002: Pepper UDP socket: buffer received packets in the plugin process to improve performance. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/proxy/ppapi_messages.h ('k') | ppapi/proxy/resource_reply_thread_registrar.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..ded54e9de3d90850122c9404fbef7e61d528e1bd 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,26 +38,32 @@ 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.
void Register(PP_Resource resource,
int32_t sequence_number,
scoped_refptr<TrackedCallback> reply_thread_hint);
-
void Unregister(PP_Resource resource);
- scoped_refptr<base::MessageLoopProxy> GetTargetThreadAndUnregister(
- PP_Resource resource,
- int32_t sequence_number);
+ // This results in Resource::OnReplyReceived() for the specified message type
+ // to be called on the IO thread directly, while holding the Pepper proxy
+ // lock.
+ void HandleOnIOThread(uint32 nested_msg_type);
+
+ // 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;
+ typedef std::map<PP_Resource, SequenceThreadMap> ResourceMap;
~ResourceReplyThreadRegistrar();
@@ -59,7 +72,8 @@ class PPAPI_PROXY_EXPORT ResourceReplyThreadRegistrar
// holding |lock_|, otherwise we will cause deadlock.
base::Lock lock_;
ResourceMap map_;
- scoped_refptr<base::MessageLoopProxy> default_thread_;
+ std::set<uint32> io_thread_message_types_;
+ scoped_refptr<base::MessageLoopProxy> main_thread_;
DISALLOW_COPY_AND_ASSIGN(ResourceReplyThreadRegistrar);
};
« no previous file with comments | « ppapi/proxy/ppapi_messages.h ('k') | ppapi/proxy/resource_reply_thread_registrar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698