OLD | NEW |
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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 virtual void AboutToNavigateRenderView(RenderViewHost* rvh) OVERRIDE { | 262 virtual void AboutToNavigateRenderView(RenderViewHost* rvh) OVERRIDE { |
263 RenewFrameSubscription(); | 263 RenewFrameSubscription(); |
264 } | 264 } |
265 | 265 |
266 virtual void DidNavigateMainFrame( | 266 virtual void DidNavigateMainFrame( |
267 const LoadCommittedDetails& details, | 267 const LoadCommittedDetails& details, |
268 const FrameNavigateParams& params) OVERRIDE { | 268 const FrameNavigateParams& params) OVERRIDE { |
269 RenewFrameSubscription(); | 269 RenewFrameSubscription(); |
270 } | 270 } |
271 | 271 |
272 virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE; | 272 virtual void WebContentsDestroyed() OVERRIDE; |
273 | 273 |
274 private: | 274 private: |
275 // Starts observing the web contents, returning false if lookup fails. | 275 // Starts observing the web contents, returning false if lookup fails. |
276 bool StartObservingWebContents(); | 276 bool StartObservingWebContents(); |
277 | 277 |
278 // Helper function to determine the view that we are currently tracking. | 278 // Helper function to determine the view that we are currently tracking. |
279 RenderWidgetHost* GetTarget(); | 279 RenderWidgetHost* GetTarget(); |
280 | 280 |
281 // Response callback for RenderWidgetHost::CopyFromBackingStore(). | 281 // Response callback for RenderWidgetHost::CopyFromBackingStore(). |
282 void DidCopyFromBackingStore( | 282 void DidCopyFromBackingStore( |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 contents->IncrementCapturerCount(oracle_proxy_->GetCaptureSize()); | 695 contents->IncrementCapturerCount(oracle_proxy_->GetCaptureSize()); |
696 fullscreen_widget_id_ = contents->GetFullscreenWidgetRoutingID(); | 696 fullscreen_widget_id_ = contents->GetFullscreenWidgetRoutingID(); |
697 RenewFrameSubscription(); | 697 RenewFrameSubscription(); |
698 return true; | 698 return true; |
699 } | 699 } |
700 | 700 |
701 DVLOG(1) << "WebContents::FromRenderViewHost(" << rvh << ") returned NULL."; | 701 DVLOG(1) << "WebContents::FromRenderViewHost(" << rvh << ") returned NULL."; |
702 return false; | 702 return false; |
703 } | 703 } |
704 | 704 |
705 void WebContentsCaptureMachine::WebContentsDestroyed( | 705 void WebContentsCaptureMachine::WebContentsDestroyed() { |
706 WebContents* web_contents) { | |
707 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 706 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
708 | 707 |
709 subscription_.reset(); | 708 subscription_.reset(); |
710 web_contents->DecrementCapturerCount(); | 709 web_contents()->DecrementCapturerCount(); |
711 oracle_proxy_->ReportError("WebContentsDestroyed()"); | 710 oracle_proxy_->ReportError("WebContentsDestroyed()"); |
712 } | 711 } |
713 | 712 |
714 RenderWidgetHost* WebContentsCaptureMachine::GetTarget() { | 713 RenderWidgetHost* WebContentsCaptureMachine::GetTarget() { |
715 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 714 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
716 if (!web_contents()) | 715 if (!web_contents()) |
717 return NULL; | 716 return NULL; |
718 | 717 |
719 RenderWidgetHost* rwh = NULL; | 718 RenderWidgetHost* rwh = NULL; |
720 if (fullscreen_widget_id_ != MSG_ROUTING_NONE) { | 719 if (fullscreen_widget_id_ != MSG_ROUTING_NONE) { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 scoped_ptr<Client> client) { | 814 scoped_ptr<Client> client) { |
816 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); | 815 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); |
817 core_->AllocateAndStart(params, client.Pass()); | 816 core_->AllocateAndStart(params, client.Pass()); |
818 } | 817 } |
819 | 818 |
820 void WebContentsVideoCaptureDevice::StopAndDeAllocate() { | 819 void WebContentsVideoCaptureDevice::StopAndDeAllocate() { |
821 core_->StopAndDeAllocate(); | 820 core_->StopAndDeAllocate(); |
822 } | 821 } |
823 | 822 |
824 } // namespace content | 823 } // namespace content |
OLD | NEW |