Chromium Code Reviews| Index: ppapi/proxy/io_stream_resource.h |
| diff --git a/ppapi/proxy/io_stream_resource.h b/ppapi/proxy/io_stream_resource.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1f6557e82ebbbae0f659b03c16bc86a6f5815bac |
| --- /dev/null |
| +++ b/ppapi/proxy/io_stream_resource.h |
| @@ -0,0 +1,66 @@ |
| +// Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef PPAPI_PROXY_IO_STREAM_RESOURCE_H_ |
| +#define PPAPI_PROXY_IO_STREAM_RESOURCE_H_ |
| + |
| +#include "base/memory/weak_ptr.h" |
| +#include "ppapi/proxy/plugin_resource.h" |
| +#include "ppapi/proxy/ppapi_proxy_export.h" |
| +#include "ppapi/shared_impl/io_stream_shared.h" |
| + |
| +namespace ppapi { |
| +namespace proxy { |
| + |
| +// The IOStreamResource is used for data transmission between plugin and |
| +// renderer processes. It works as a ring buffer. It is implemented using |
| +// shared memory. |
| +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
|
| + : public PluginResource, |
| + public IOStreamShared { |
| + protected: |
| + IOStreamResource(Connection connection, |
| + PP_Instance instance, |
| + bool is_input); |
| + |
| + IOStreamResource(Connection connection, |
| + PP_Instance instance, |
| + int pending_renderer_id, |
| + bool is_input); |
| + |
| + virtual ~IOStreamResource(); |
| + |
| + // Initializes IOStream resource. It allocates the underlying shared circular |
| + // buffer. |
| + int32_t Init(uint32_t size, scoped_refptr<TrackedCallback> callback); |
| + |
| + // Overridden from ppapi::proxy::PluginResource |
| + virtual void OnReplyReceived(const proxy::ResourceMessageReplyParams& params, |
|
yzshen1
2014/01/03 21:51:41
no need to have proxy::
|
| + const IPC::Message& msg) OVERRIDE; |
| + |
| + private: |
| + // Handle Plugin Init message. |
|
yzshen1
2014/01/03 21:51:41
handle*s* (here and below)
|
| + void OnPluginMsgInit(const ResourceMessageReplyParams& params, |
| + uint32_t offset); |
| + |
| + // Handle Plugin MoveLimit message. |
| + void OnPluginMsgMoveLimit(const ResourceMessageReplyParams& params, |
| + uint32_t offset); |
| + |
| + void OnPluginMsgInitReply(uint32_t size, |
| + scoped_refptr<TrackedCallback> callback, |
| + const ResourceMessageReplyParams& params); |
| + |
| + // Overridden from ppapi::IOStreamShared. |
| + void MovePeerLimit(uint32_t offset) OVERRIDE; |
| + |
| + base::WeakPtrFactory<IOStreamResource> weak_factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(IOStreamResource); |
| +}; |
| + |
| +} // namespace proxy |
| +} // namespace ppapi |
| + |
| +#endif // PPAPI_PROXY_IO_STREAM_RESOURCE_H_ |