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" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
14 #include "cc/compositor_frame.h" | |
15 #include "cc/switches.h" | |
14 #include "content/browser/renderer_host/backing_store_aura.h" | 16 #include "content/browser/renderer_host/backing_store_aura.h" |
15 #include "content/browser/renderer_host/dip_util.h" | 17 #include "content/browser/renderer_host/dip_util.h" |
16 #include "content/browser/renderer_host/overscroll_controller.h" | 18 #include "content/browser/renderer_host/overscroll_controller.h" |
17 #include "content/browser/renderer_host/render_view_host_delegate.h" | 19 #include "content/browser/renderer_host/render_view_host_delegate.h" |
18 #include "content/browser/renderer_host/render_widget_host_impl.h" | 20 #include "content/browser/renderer_host/render_widget_host_impl.h" |
19 #include "content/browser/renderer_host/ui_events_helper.h" | 21 #include "content/browser/renderer_host/ui_events_helper.h" |
20 #include "content/browser/renderer_host/web_input_event_aura.h" | 22 #include "content/browser/renderer_host/web_input_event_aura.h" |
21 #include "content/common/gpu/client/gl_helper.h" | 23 #include "content/common/gpu/client/gl_helper.h" |
22 #include "content/common/gpu/gpu_messages.h" | 24 #include "content/common/gpu/gpu_messages.h" |
23 #include "content/common/view_messages.h" | 25 #include "content/common/view_messages.h" |
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
871 on_compositing_did_commit_callbacks_.push_back( | 873 on_compositing_did_commit_callbacks_.push_back( |
872 base::Bind(&RenderWidgetHostViewAura::InsertSyncPointAndACK, params)); | 874 base::Bind(&RenderWidgetHostViewAura::InsertSyncPointAndACK, params)); |
873 if (!compositor->HasObserver(this)) | 875 if (!compositor->HasObserver(this)) |
874 compositor->AddObserver(this); | 876 compositor->AddObserver(this); |
875 } | 877 } |
876 } | 878 } |
877 | 879 |
878 void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( | 880 void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( |
879 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params_in_pixel, | 881 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params_in_pixel, |
880 int gpu_host_id) { | 882 int gpu_host_id) { |
881 const gfx::Rect surface_rect = gfx::Rect(gfx::Point(), params_in_pixel.size); | 883 BuffersSwapped(params_in_pixel.size, params_in_pixel.mailbox_name, |
882 BufferPresentedParams ack_params(params_in_pixel.route_id, gpu_host_id); | 884 params_in_pixel.route_id, gpu_host_id); |
885 } | |
886 | |
887 void RenderWidgetHostViewAura::OnSwapCompositorFrame( | |
888 const cc::CompositorFrame& frame, int render_host_id, int route_id) { | |
889 static bool composite_to_mailbox = | |
890 CommandLine::ForCurrentProcess()->HasSwitch( | |
891 cc::switches::kCompositeToMailbox); | |
piman
2013/01/18 02:14:11
Do we need to test the command line here? Should w
no sievers
2013/02/06 23:36:00
Done.
| |
892 if (!composite_to_mailbox) | |
893 return; | |
894 | |
895 DCHECK(!frame.gl_frame_data->size.IsEmpty()); | |
896 DCHECK(!frame.gl_frame_data->mailbox.isZero()); | |
897 DCHECK(frame.gl_frame_data->sync_point); | |
898 | |
899 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | |
900 factory->WaitSyncPoint(frame.gl_frame_data->sync_point); | |
901 | |
902 std::string mailbox_name; | |
903 mailbox_name.assign( | |
piman
2013/01/18 02:14:11
nit: you can just use the constructor with the sam
no sievers
2013/02/06 23:36:00
Done.
| |
904 reinterpret_cast<const char*>(frame.gl_frame_data->mailbox.name), | |
905 sizeof(frame.gl_frame_data->mailbox.name)); | |
906 BuffersSwapped(frame.gl_frame_data->size, | |
907 mailbox_name, | |
908 route_id, | |
909 render_host_id); | |
910 } | |
911 | |
912 void RenderWidgetHostViewAura::BuffersSwapped( | |
913 const gfx::Size& size, | |
914 const std::string& mailbox_name, | |
915 int route_id, | |
916 int host_id) { | |
917 const gfx::Rect surface_rect = gfx::Rect(gfx::Point(), size); | |
918 BufferPresentedParams ack_params(route_id, host_id); | |
883 if (!SwapBuffersPrepare( | 919 if (!SwapBuffersPrepare( |
884 surface_rect, surface_rect, params_in_pixel.mailbox_name, &ack_params)) | 920 surface_rect, surface_rect, mailbox_name, &ack_params)) |
885 return; | 921 return; |
886 | 922 |
887 previous_damage_.setRect(RectToSkIRect(surface_rect)); | 923 previous_damage_.setRect(RectToSkIRect(surface_rect)); |
888 skipped_damage_.setEmpty(); | 924 skipped_damage_.setEmpty(); |
889 | 925 |
890 ui::Compositor* compositor = GetCompositor(); | 926 ui::Compositor* compositor = GetCompositor(); |
891 if (compositor) { | 927 if (compositor) { |
892 gfx::Size surface_size = ConvertSizeToDIP(this, params_in_pixel.size); | 928 gfx::Size surface_size = ConvertSizeToDIP(this, size); |
893 window_->SchedulePaintInRect(gfx::Rect(surface_size)); | 929 window_->SchedulePaintInRect(gfx::Rect(surface_size)); |
894 } | 930 } |
895 | 931 |
896 SwapBuffersCompleted(ack_params); | 932 SwapBuffersCompleted(ack_params); |
897 } | 933 } |
898 | 934 |
899 void RenderWidgetHostViewAura::AcceleratedSurfacePostSubBuffer( | 935 void RenderWidgetHostViewAura::AcceleratedSurfacePostSubBuffer( |
900 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params_in_pixel, | 936 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params_in_pixel, |
901 int gpu_host_id) { | 937 int gpu_host_id) { |
902 const gfx::Rect surface_rect = | 938 const gfx::Rect surface_rect = |
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1989 RenderWidgetHost* widget) { | 2025 RenderWidgetHost* widget) { |
1990 return new RenderWidgetHostViewAura(widget); | 2026 return new RenderWidgetHostViewAura(widget); |
1991 } | 2027 } |
1992 | 2028 |
1993 // static | 2029 // static |
1994 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 2030 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
1995 GetScreenInfoForWindow(results, NULL); | 2031 GetScreenInfoForWindow(results, NULL); |
1996 } | 2032 } |
1997 | 2033 |
1998 } // namespace content | 2034 } // namespace content |
OLD | NEW |