Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2014 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_IO_STREAM_RESOURCE_H_ | |
| 6 #define PPAPI_PROXY_IO_STREAM_RESOURCE_H_ | |
| 7 | |
| 8 #include "ppapi/proxy/plugin_resource.h" | |
| 9 #include "ppapi/proxy/ppapi_proxy_export.h" | |
| 10 #include "ppapi/shared_impl/io_stream_shared.h" | |
| 11 | |
| 12 namespace ppapi { | |
| 13 namespace proxy { | |
| 14 | |
| 15 // The IOStreamResource is used for data transmission between plugin and | |
| 16 // renderer processes. It works as a ring buffer. It is implemented using | |
| 17 // shared memory. | |
| 18 class PPAPI_PROXY_EXPORT IOStreamResource | |
| 19 : public PluginResource, | |
| 20 public IOStreamShared { | |
| 21 protected: | |
| 22 IOStreamResource(Connection connection, | |
| 23 PP_Instance instance, | |
| 24 bool is_input); | |
| 25 | |
| 26 IOStreamResource(Connection connection, | |
| 27 PP_Instance instance, | |
| 28 int pending_renderer_id, | |
| 29 bool is_input); | |
| 30 | |
| 31 virtual ~IOStreamResource(); | |
| 32 | |
| 33 // Initializes IOStream resource. It allocates the underlying shared circular | |
| 34 // buffer. | |
| 35 // TODO(penghuang): Support initializing asynchronously. | |
|
bbudge
2014/01/02 22:16:22
We really encourage asynchronous calls for a bunch
Peng
2014/01/03 16:15:11
Done
| |
| 36 int32_t Init(uint32_t size); | |
| 37 | |
| 38 // Overridden from ppapi::proxy::PluginResource | |
| 39 virtual void OnReplyReceived(const proxy::ResourceMessageReplyParams& params, | |
| 40 const IPC::Message& msg) OVERRIDE; | |
| 41 | |
| 42 private: | |
| 43 // Handle Plugin Init message. | |
| 44 void OnPluginMsgInit(const ResourceMessageReplyParams& params, | |
| 45 uint32_t offset); | |
| 46 | |
| 47 // Handle Plugin MoveLimit message. | |
| 48 void OnPluginMsgMoveLimit(const ResourceMessageReplyParams& params, | |
| 49 uint32_t offset); | |
| 50 | |
| 51 // Overridden from ppapi::IOStreamShared. | |
| 52 void MovePeerLimit(uint32_t offset) OVERRIDE; | |
| 53 | |
| 54 DISALLOW_COPY_AND_ASSIGN(IOStreamResource); | |
| 55 }; | |
| 56 | |
| 57 } // namespace proxy | |
| 58 } // namespace ppapi | |
| 59 | |
| 60 #endif // PPAPI_PROXY_IO_STREAM_RESOURCE_H_ | |
| OLD | NEW |