Delete unused downloads page asset.
[chromium-blink-merge.git] / ppapi / proxy / resource_message_filter.h
bloba7c4d263cdde819bf850156fc2d1f320675a7cac
1 // Copyright 2015 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.
5 #ifndef PPAPI_PROXY_RESOURCE_MESSAGE_FILTER_H_
6 #define PPAPI_PROXY_RESOURCE_MESSAGE_FILTER_H_
8 #include "base/memory/ref_counted.h"
9 #include "ppapi/proxy/ppapi_proxy_export.h"
11 namespace IPC {
12 class Message;
15 namespace ppapi {
16 namespace proxy {
17 class ResourceMessageReplyParams;
19 // A ResourceMessageFilter lives on the IO thread and handles messages for a
20 // particular resource type. This is necessary in some cases where we want to
21 // reduce latency by doing some work on the IO thread rather than having to
22 // PostTask to the main Pepper thread.
24 // Note: In some cases we can rely on a reply being associated with a
25 // particular TrackedCallback, in which case we can dispatch directly to the
26 // TrackedCallback's thread. See ReplyThreadRegistrar. That should be the first
27 // choice for avoiding an unecessary jump to the main-thread.
29 // ResourceMessageFilter is for cases where there is not a one-to-one
30 // relationship between a reply message and a TrackedCallback. For example, for
31 // UDP Socket resources, the browser pushes data to the plugin even when the
32 // plugin does not have a pending callback. We can't use the
33 // ReplyThreadRegistrar, because data may arrive when there's not yet a
34 // TrackedCallback to tell us what thread to use. So instead, we define a
35 // UDPSocketFilter which accepts and queues UDP data on the IO thread.
36 class PPAPI_PROXY_EXPORT ResourceMessageFilter
37 : public base::RefCountedThreadSafe<ResourceMessageFilter> {
38 public:
39 virtual bool OnResourceReplyReceived(
40 const ResourceMessageReplyParams& reply_params,
41 const IPC::Message& nested_msg) = 0;
43 protected:
44 friend class base::RefCountedThreadSafe<ResourceMessageFilter>;
45 virtual ~ResourceMessageFilter() {}
48 } // namespace proxy
49 } // namespace ppapi
51 #endif // PPAPI_PROXY_RESOURCE_MESSAGE_FILTER_H_