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

Unified Diff: ppapi/proxy/resource_message_filter.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, 9 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_proxy_test.cc ('k') | ppapi/proxy/resource_reply_thread_registrar.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/resource_message_filter.h
diff --git a/ppapi/proxy/resource_message_filter.h b/ppapi/proxy/resource_message_filter.h
new file mode 100644
index 0000000000000000000000000000000000000000..a7c4d263cdde819bf850156fc2d1f320675a7cac
--- /dev/null
+++ b/ppapi/proxy/resource_message_filter.h
@@ -0,0 +1,51 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_PROXY_RESOURCE_MESSAGE_FILTER_H_
+#define PPAPI_PROXY_RESOURCE_MESSAGE_FILTER_H_
+
+#include "base/memory/ref_counted.h"
+#include "ppapi/proxy/ppapi_proxy_export.h"
+
+namespace IPC {
+class Message;
+}
+
+namespace ppapi {
+namespace proxy {
+class ResourceMessageReplyParams;
+
+// A ResourceMessageFilter lives on the IO thread and handles messages for a
+// particular resource type. This is necessary in some cases where we want to
+// reduce latency by doing some work on the IO thread rather than having to
+// PostTask to the main Pepper thread.
+//
+// Note: In some cases we can rely on a reply being associated with a
+// particular TrackedCallback, in which case we can dispatch directly to the
+// TrackedCallback's thread. See ReplyThreadRegistrar. That should be the first
+// choice for avoiding an unecessary jump to the main-thread.
+//
+// ResourceMessageFilter is for cases where there is not a one-to-one
+// relationship between a reply message and a TrackedCallback. For example, for
+// UDP Socket resources, the browser pushes data to the plugin even when the
+// plugin does not have a pending callback. We can't use the
+// ReplyThreadRegistrar, because data may arrive when there's not yet a
+// TrackedCallback to tell us what thread to use. So instead, we define a
+// UDPSocketFilter which accepts and queues UDP data on the IO thread.
+class PPAPI_PROXY_EXPORT ResourceMessageFilter
+ : public base::RefCountedThreadSafe<ResourceMessageFilter> {
+ public:
+ virtual bool OnResourceReplyReceived(
+ const ResourceMessageReplyParams& reply_params,
+ const IPC::Message& nested_msg) = 0;
+
+ protected:
+ friend class base::RefCountedThreadSafe<ResourceMessageFilter>;
+ virtual ~ResourceMessageFilter() {}
+};
+
+} // namespace proxy
+} // namespace ppapi
+
+#endif // PPAPI_PROXY_RESOURCE_MESSAGE_FILTER_H_
« no previous file with comments | « ppapi/proxy/ppapi_proxy_test.cc ('k') | ppapi/proxy/resource_reply_thread_registrar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698