Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(608)

Unified Diff: ppapi/proxy/io_stream_resource.h

Issue 119853003: [PPAPI] Implement an IOStreamResource for data transmission between plugin and renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..11fc9f40ad5834b575a18367ffc10c87b24ee981
--- /dev/null
+++ b/ppapi/proxy/io_stream_resource.h
@@ -0,0 +1,59 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
bbudge 2013/12/31 00:51:53 2013
Peng 2013/12/31 23:33:54 Done.
+// 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 "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. Its underlayer is shared
bbudge 2013/12/31 00:51:53 How about: It is implemented using shared memory.
Peng 2013/12/31 23:33:54 Done.
+// memory.
+class PPAPI_PROXY_EXPORT IOStreamResource
+ : public PluginResource, public IOStreamShared {
+ protected:
+ IOStreamResource(Connection connection,
+ PP_Instance instance,
+ bool input);
+
+ IOStreamResource(Connection connection,
+ PP_Instance instance,
+ int pending_renderer_id,
+ bool input);
+
+ virtual ~IOStreamResource();
+
+ // Initializes IOStream resource. It allocates the underlying shared circular
+ // buffer.
+ // TODO(penghuang): Support initializing asynchronizely.
bbudge 2013/12/31 00:51:53 sp asynchronously
Peng 2013/12/31 23:33:54 Done.
+ int32_t Init(uint32_t size);
+
+ // Overridden from ppapi::proxy::PluginResource
+ virtual void OnReplyReceived(const proxy::ResourceMessageReplyParams& params,
+ const IPC::Message& msg) OVERRIDE;
+
+ private:
+ // Handle Plugin MoveLimit message.
bbudge 2013/12/31 00:51:53 s/MoveLimit/Init
Peng 2013/12/31 23:33:54 Done.
+ void OnPluginMsgInit(const ResourceMessageReplyParams& params,
+ uint32_t offset);
+
+ // Handle Plugin MoveLimit message.
+ void OnPluginMsgMoveLimit(const ResourceMessageReplyParams& params,
+ uint32_t offset);
+
+ // Overridden from ppapi::IOStreamShared.
+ void MovePeerLimit(uint32_t offset) OVERRIDE;
+
+ DISALLOW_COPY_AND_ASSIGN(IOStreamResource);
+};
+
+} // namespace proxy
+} // namespace ppapi
+
+#endif // PPAPI_PROXY_IO_STREAM_RESOURCE_H_

Powered by Google App Engine
This is Rietveld 408576698