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

Side by Side Diff: content/renderer/pepper/pepper_video_capture_host.cc

Issue 364123002: [Cross-Site Isolation] Migrate entire MediaStream verticals to be per-RenderFrame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: It's random enough. + REBASE Created 6 years, 5 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 #include "content/renderer/pepper/pepper_video_capture_host.h" 5 #include "content/renderer/pepper/pepper_video_capture_host.h"
6 6
7 #include "content/renderer/pepper/host_globals.h" 7 #include "content/renderer/pepper/host_globals.h"
8 #include "content/renderer/pepper/pepper_media_device_manager.h" 8 #include "content/renderer/pepper/pepper_media_device_manager.h"
9 #include "content/renderer/pepper/pepper_platform_video_capture.h" 9 #include "content/renderer/pepper/pepper_platform_video_capture.h"
10 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" 10 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
11 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" 11 #include "content/renderer/pepper/renderer_ppapi_host_impl.h"
12 #include "content/renderer/render_view_impl.h" 12 #include "content/renderer/render_frame_impl.h"
13 #include "media/base/limits.h" 13 #include "media/base/limits.h"
14 #include "media/base/video_frame.h" 14 #include "media/base/video_frame.h"
15 #include "ppapi/host/dispatch_host_message.h" 15 #include "ppapi/host/dispatch_host_message.h"
16 #include "ppapi/host/ppapi_host.h" 16 #include "ppapi/host/ppapi_host.h"
17 #include "ppapi/proxy/host_dispatcher.h" 17 #include "ppapi/proxy/host_dispatcher.h"
18 #include "ppapi/proxy/ppapi_messages.h" 18 #include "ppapi/proxy/ppapi_messages.h"
19 #include "ppapi/shared_impl/host_resource.h" 19 #include "ppapi/shared_impl/host_resource.h"
20 #include "ppapi/thunk/enter.h" 20 #include "ppapi/thunk/enter.h"
21 #include "ppapi/thunk/ppb_buffer_api.h" 21 #include "ppapi/thunk/ppb_buffer_api.h"
22 22
(...skipping 12 matching lines...) Expand all
35 namespace content { 35 namespace content {
36 36
37 PepperVideoCaptureHost::PepperVideoCaptureHost(RendererPpapiHostImpl* host, 37 PepperVideoCaptureHost::PepperVideoCaptureHost(RendererPpapiHostImpl* host,
38 PP_Instance instance, 38 PP_Instance instance,
39 PP_Resource resource) 39 PP_Resource resource)
40 : ResourceHost(host->GetPpapiHost(), instance, resource), 40 : ResourceHost(host->GetPpapiHost(), instance, resource),
41 renderer_ppapi_host_(host), 41 renderer_ppapi_host_(host),
42 buffer_count_hint_(0), 42 buffer_count_hint_(0),
43 status_(PP_VIDEO_CAPTURE_STATUS_STOPPED), 43 status_(PP_VIDEO_CAPTURE_STATUS_STOPPED),
44 enumeration_helper_(this, 44 enumeration_helper_(this,
45 PepperMediaDeviceManager::GetForRenderView( 45 PepperMediaDeviceManager::GetForRenderFrame(
46 host->GetRenderViewForInstance(pp_instance())), 46 host->GetRenderFrameForInstance(pp_instance())),
47 PP_DEVICETYPE_DEV_VIDEOCAPTURE, 47 PP_DEVICETYPE_DEV_VIDEOCAPTURE,
48 host->GetDocumentURL(instance)) { 48 host->GetDocumentURL(instance)) {
49 } 49 }
50 50
51 PepperVideoCaptureHost::~PepperVideoCaptureHost() { 51 PepperVideoCaptureHost::~PepperVideoCaptureHost() {
52 Close(); 52 Close();
53 } 53 }
54 54
55 bool PepperVideoCaptureHost::Init() { 55 bool PepperVideoCaptureHost::Init() {
56 return !!renderer_ppapi_host_->GetPluginInstance(pp_instance()); 56 return !!renderer_ppapi_host_->GetPluginInstance(pp_instance());
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 uint32_t buffer_count) { 254 uint32_t buffer_count) {
255 if (platform_video_capture_.get()) 255 if (platform_video_capture_.get())
256 return PP_ERROR_FAILED; 256 return PP_ERROR_FAILED;
257 257
258 SetRequestedInfo(requested_info, buffer_count); 258 SetRequestedInfo(requested_info, buffer_count);
259 259
260 GURL document_url = renderer_ppapi_host_->GetDocumentURL(pp_instance()); 260 GURL document_url = renderer_ppapi_host_->GetDocumentURL(pp_instance());
261 if (!document_url.is_valid()) 261 if (!document_url.is_valid())
262 return PP_ERROR_FAILED; 262 return PP_ERROR_FAILED;
263 263
264 RenderViewImpl* render_view = static_cast<RenderViewImpl*>(
265 renderer_ppapi_host_->GetRenderViewForInstance(pp_instance()));
266
267 platform_video_capture_.reset(new PepperPlatformVideoCapture( 264 platform_video_capture_.reset(new PepperPlatformVideoCapture(
268 render_view->AsWeakPtr(), device_id, document_url, this)); 265 renderer_ppapi_host_->GetRenderFrameForInstance(pp_instance())->
266 GetRoutingID(),
267 device_id,
268 document_url,
269 this));
269 270
270 open_reply_context_ = context->MakeReplyMessageContext(); 271 open_reply_context_ = context->MakeReplyMessageContext();
271 272
272 return PP_OK_COMPLETIONPENDING; 273 return PP_OK_COMPLETIONPENDING;
273 } 274 }
274 275
275 int32_t PepperVideoCaptureHost::OnStartCapture( 276 int32_t PepperVideoCaptureHost::OnStartCapture(
276 ppapi::host::HostMessageContext* context) { 277 ppapi::host::HostMessageContext* context) {
277 if (!SetStatus(PP_VIDEO_CAPTURE_STATUS_STARTING, false) || 278 if (!SetStatus(PP_VIDEO_CAPTURE_STATUS_STARTING, false) ||
278 !platform_video_capture_.get()) 279 !platform_video_capture_.get())
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 } 415 }
415 416
416 PepperVideoCaptureHost::BufferInfo::BufferInfo() 417 PepperVideoCaptureHost::BufferInfo::BufferInfo()
417 : in_use(false), data(NULL), buffer() { 418 : in_use(false), data(NULL), buffer() {
418 } 419 }
419 420
420 PepperVideoCaptureHost::BufferInfo::~BufferInfo() { 421 PepperVideoCaptureHost::BufferInfo::~BufferInfo() {
421 } 422 }
422 423
423 } // namespace content 424 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_platform_video_capture.cc ('k') | content/renderer/render_frame_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698