| 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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 base::Bind(&WebContentsCaptureMachine:: | 664 base::Bind(&WebContentsCaptureMachine:: |
| 665 DidCopyFromCompositingSurfaceToVideoFrame, | 665 DidCopyFromCompositingSurfaceToVideoFrame, |
| 666 weak_ptr_factory_.GetWeakPtr(), | 666 weak_ptr_factory_.GetWeakPtr(), |
| 667 start_time, deliver_frame_cb)); | 667 start_time, deliver_frame_cb)); |
| 668 } else { | 668 } else { |
| 669 rwh->CopyFromBackingStore( | 669 rwh->CopyFromBackingStore( |
| 670 gfx::Rect(), | 670 gfx::Rect(), |
| 671 fitted_size, // Size here is a request not always honored. | 671 fitted_size, // Size here is a request not always honored. |
| 672 base::Bind(&WebContentsCaptureMachine::DidCopyFromBackingStore, | 672 base::Bind(&WebContentsCaptureMachine::DidCopyFromBackingStore, |
| 673 weak_ptr_factory_.GetWeakPtr(), | 673 weak_ptr_factory_.GetWeakPtr(), |
| 674 start_time, target, deliver_frame_cb)); | 674 start_time, |
| 675 target, |
| 676 deliver_frame_cb), |
| 677 SkBitmap::kARGB_8888_Config); |
| 675 } | 678 } |
| 676 } | 679 } |
| 677 | 680 |
| 678 bool WebContentsCaptureMachine::StartObservingWebContents() { | 681 bool WebContentsCaptureMachine::StartObservingWebContents() { |
| 679 // Look-up the RenderViewHost and, from that, the WebContents that wraps it. | 682 // Look-up the RenderViewHost and, from that, the WebContents that wraps it. |
| 680 // If successful, begin observing the WebContents instance. | 683 // If successful, begin observing the WebContents instance. |
| 681 // | 684 // |
| 682 // Why this can be unsuccessful: The request for mirroring originates in a | 685 // Why this can be unsuccessful: The request for mirroring originates in a |
| 683 // render process, and this request is based on the current RenderView | 686 // render process, and this request is based on the current RenderView |
| 684 // associated with a tab. However, by the time we get up-and-running here, | 687 // associated with a tab. However, by the time we get up-and-running here, |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 scoped_ptr<Client> client) { | 821 scoped_ptr<Client> client) { |
| 819 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); | 822 DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); |
| 820 core_->AllocateAndStart(params, client.Pass()); | 823 core_->AllocateAndStart(params, client.Pass()); |
| 821 } | 824 } |
| 822 | 825 |
| 823 void WebContentsVideoCaptureDevice::StopAndDeAllocate() { | 826 void WebContentsVideoCaptureDevice::StopAndDeAllocate() { |
| 824 core_->StopAndDeAllocate(); | 827 core_->StopAndDeAllocate(); |
| 825 } | 828 } |
| 826 | 829 |
| 827 } // namespace content | 830 } // namespace content |
| OLD | NEW |