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 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 | 755 |
756 DVLOG(1) << "Renewing frame subscription to RWH@" << rwh | 756 DVLOG(1) << "Renewing frame subscription to RWH@" << rwh |
757 << ", had_subscription=" << had_subscription; | 757 << ", had_subscription=" << had_subscription; |
758 | 758 |
759 if (!rwh) { | 759 if (!rwh) { |
760 if (had_subscription && tracker_->web_contents()) | 760 if (had_subscription && tracker_->web_contents()) |
761 tracker_->web_contents()->DecrementCapturerCount(); | 761 tracker_->web_contents()->DecrementCapturerCount(); |
762 if (IsStarted()) { | 762 if (IsStarted()) { |
763 // Tracking of WebContents and/or its main frame has failed before Stop() | 763 // Tracking of WebContents and/or its main frame has failed before Stop() |
764 // was called, so report this as an error: | 764 // was called, so report this as an error: |
765 oracle_proxy_->ReportError("WebContents and/or main frame are gone."); | 765 oracle_proxy_->ReportError(FROM_HERE, |
| 766 "WebContents and/or main frame are gone."); |
766 } | 767 } |
767 return; | 768 return; |
768 } | 769 } |
769 | 770 |
770 if (!had_subscription && tracker_->web_contents()) | 771 if (!had_subscription && tracker_->web_contents()) |
771 tracker_->web_contents()->IncrementCapturerCount(ComputeOptimalViewSize()); | 772 tracker_->web_contents()->IncrementCapturerCount(ComputeOptimalViewSize()); |
772 | 773 |
773 subscription_.reset(new ContentCaptureSubscription(*rwh, oracle_proxy_, | 774 subscription_.reset(new ContentCaptureSubscription(*rwh, oracle_proxy_, |
774 base::Bind(&WebContentsCaptureMachine::Capture, | 775 base::Bind(&WebContentsCaptureMachine::Capture, |
775 weak_ptr_factory_.GetWeakPtr()))); | 776 weak_ptr_factory_.GetWeakPtr()))); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 scoped_ptr<Client> client) { | 837 scoped_ptr<Client> client) { |
837 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); | 838 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); |
838 core_->AllocateAndStart(params, client.Pass()); | 839 core_->AllocateAndStart(params, client.Pass()); |
839 } | 840 } |
840 | 841 |
841 void WebContentsVideoCaptureDevice::StopAndDeAllocate() { | 842 void WebContentsVideoCaptureDevice::StopAndDeAllocate() { |
842 core_->StopAndDeAllocate(); | 843 core_->StopAndDeAllocate(); |
843 } | 844 } |
844 | 845 |
845 } // namespace content | 846 } // namespace content |
OLD | NEW |