OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PPAPI_PROXY_VPN_PROVIDER_RESOURCE_H_ | 5 #ifndef PPAPI_PROXY_VPN_PROVIDER_RESOURCE_H_ |
6 #define PPAPI_PROXY_VPN_PROVIDER_RESOURCE_H_ | 6 #define PPAPI_PROXY_VPN_PROVIDER_RESOURCE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <queue> | 9 #include <queue> |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // PluginResource overrides. | 42 // PluginResource overrides. |
43 virtual void OnReplyReceived(const ResourceMessageReplyParams& params, | 43 virtual void OnReplyReceived(const ResourceMessageReplyParams& params, |
44 const IPC::Message& msg) override; | 44 const IPC::Message& msg) override; |
45 | 45 |
46 // PPB_VpnProvider IPC Replies | 46 // PPB_VpnProvider IPC Replies |
47 void OnPluginMsgBindReply(const ResourceMessageReplyParams& params, | 47 void OnPluginMsgBindReply(const ResourceMessageReplyParams& params, |
48 uint32_t queue_size, | 48 uint32_t queue_size, |
49 uint32_t max_packet_size, | 49 uint32_t max_packet_size, |
50 int32_t result); | 50 int32_t result); |
51 void OnPluginMsgSendPacketReply(const ResourceMessageReplyParams& params, | 51 void OnPluginMsgSendPacketReply(const ResourceMessageReplyParams& params, |
52 uint32_t id); | 52 int32_t result); |
53 | 53 |
54 // Browser callbacks | 54 // Browser callbacks |
55 void OnPluginMsgOnUnbindReceived(const ResourceMessageReplyParams& params); | 55 void OnPluginMsgOnUnbindReceived(const ResourceMessageReplyParams& params); |
56 void OnPluginMsgOnPacketReceived(const ResourceMessageReplyParams& params, | 56 void OnPluginMsgOnPacketReceived(const ResourceMessageReplyParams& params, |
57 uint32_t packet_size, | 57 uint32_t packet_size, |
58 uint32_t id); | 58 uint32_t id); |
59 | 59 |
60 // Picks up a received packet and moves it to user buffer. This method is used | 60 // Picks up a received packet and moves it to user buffer. This method is used |
61 // in both ReceivePacket() for fast returning path, and in | 61 // in both ReceivePacket() for fast returning path, and in |
62 // OnPluginMsgOnPacketReceived() for delayed callback invocations. | 62 // OnPluginMsgOnPacketReceived() for delayed callback invocations. |
63 void WritePacket(); | 63 void WritePacket(); |
64 | 64 |
65 // Sends a packet to the browser. This method is used in both SendPacket() for | 65 // Sends a packet to the browser. This method is used in both SendPacket() for |
66 // fast path, and in OnPluginMsgSendPacketReply for processing previously | 66 // fast path, and in OnPluginMsgSendPacketReply for processing previously |
67 // queued packets. | 67 // queued packets. |
68 int32_t DoSendPacket(const PP_Var& packet, uint32_t id); | 68 int32_t DoSendPacket(const PP_Var& packet, uint32_t id); |
69 | 69 |
70 scoped_refptr<TrackedCallback> bind_callback_; | 70 scoped_refptr<TrackedCallback> bind_callback_; |
71 scoped_refptr<TrackedCallback> send_packet_callback_; | 71 scoped_refptr<TrackedCallback> send_packet_callback_; |
72 scoped_refptr<TrackedCallback> receive_packet_callback_; | 72 scoped_refptr<TrackedCallback> receive_packet_callback_; |
73 | 73 |
74 // Keeps a pointer to the provided callback variable. Received packet will be | 74 // Keeps a pointer to the provided callback variable. Received packet will be |
75 // copied to this variable on ready. | 75 // copied to this variable on ready. |
76 PP_Var* receive_packet_callback_var_; | 76 PP_Var* receive_packet_callback_var_; |
77 | 77 |
78 std::unique_ptr<ppapi::VpnProviderSharedBuffer> send_packet_buffer_; | 78 std::unique_ptr<ppapi::VpnProviderSharedBuffer> send_packet_buffer_; |
79 std::unique_ptr<ppapi::VpnProviderSharedBuffer> recv_packet_buffer_; | 79 std::unique_ptr<ppapi::VpnProviderSharedBuffer> receive_packet_buffer_; |
80 | 80 |
81 std::queue<PP_Var> send_packets_; | 81 std::queue<PP_Var> send_packets_; |
82 std::queue<scoped_refptr<Var>> received_packets_; | 82 std::queue<scoped_refptr<Var>> received_packets_; |
83 | 83 |
84 // Connection bound state | 84 // Connection bound state |
85 bool bound_; | 85 bool bound_; |
86 | 86 |
87 DISALLOW_COPY_AND_ASSIGN(VpnProviderResource); | 87 DISALLOW_COPY_AND_ASSIGN(VpnProviderResource); |
88 }; | 88 }; |
89 | 89 |
90 } // namespace proxy | 90 } // namespace proxy |
91 } // namespace ppapi | 91 } // namespace ppapi |
92 | 92 |
93 #endif // PPAPI_PROXY_VPN_PROVIDER_RESOURCE_H_ | 93 #endif // PPAPI_PROXY_VPN_PROVIDER_RESOURCE_H_ |
OLD | NEW |