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

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

Issue 1170623003: Revert "content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 // is obtained. 46 // is obtained.
47 // 47 //
48 // Turning on verbose logging will cause the effective frame rate to be logged 48 // Turning on verbose logging will cause the effective frame rate to be logged
49 // at 5-second intervals. 49 // at 5-second intervals.
50 50
51 #include "content/browser/media/capture/web_contents_video_capture_device.h" 51 #include "content/browser/media/capture/web_contents_video_capture_device.h"
52 52
53 #include "base/basictypes.h" 53 #include "base/basictypes.h"
54 #include "base/bind.h" 54 #include "base/bind.h"
55 #include "base/callback_helpers.h" 55 #include "base/callback_helpers.h"
56 #include "base/location.h"
57 #include "base/logging.h" 56 #include "base/logging.h"
58 #include "base/memory/scoped_ptr.h" 57 #include "base/memory/scoped_ptr.h"
59 #include "base/memory/weak_ptr.h" 58 #include "base/memory/weak_ptr.h"
59 #include "base/message_loop/message_loop_proxy.h"
60 #include "base/metrics/histogram.h" 60 #include "base/metrics/histogram.h"
61 #include "base/sequenced_task_runner.h" 61 #include "base/sequenced_task_runner.h"
62 #include "base/single_thread_task_runner.h"
63 #include "base/threading/thread.h" 62 #include "base/threading/thread.h"
64 #include "base/threading/thread_checker.h" 63 #include "base/threading/thread_checker.h"
65 #include "base/time/time.h" 64 #include "base/time/time.h"
66 #include "content/browser/media/capture/content_video_capture_device_core.h" 65 #include "content/browser/media/capture/content_video_capture_device_core.h"
67 #include "content/browser/media/capture/video_capture_oracle.h" 66 #include "content/browser/media/capture/video_capture_oracle.h"
68 #include "content/browser/media/capture/web_contents_capture_util.h" 67 #include "content/browser/media/capture/web_contents_capture_util.h"
69 #include "content/browser/media/capture/web_contents_tracker.h" 68 #include "content/browser/media/capture/web_contents_tracker.h"
70 #include "content/browser/renderer_host/render_widget_host_impl.h" 69 #include "content/browser/renderer_host/render_widget_host_impl.h"
71 #include "content/browser/renderer_host/render_widget_host_view_base.h" 70 #include "content/browser/renderer_host/render_widget_host_view_base.h"
72 #include "content/public/browser/browser_thread.h" 71 #include "content/public/browser/browser_thread.h"
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 const SkBitmap& bitmap, 626 const SkBitmap& bitmap,
628 ReadbackResponse response) { 627 ReadbackResponse response) {
629 DCHECK_CURRENTLY_ON(BrowserThread::UI); 628 DCHECK_CURRENTLY_ON(BrowserThread::UI);
630 629
631 base::TimeTicks now = base::TimeTicks::Now(); 630 base::TimeTicks now = base::TimeTicks::Now();
632 DCHECK(render_thread_.get()); 631 DCHECK(render_thread_.get());
633 if (response == READBACK_SUCCESS) { 632 if (response == READBACK_SUCCESS) {
634 UMA_HISTOGRAM_TIMES("TabCapture.CopyTimeBitmap", now - start_time); 633 UMA_HISTOGRAM_TIMES("TabCapture.CopyTimeBitmap", now - start_time);
635 TRACE_EVENT_ASYNC_STEP_INTO0("gpu.capture", "Capture", target.get(), 634 TRACE_EVENT_ASYNC_STEP_INTO0("gpu.capture", "Capture", target.get(),
636 "Render"); 635 "Render");
637 render_thread_->task_runner()->PostTask( 636 render_thread_->message_loop_proxy()->PostTask(FROM_HERE, base::Bind(
638 FROM_HERE, base::Bind(&RenderVideoFrame, bitmap, target, 637 &RenderVideoFrame, bitmap, target,
639 base::Bind(deliver_frame_cb, start_time))); 638 base::Bind(deliver_frame_cb, start_time)));
640 } else { 639 } else {
641 // Capture can fail due to transient issues, so just skip this frame. 640 // Capture can fail due to transient issues, so just skip this frame.
642 DVLOG(1) << "CopyFromBackingStore failed; skipping frame."; 641 DVLOG(1) << "CopyFromBackingStore failed; skipping frame.";
643 deliver_frame_cb.Run(start_time, false); 642 deliver_frame_cb.Run(start_time, false);
644 } 643 }
645 } 644 }
646 645
647 void WebContentsCaptureMachine::DidCopyFromCompositingSurfaceToVideoFrame( 646 void WebContentsCaptureMachine::DidCopyFromCompositingSurfaceToVideoFrame(
648 const base::TimeTicks& start_time, 647 const base::TimeTicks& start_time,
649 const RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback& 648 const RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback&
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 scoped_ptr<Client> client) { 738 scoped_ptr<Client> client) {
740 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); 739 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString();
741 core_->AllocateAndStart(params, client.Pass()); 740 core_->AllocateAndStart(params, client.Pass());
742 } 741 }
743 742
744 void WebContentsVideoCaptureDevice::StopAndDeAllocate() { 743 void WebContentsVideoCaptureDevice::StopAndDeAllocate() {
745 core_->StopAndDeAllocate(); 744 core_->StopAndDeAllocate();
746 } 745 }
747 746
748 } // namespace content 747 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698