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