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

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
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;
dmichael (off chromium) 2014/09/12 19:49:07 I think it's likely that messages intended for the
yzshen1 2014/09/15 20:59:39 I agree. I have a question related to this in udp_
+ };
+
+ 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);
};

Powered by Google App Engine
This is Rietveld 408576698