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 "base/memory/weak_ptr.h" | |
| 9 #include "ppapi/proxy/plugin_resource.h" | |
| 10 #include "ppapi/proxy/ppapi_proxy_export.h" | |
| 11 #include "ppapi/shared_impl/io_stream_shared.h" | |
| 12 | |
| 13 namespace ppapi { | |
| 14 namespace proxy { | |
| 15 | |
| 16 // The IOStreamResource is used for data transmission between plugin and | |
| 17 // renderer processes. It works as a ring buffer. It is implemented using | |
| 18 // shared memory. | |
| 19 class PPAPI_PROXY_EXPORT IOStreamResource | |
|
yzshen1
2014/01/03 21:51:41
I think if it is intended to be a base class for m
| |
| 20 : public PluginResource, | |
| 21 public IOStreamShared { | |
| 22 protected: | |
| 23 IOStreamResource(Connection connection, | |
| 24 PP_Instance instance, | |
| 25 bool is_input); | |
| 26 | |
| 27 IOStreamResource(Connection connection, | |
| 28 PP_Instance instance, | |
| 29 int pending_renderer_id, | |
| 30 bool is_input); | |
| 31 | |
| 32 virtual ~IOStreamResource(); | |
| 33 | |
| 34 // Initializes IOStream resource. It allocates the underlying shared circular | |
| 35 // buffer. | |
| 36 int32_t Init(uint32_t size, scoped_refptr<TrackedCallback> callback); | |
| 37 | |
| 38 // Overridden from ppapi::proxy::PluginResource | |
| 39 virtual void OnReplyReceived(const proxy::ResourceMessageReplyParams& params, | |
|
yzshen1
2014/01/03 21:51:41
no need to have proxy::
| |
| 40 const IPC::Message& msg) OVERRIDE; | |
| 41 | |
| 42 private: | |
| 43 // Handle Plugin Init message. | |
|
yzshen1
2014/01/03 21:51:41
handle*s* (here and below)
| |
| 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 void OnPluginMsgInitReply(uint32_t size, | |
| 52 scoped_refptr<TrackedCallback> callback, | |
| 53 const ResourceMessageReplyParams& params); | |
| 54 | |
| 55 // Overridden from ppapi::IOStreamShared. | |
| 56 void MovePeerLimit(uint32_t offset) OVERRIDE; | |
| 57 | |
| 58 base::WeakPtrFactory<IOStreamResource> weak_factory_; | |
| 59 | |
| 60 DISALLOW_COPY_AND_ASSIGN(IOStreamResource); | |
| 61 }; | |
| 62 | |
| 63 } // namespace proxy | |
| 64 } // namespace ppapi | |
| 65 | |
| 66 #endif // PPAPI_PROXY_IO_STREAM_RESOURCE_H_ | |
| OLD | NEW |