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

Side by Side Diff: content/browser/media/capture/web_contents_video_capture_device.cc

Issue 593503003: Support error handling for Surface readbacks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unnecessary headers. Created 6 years, 3 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 // Implementation notes: This needs to work on a variety of hardware 5 // Implementation notes: This needs to work on a variety of hardware
6 // configurations where the speed of the CPU and GPU greatly affect overall 6 // configurations where the speed of the CPU and GPU greatly affect overall
7 // performance. Spanning several threads, the process of capturing has been 7 // performance. Spanning several threads, the process of capturing has been
8 // split up into four conceptual stages: 8 // split up into four conceptual stages:
9 // 9 //
10 // 1. Reserve Buffer: Before a frame can be captured, a slot in the client's 10 // 1. Reserve Buffer: Before a frame can be captured, a slot in the client's
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 // Computes the preferred size of the target RenderWidget for optimal capture. 252 // Computes the preferred size of the target RenderWidget for optimal capture.
253 gfx::Size ComputeOptimalTargetSize() const; 253 gfx::Size ComputeOptimalTargetSize() const;
254 254
255 // Response callback for RenderWidgetHost::CopyFromBackingStore(). 255 // Response callback for RenderWidgetHost::CopyFromBackingStore().
256 void DidCopyFromBackingStore( 256 void DidCopyFromBackingStore(
257 const base::TimeTicks& start_time, 257 const base::TimeTicks& start_time,
258 const scoped_refptr<media::VideoFrame>& target, 258 const scoped_refptr<media::VideoFrame>& target,
259 const RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback& 259 const RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback&
260 deliver_frame_cb, 260 deliver_frame_cb,
261 bool success, 261 bool success,
262 const SkBitmap& bitmap); 262 const SkBitmap& bitmap,
263 const int& response);
263 264
264 // Response callback for RWHVP::CopyFromCompositingSurfaceToVideoFrame(). 265 // Response callback for RWHVP::CopyFromCompositingSurfaceToVideoFrame().
265 void DidCopyFromCompositingSurfaceToVideoFrame( 266 void DidCopyFromCompositingSurfaceToVideoFrame(
266 const base::TimeTicks& start_time, 267 const base::TimeTicks& start_time,
267 const RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback& 268 const RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback&
268 deliver_frame_cb, 269 deliver_frame_cb,
269 bool success); 270 bool success);
270 271
271 // Remove the old subscription, and start a new one if |rwh| is not NULL. 272 // Remove the old subscription, and start a new one if |rwh| is not NULL.
272 void RenewFrameSubscription(RenderWidgetHost* rwh); 273 void RenewFrameSubscription(RenderWidgetHost* rwh);
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 VLOG(1) << "Computed optimal target size: " << optimal_size.ToString(); 683 VLOG(1) << "Computed optimal target size: " << optimal_size.ToString();
683 return optimal_size; 684 return optimal_size;
684 } 685 }
685 686
686 void WebContentsCaptureMachine::DidCopyFromBackingStore( 687 void WebContentsCaptureMachine::DidCopyFromBackingStore(
687 const base::TimeTicks& start_time, 688 const base::TimeTicks& start_time,
688 const scoped_refptr<media::VideoFrame>& target, 689 const scoped_refptr<media::VideoFrame>& target,
689 const RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback& 690 const RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback&
690 deliver_frame_cb, 691 deliver_frame_cb,
691 bool success, 692 bool success,
692 const SkBitmap& bitmap) { 693 const SkBitmap& bitmap,
694 const int& response) {
693 DCHECK_CURRENTLY_ON(BrowserThread::UI); 695 DCHECK_CURRENTLY_ON(BrowserThread::UI);
694 696
695 base::TimeTicks now = base::TimeTicks::Now(); 697 base::TimeTicks now = base::TimeTicks::Now();
696 DCHECK(render_thread_.get()); 698 DCHECK(render_thread_.get());
697 if (success) { 699 if (success) {
698 UMA_HISTOGRAM_TIMES("TabCapture.CopyTimeBitmap", now - start_time); 700 UMA_HISTOGRAM_TIMES("TabCapture.CopyTimeBitmap", now - start_time);
699 TRACE_EVENT_ASYNC_STEP_INTO0("mirroring", "Capture", target.get(), 701 TRACE_EVENT_ASYNC_STEP_INTO0("mirroring", "Capture", target.get(),
700 "Render"); 702 "Render");
701 render_thread_->message_loop_proxy()->PostTask(FROM_HERE, base::Bind( 703 render_thread_->message_loop_proxy()->PostTask(FROM_HERE, base::Bind(
702 &RenderVideoFrame, bitmap, target, 704 &RenderVideoFrame, bitmap, target,
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 scoped_ptr<Client> client) { 790 scoped_ptr<Client> client) {
789 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); 791 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString();
790 core_->AllocateAndStart(params, client.Pass()); 792 core_->AllocateAndStart(params, client.Pass());
791 } 793 }
792 794
793 void WebContentsVideoCaptureDevice::StopAndDeAllocate() { 795 void WebContentsVideoCaptureDevice::StopAndDeAllocate() {
794 core_->StopAndDeAllocate(); 796 core_->StopAndDeAllocate();
795 } 797 }
796 798
797 } // namespace content 799 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698