OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 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. | |
4 | |
5 #ifndef PPAPI_PROXY_PLUGIN_RESOURCE_H_ | |
6 #define PPAPI_PROXY_PLUGIN_RESOURCE_H_ | |
7 | |
8 #include "base/compiler_specific.h" | |
9 #include "ipc/ipc_sender.h" | |
10 #include "ppapi/proxy/ppapi_proxy_export.h" | |
11 #include "ppapi/shared_impl/resource.h" | |
12 | |
13 namespace IPC { | |
14 class Message; | |
15 } | |
16 | |
17 namespace ppapi { | |
18 namespace proxy { | |
19 | |
20 class PluginDispatcher; | |
21 | |
22 class PPAPI_PROXY_EXPORT PluginResource : public Resource, | |
23 public IPC::Sender { | |
24 public: | |
25 PluginResource(IPC::Sender* sender, | |
26 PP_Instance instance); | |
27 virtual ~PluginResource(); | |
28 | |
29 // IPC::Sender implementation. | |
30 virtual bool Send(IPC::Message* message) OVERRIDE; | |
31 | |
32 bool sent_create_to_renderer() const { return sent_create_to_renderer_; } | |
33 | |
34 protected: | |
35 // Sends a create message to the renderer for the current resource. | |
36 void SendCreateToRenderer(const IPC::Message& msg); | |
37 | |
38 // Sends the given IPC message as a resource request to the host | |
39 // corresponding to this resource object and does not expect a reply. | |
40 void PostToRenderer(const IPC::Message& msg); | |
41 | |
42 // Like PostToRenderer but expects a response. | |
43 // | |
44 // Returns the new request's sequence number which can be used to identify | |
45 // the callback. The host will reply and ppapi::Resource::OnReplyReceived | |
46 // will be called. | |
47 // | |
48 // Note that all integers (including 0 and -1) are valid request IDs. | |
49 int32_t CallRenderer(const IPC::Message& msg); | |
bbudge
2012/07/02 20:06:06
It seems odd that sequence numbers are signed ints
brettw
2012/07/07 05:28:04
Well, it's going to theoretically wrap anyway (so
| |
50 | |
51 private: | |
52 IPC::Sender* sender_; | |
53 | |
54 int next_sequence_number_; | |
bbudge
2012/07/02 20:06:06
int -> int32_t or uint32_t?
| |
55 | |
56 bool sent_create_to_renderer_; | |
57 | |
58 DISALLOW_COPY_AND_ASSIGN(PluginResource); | |
59 }; | |
60 | |
61 } // namespace proxy | |
62 } // namespace ppapi | |
63 | |
64 #endif // PPAPI_PROXY_PLUGIN_RESOURCE_H_ | |
OLD | NEW |