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

Side by Side Diff: ppapi/proxy/plugin_var_tracker.cc

Issue 128683003: [PPAPI] Implement media stream video track API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@video_track_impl_cl
Patch Set: Fix review issues Created 6 years, 11 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
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 #include "ppapi/proxy/plugin_var_tracker.h" 5 #include "ppapi/proxy/plugin_var_tracker.h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "ipc/ipc_message.h" 9 #include "ipc/ipc_message.h"
10 #include "ppapi/c/dev/ppp_class_deprecated.h" 10 #include "ppapi/c/dev/ppp_class_deprecated.h"
11 #include "ppapi/c/ppb_var.h" 11 #include "ppapi/c/ppb_var.h"
12 #include "ppapi/proxy/file_system_resource.h" 12 #include "ppapi/proxy/file_system_resource.h"
13 #include "ppapi/proxy/media_stream_video_track_resource.h"
13 #include "ppapi/proxy/plugin_array_buffer_var.h" 14 #include "ppapi/proxy/plugin_array_buffer_var.h"
14 #include "ppapi/proxy/plugin_dispatcher.h" 15 #include "ppapi/proxy/plugin_dispatcher.h"
15 #include "ppapi/proxy/plugin_globals.h" 16 #include "ppapi/proxy/plugin_globals.h"
16 #include "ppapi/proxy/plugin_resource_var.h" 17 #include "ppapi/proxy/plugin_resource_var.h"
17 #include "ppapi/proxy/ppapi_messages.h" 18 #include "ppapi/proxy/ppapi_messages.h"
18 #include "ppapi/proxy/proxy_object_var.h" 19 #include "ppapi/proxy/proxy_object_var.h"
19 #include "ppapi/shared_impl/api_id.h" 20 #include "ppapi/shared_impl/api_id.h"
20 #include "ppapi/shared_impl/ppapi_globals.h" 21 #include "ppapi/shared_impl/ppapi_globals.h"
21 #include "ppapi/shared_impl/proxy_lock.h" 22 #include "ppapi/shared_impl/proxy_lock.h"
22 #include "ppapi/shared_impl/resource_tracker.h" 23 #include "ppapi/shared_impl/resource_tracker.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 166
166 // Now just release the object given the plugin var ID. 167 // Now just release the object given the plugin var ID.
167 ReleaseVar(found->second); 168 ReleaseVar(found->second);
168 } 169 }
169 170
170 PP_Var PluginVarTracker::MakeResourcePPVarFromMessage( 171 PP_Var PluginVarTracker::MakeResourcePPVarFromMessage(
171 PP_Instance instance, 172 PP_Instance instance,
172 const IPC::Message& creation_message, 173 const IPC::Message& creation_message,
173 int pending_renderer_id, 174 int pending_renderer_id,
174 int pending_browser_id) { 175 int pending_browser_id) {
175 DCHECK(pending_renderer_id);
176 DCHECK(pending_browser_id);
177 switch (creation_message.type()) { 176 switch (creation_message.type()) {
178 case PpapiPluginMsg_FileSystem_CreateFromPendingHost::ID: { 177 case PpapiPluginMsg_FileSystem_CreateFromPendingHost::ID: {
178 DCHECK(pending_renderer_id);
179 DCHECK(pending_browser_id);
179 PP_FileSystemType file_system_type; 180 PP_FileSystemType file_system_type;
180 if (!UnpackMessage<PpapiPluginMsg_FileSystem_CreateFromPendingHost>( 181 if (!UnpackMessage<PpapiPluginMsg_FileSystem_CreateFromPendingHost>(
181 creation_message, &file_system_type)) { 182 creation_message, &file_system_type)) {
182 NOTREACHED() << "Invalid message of type " 183 NOTREACHED() << "Invalid message of type "
183 "PpapiPluginMsg_FileSystem_CreateFromPendingHost"; 184 "PpapiPluginMsg_FileSystem_CreateFromPendingHost";
184 return PP_MakeNull(); 185 return PP_MakeNull();
185 } 186 }
186 // Create a plugin-side resource and attach it to the host resource. 187 // Create a plugin-side resource and attach it to the host resource.
187 // Note: This only makes sense when the plugin is out of process (which 188 // Note: This only makes sense when the plugin is out of process (which
188 // should always be true when passing resource vars). 189 // should always be true when passing resource vars).
189 PP_Resource pp_resource = 190 PP_Resource pp_resource =
190 (new FileSystemResource(GetConnectionForInstance(instance), 191 (new FileSystemResource(GetConnectionForInstance(instance),
191 instance, 192 instance,
192 pending_renderer_id, 193 pending_renderer_id,
193 pending_browser_id, 194 pending_browser_id,
194 file_system_type))->GetReference(); 195 file_system_type))->GetReference();
195 return MakeResourcePPVar(pp_resource); 196 return MakeResourcePPVar(pp_resource);
196 } 197 }
198 case PpapiPluginMsg_MediaStreamVideoTrack_CreateFromPendingHost::ID: {
199 DCHECK(pending_renderer_id);
200 std::string track_id;
201 if (!UnpackMessage<
202 PpapiPluginMsg_MediaStreamVideoTrack_CreateFromPendingHost>(
203 creation_message, &track_id)) {
204 NOTREACHED() <<
205 "Invalid message of type "
206 "PpapiPluginMsg_MediaStreamVideoTrack_CreateFromPendingHost";
207 return PP_MakeNull();
208 }
209 PP_Resource pp_resource =
210 (new MediaStreamVideoTrackResource(GetConnectionForInstance(instance),
211 instance,
212 pending_renderer_id,
213 track_id))->GetReference();
214 return MakeResourcePPVar(pp_resource);
215 }
197 default: { 216 default: {
198 NOTREACHED() << "Creation message has unexpected type " 217 NOTREACHED() << "Creation message has unexpected type "
199 << creation_message.type(); 218 << creation_message.type();
200 return PP_MakeNull(); 219 return PP_MakeNull();
201 } 220 }
202 } 221 }
203 } 222 }
204 223
205 ResourceVar* PluginVarTracker::MakeResourceVar(PP_Resource pp_resource) { 224 ResourceVar* PluginVarTracker::MakeResourceVar(PP_Resource pp_resource) {
206 // The resource 0 returns a null resource var. 225 // The resource 0 returns a null resource var.
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 int id, 489 int id,
471 PP_Instance instance, 490 PP_Instance instance,
472 base::SharedMemoryHandle* handle, 491 base::SharedMemoryHandle* handle,
473 uint32* size_in_bytes) { 492 uint32* size_in_bytes) {
474 NOTREACHED(); 493 NOTREACHED();
475 return false; 494 return false;
476 } 495 }
477 496
478 } // namesace proxy 497 } // namesace proxy
479 } // namespace ppapi 498 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698