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

Side by Side Diff: ppapi/proxy/ppb_image_data_proxy.h

Issue 13771020: Add Pepper VideoReader and VideoWriter plumbing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ImageData management, depends on 14170012 Created 7 years, 7 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_PPB_IMAGE_DATA_PROXY_H_ 5 #ifndef PPAPI_PPB_IMAGE_DATA_PROXY_H_
6 #define PPAPI_PPB_IMAGE_DATA_PROXY_H_ 6 #define PPAPI_PPB_IMAGE_DATA_PROXY_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/shared_memory.h" 9 #include "base/shared_memory.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 #include "ipc/ipc_platform_file.h"
11 #include "ppapi/c/pp_bool.h" 12 #include "ppapi/c/pp_bool.h"
12 #include "ppapi/c/pp_completion_callback.h" 13 #include "ppapi/c/pp_completion_callback.h"
13 #include "ppapi/c/pp_instance.h" 14 #include "ppapi/c/pp_instance.h"
14 #include "ppapi/c/pp_module.h" 15 #include "ppapi/c/pp_module.h"
15 #include "ppapi/c/pp_resource.h" 16 #include "ppapi/c/pp_resource.h"
16 #include "ppapi/c/pp_size.h" 17 #include "ppapi/c/pp_size.h"
17 #include "ppapi/c/pp_var.h" 18 #include "ppapi/c/pp_var.h"
18 #include "ppapi/c/ppb_image_data.h" 19 #include "ppapi/c/ppb_image_data.h"
19 #include "ppapi/proxy/interface_proxy.h" 20 #include "ppapi/proxy/interface_proxy.h"
20 #include "ppapi/proxy/ppapi_proxy_export.h" 21 #include "ppapi/proxy/ppapi_proxy_export.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 virtual ~PPB_ImageData_Proxy(); 104 virtual ~PPB_ImageData_Proxy();
104 105
105 static PP_Resource CreateProxyResource(PP_Instance instance, 106 static PP_Resource CreateProxyResource(PP_Instance instance,
106 PP_ImageDataFormat format, 107 PP_ImageDataFormat format,
107 const PP_Size& size, 108 const PP_Size& size,
108 PP_Bool init_to_zero); 109 PP_Bool init_to_zero);
109 110
110 // InterfaceProxy implementation. 111 // InterfaceProxy implementation.
111 virtual bool OnMessageReceived(const IPC::Message& msg); 112 virtual bool OnMessageReceived(const IPC::Message& msg);
112 113
114 // Utility for creating ImageData resources.
115 // This can only be called on the host side of the proxy.
116 // On failure, will return invalid resource (0). On success it will return a
117 // valid resource and the out params will be written.
118 // |desc| contains the result of Describe.
119 // |image_handle| and |byte_count| contain the result of GetSharedMemory.
120 // NOTE: if |init_to_zero| is false, you should write over the entire image
121 // to avoid leaking sensitive data to a less privileged process.
122 PPAPI_PROXY_EXPORT static PP_Resource CreateImageData(
123 PP_Instance instance,
124 PP_ImageDataFormat format,
125 const PP_Size& size,
126 bool init_to_zero,
127 bool is_nacl_plugin,
128 PP_ImageDataDesc* desc,
129 IPC::PlatformFileForTransit* image_handle,
130 uint32_t* byte_count);
131
113 static const ApiID kApiID = API_ID_PPB_IMAGE_DATA; 132 static const ApiID kApiID = API_ID_PPB_IMAGE_DATA;
114 133
115 private: 134 private:
116 // Plugin->Host message handlers. 135 // Plugin->Host message handlers.
117 void OnHostMsgCreate(PP_Instance instance, 136 void OnHostMsgCreate(PP_Instance instance,
118 int32_t format, 137 int32_t format,
119 const PP_Size& size, 138 const PP_Size& size,
120 PP_Bool init_to_zero, 139 PP_Bool init_to_zero,
121 HostResource* result, 140 HostResource* result,
122 std::string* image_data_desc, 141 std::string* image_data_desc,
123 ImageHandle* result_image_handle); 142 ImageHandle* result_image_handle);
124 void OnHostMsgCreateNaCl(PP_Instance instance, 143 void OnHostMsgCreateNaCl(PP_Instance instance,
125 int32_t format, 144 int32_t format,
126 const PP_Size& size, 145 const PP_Size& size,
127 PP_Bool init_to_zero, 146 PP_Bool init_to_zero,
128 HostResource* result, 147 HostResource* result,
129 std::string* image_data_desc, 148 std::string* image_data_desc,
130 ppapi::proxy::SerializedHandle* result_image_handle); 149 ppapi::proxy::SerializedHandle* result_image_handle);
131 150
132 // Host->Plugin message handlers. 151 // Host->Plugin message handlers.
133 void OnPluginMsgNotifyUnusedImageData(const HostResource& old_image_data); 152 void OnPluginMsgNotifyUnusedImageData(const HostResource& old_image_data);
134 153
135 DISALLOW_COPY_AND_ASSIGN(PPB_ImageData_Proxy); 154 DISALLOW_COPY_AND_ASSIGN(PPB_ImageData_Proxy);
136 }; 155 };
137 156
138 } // namespace proxy 157 } // namespace proxy
139 } // namespace ppapi 158 } // namespace ppapi
140 159
141 #endif // PPAPI_PPB_IMAGE_DATA_PROXY_H_ 160 #endif // PPAPI_PPB_IMAGE_DATA_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698