| 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 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1217 | 1217 |
| 1218 void RenderWidgetHostViewAura::CopyFromCompositingSurfaceToVideoFrame( | 1218 void RenderWidgetHostViewAura::CopyFromCompositingSurfaceToVideoFrame( |
| 1219 const gfx::Rect& src_subrect, | 1219 const gfx::Rect& src_subrect, |
| 1220 const scoped_refptr<media::VideoFrame>& target, | 1220 const scoped_refptr<media::VideoFrame>& target, |
| 1221 const base::Callback<void(bool)>& callback) { | 1221 const base::Callback<void(bool)>& callback) { |
| 1222 if (!window_->layer()->has_external_content()) { | 1222 if (!window_->layer()->has_external_content()) { |
| 1223 callback.Run(false); | 1223 callback.Run(false); |
| 1224 return; | 1224 return; |
| 1225 } | 1225 } |
| 1226 | 1226 |
| 1227 LOG(INFO) << "SEND Frame to CopyOutputRequest"; |
| 1227 scoped_ptr<cc::CopyOutputRequest> request = | 1228 scoped_ptr<cc::CopyOutputRequest> request = |
| 1228 cc::CopyOutputRequest::CreateRequest(base::Bind( | 1229 cc::CopyOutputRequest::CreateRequest(base::Bind( |
| 1229 &RenderWidgetHostViewAura:: | 1230 &RenderWidgetHostViewAura:: |
| 1230 CopyFromCompositingSurfaceHasResultForVideo, | 1231 CopyFromCompositingSurfaceHasResultForVideo, |
| 1231 AsWeakPtr(), // For caching the ReadbackYUVInterface on this class. | 1232 AsWeakPtr(), // For caching the ReadbackYUVInterface on this class. |
| 1232 target, | 1233 target, |
| 1233 callback)); | 1234 callback)); |
| 1234 gfx::Rect src_subrect_in_pixel = | 1235 gfx::Rect src_subrect_in_pixel = |
| 1235 ConvertRectToPixel(current_device_scale_factor_, src_subrect); | 1236 ConvertRectToPixel(current_device_scale_factor_, src_subrect); |
| 1236 request->set_area(src_subrect_in_pixel); | 1237 request->set_area(src_subrect_in_pixel); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1368 const base::Time present_time = base::Time::Now(); | 1369 const base::Time present_time = base::Time::Now(); |
| 1369 scoped_refptr<media::VideoFrame> frame; | 1370 scoped_refptr<media::VideoFrame> frame; |
| 1370 RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback callback; | 1371 RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback callback; |
| 1371 if (frame_subscriber()->ShouldCaptureFrame(present_time, | 1372 if (frame_subscriber()->ShouldCaptureFrame(present_time, |
| 1372 &frame, &callback)) { | 1373 &frame, &callback)) { |
| 1373 CopyFromCompositingSurfaceToVideoFrame( | 1374 CopyFromCompositingSurfaceToVideoFrame( |
| 1374 gfx::Rect(ConvertSizeToDIP(current_surface_->device_scale_factor(), | 1375 gfx::Rect(ConvertSizeToDIP(current_surface_->device_scale_factor(), |
| 1375 current_surface_->size())), | 1376 current_surface_->size())), |
| 1376 frame, | 1377 frame, |
| 1377 base::Bind(callback, present_time)); | 1378 base::Bind(callback, present_time)); |
| 1379 LOG(INFO) << "SEND Frame to CopyFromCompositingSurfaceToVideoFrame"; |
| 1378 } | 1380 } |
| 1379 } | 1381 } |
| 1380 | 1382 |
| 1381 if (!compositor) { | 1383 if (!compositor) { |
| 1382 ack_callback.Run(false, texture_to_return); | 1384 ack_callback.Run(false, texture_to_return); |
| 1383 } else { | 1385 } else { |
| 1384 AddOnCommitCallbackAndDisableLocks( | 1386 AddOnCommitCallbackAndDisableLocks( |
| 1385 base::Bind(ack_callback, false, texture_to_return)); | 1387 base::Bind(ack_callback, false, texture_to_return)); |
| 1386 } | 1388 } |
| 1387 } | 1389 } |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1844 } | 1846 } |
| 1845 | 1847 |
| 1846 // static | 1848 // static |
| 1847 void RenderWidgetHostViewAura::CopyFromCompositingSurfaceHasResultForVideo( | 1849 void RenderWidgetHostViewAura::CopyFromCompositingSurfaceHasResultForVideo( |
| 1848 base::WeakPtr<RenderWidgetHostViewAura> rwhva, | 1850 base::WeakPtr<RenderWidgetHostViewAura> rwhva, |
| 1849 scoped_refptr<media::VideoFrame> video_frame, | 1851 scoped_refptr<media::VideoFrame> video_frame, |
| 1850 const base::Callback<void(bool)>& callback, | 1852 const base::Callback<void(bool)>& callback, |
| 1851 scoped_ptr<cc::CopyOutputResult> result) { | 1853 scoped_ptr<cc::CopyOutputResult> result) { |
| 1852 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); | 1854 base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); |
| 1853 | 1855 |
| 1856 LOG(INFO) << "CopyFromCompositingSurfaceHasResultForVideo"; |
| 1857 |
| 1854 if (!rwhva) | 1858 if (!rwhva) |
| 1855 return; | 1859 return; |
| 1856 | 1860 |
| 1857 if (result->IsEmpty()) | 1861 if (result->IsEmpty()) |
| 1858 return; | 1862 return; |
| 1859 if (result->size().IsEmpty()) | 1863 if (result->size().IsEmpty()) |
| 1860 return; | 1864 return; |
| 1861 | 1865 |
| 1862 // Compute the dest size we want after the letterboxing resize. Make the | 1866 // Compute the dest size we want after the letterboxing resize. Make the |
| 1863 // coordinates and sizes even because we letterbox in YUV space | 1867 // coordinates and sizes even because we letterbox in YUV space |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1923 true, | 1927 true, |
| 1924 false)); | 1928 false)); |
| 1925 yuv_readback_pipeline = rwhva->yuv_readback_pipeline_.get(); | 1929 yuv_readback_pipeline = rwhva->yuv_readback_pipeline_.get(); |
| 1926 } | 1930 } |
| 1927 | 1931 |
| 1928 scoped_callback_runner.Release(); | 1932 scoped_callback_runner.Release(); |
| 1929 base::Callback<void(bool result)> finished_callback = base::Bind( | 1933 base::Callback<void(bool result)> finished_callback = base::Bind( |
| 1930 &CopyFromCompositingSurfaceFinishedForVideo, | 1934 &CopyFromCompositingSurfaceFinishedForVideo, |
| 1931 callback, | 1935 callback, |
| 1932 texture_mailbox->callback()); | 1936 texture_mailbox->callback()); |
| 1937 LOG(INFO) << "Pass video frame to Readback YUV"; |
| 1933 yuv_readback_pipeline->ReadbackYUV( | 1938 yuv_readback_pipeline->ReadbackYUV( |
| 1934 texture_mailbox->name(), | 1939 texture_mailbox->name(), |
| 1935 texture_mailbox->sync_point(), | 1940 texture_mailbox->sync_point(), |
| 1936 video_frame.get(), | 1941 video_frame.get(), |
| 1937 finished_callback); | 1942 finished_callback); |
| 1943 LOG(INFO) << "Done with it here."; |
| 1938 } | 1944 } |
| 1939 | 1945 |
| 1940 void RenderWidgetHostViewAura::GetScreenInfo(WebScreenInfo* results) { | 1946 void RenderWidgetHostViewAura::GetScreenInfo(WebScreenInfo* results) { |
| 1941 GetScreenInfoForWindow(results, window_->GetRootWindow() ? window_ : NULL); | 1947 GetScreenInfoForWindow(results, window_->GetRootWindow() ? window_ : NULL); |
| 1942 } | 1948 } |
| 1943 | 1949 |
| 1944 gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() { | 1950 gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() { |
| 1945 return window_->GetToplevelWindow()->GetBoundsInScreen(); | 1951 return window_->GetToplevelWindow()->GetBoundsInScreen(); |
| 1946 } | 1952 } |
| 1947 | 1953 |
| (...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3170 RenderWidgetHost* widget) { | 3176 RenderWidgetHost* widget) { |
| 3171 return new RenderWidgetHostViewAura(widget); | 3177 return new RenderWidgetHostViewAura(widget); |
| 3172 } | 3178 } |
| 3173 | 3179 |
| 3174 // static | 3180 // static |
| 3175 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3181 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 3176 GetScreenInfoForWindow(results, NULL); | 3182 GetScreenInfoForWindow(results, NULL); |
| 3177 } | 3183 } |
| 3178 | 3184 |
| 3179 } // namespace content | 3185 } // namespace content |
| OLD | NEW |