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_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/debug/trace_event.h" | 12 #include "base/debug/trace_event.h" |
13 #include "base/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
| 15 #include "base/metrics/field_trial.h" |
15 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
16 #include "base/string_number_conversions.h" | 17 #include "base/string_number_conversions.h" |
17 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
18 #include "content/browser/gpu/gpu_process_host.h" | 19 #include "content/browser/gpu/gpu_process_host.h" |
19 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 20 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
20 #include "content/browser/gpu/gpu_surface_tracker.h" | 21 #include "content/browser/gpu/gpu_surface_tracker.h" |
21 #include "content/browser/renderer_host/backing_store.h" | 22 #include "content/browser/renderer_host/backing_store.h" |
22 #include "content/browser/renderer_host/backing_store_manager.h" | 23 #include "content/browser/renderer_host/backing_store_manager.h" |
23 #include "content/browser/renderer_host/render_process_host_impl.h" | 24 #include "content/browser/renderer_host/render_process_host_impl.h" |
24 #include "content/browser/renderer_host/render_view_host_impl.h" | 25 #include "content/browser/renderer_host/render_view_host_impl.h" |
25 #include "content/browser/renderer_host/render_widget_helper.h" | 26 #include "content/browser/renderer_host/render_widget_helper.h" |
26 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 27 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
27 #include "content/browser/renderer_host/tap_suppression_controller.h" | 28 #include "content/browser/renderer_host/tap_suppression_controller.h" |
28 #include "content/common/accessibility_messages.h" | 29 #include "content/common/accessibility_messages.h" |
29 #include "content/common/gpu/gpu_messages.h" | 30 #include "content/common/gpu/gpu_messages.h" |
30 #include "content/common/view_messages.h" | 31 #include "content/common/view_messages.h" |
31 #include "content/port/browser/render_widget_host_view_port.h" | 32 #include "content/port/browser/render_widget_host_view_port.h" |
32 #include "content/port/browser/smooth_scroll_gesture.h" | 33 #include "content/port/browser/smooth_scroll_gesture.h" |
33 #include "content/public/browser/native_web_keyboard_event.h" | 34 #include "content/public/browser/native_web_keyboard_event.h" |
34 #include "content/public/browser/notification_service.h" | 35 #include "content/public/browser/notification_service.h" |
35 #include "content/public/browser/notification_types.h" | 36 #include "content/public/browser/notification_types.h" |
36 #include "content/public/browser/user_metrics.h" | 37 #include "content/public/browser/user_metrics.h" |
| 38 #include "content/public/common/content_constants.h" |
37 #include "content/public/common/content_switches.h" | 39 #include "content/public/common/content_switches.h" |
38 #include "content/public/common/result_codes.h" | 40 #include "content/public/common/result_codes.h" |
39 #include "skia/ext/image_operations.h" | 41 #include "skia/ext/image_operations.h" |
40 #include "skia/ext/platform_canvas.h" | 42 #include "skia/ext/platform_canvas.h" |
41 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" | 43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" |
42 #if defined(OS_WIN) | 44 #if defined(OS_WIN) |
43 #include "third_party/WebKit/Source/WebKit/chromium/public/win/WebScreenInfoFact
ory.h" | 45 #include "third_party/WebKit/Source/WebKit/chromium/public/win/WebScreenInfoFact
ory.h" |
44 #endif | 46 #endif |
45 #include "ui/base/keycodes/keyboard_codes.h" | 47 #include "ui/base/keycodes/keyboard_codes.h" |
46 #include "ui/gfx/skbitmap_operations.h" | 48 #include "ui/gfx/skbitmap_operations.h" |
(...skipping 1839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1886 // static | 1888 // static |
1887 void RenderWidgetHostImpl::AcknowledgeBufferPresent( | 1889 void RenderWidgetHostImpl::AcknowledgeBufferPresent( |
1888 int32 route_id, int gpu_host_id, uint32 sync_point) { | 1890 int32 route_id, int gpu_host_id, uint32 sync_point) { |
1889 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); | 1891 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); |
1890 if (ui_shim) | 1892 if (ui_shim) |
1891 ui_shim->Send(new AcceleratedSurfaceMsg_BufferPresented(route_id, | 1893 ui_shim->Send(new AcceleratedSurfaceMsg_BufferPresented(route_id, |
1892 sync_point)); | 1894 sync_point)); |
1893 } | 1895 } |
1894 | 1896 |
1895 void RenderWidgetHostImpl::AcknowledgeSwapBuffersToRenderer() { | 1897 void RenderWidgetHostImpl::AcknowledgeSwapBuffersToRenderer() { |
1896 bool enable_threaded_compositing = | 1898 base::FieldTrial* trial = |
1897 CommandLine::ForCurrentProcess()->HasSwitch( | 1899 base::FieldTrialList::Find(content::kGpuCompositingFieldTrialName); |
1898 switches::kEnableThreadedCompositing) && | 1900 bool thread_trial = trial && trial->group_name() == |
1899 !CommandLine::ForCurrentProcess()->HasSwitch( | 1901 content::kGpuCompositingFieldTrialThreadEnabledName; |
1900 switches::kDisableThreadedCompositing); | 1902 bool enable_threaded_compositing = thread_trial || |
| 1903 (CommandLine::ForCurrentProcess()->HasSwitch( |
| 1904 switches::kEnableThreadedCompositing) && |
| 1905 !CommandLine::ForCurrentProcess()->HasSwitch( |
| 1906 switches::kDisableThreadedCompositing)); |
1901 if (!enable_threaded_compositing) | 1907 if (!enable_threaded_compositing) |
1902 Send(new ViewMsg_SwapBuffers_ACK(routing_id_)); | 1908 Send(new ViewMsg_SwapBuffers_ACK(routing_id_)); |
1903 } | 1909 } |
1904 | 1910 |
1905 void RenderWidgetHostImpl::DelayedAutoResized() { | 1911 void RenderWidgetHostImpl::DelayedAutoResized() { |
1906 gfx::Size new_size = new_auto_size_; | 1912 gfx::Size new_size = new_auto_size_; |
1907 // Clear the new_auto_size_ since the empty value is used as a flag to | 1913 // Clear the new_auto_size_ since the empty value is used as a flag to |
1908 // indicate that no callback is in progress (i.e. without this line | 1914 // indicate that no callback is in progress (i.e. without this line |
1909 // DelayedAutoResized will not get called again). | 1915 // DelayedAutoResized will not get called again). |
1910 new_auto_size_.SetSize(0, 0); | 1916 new_auto_size_.SetSize(0, 0); |
1911 if (!should_auto_resize_) | 1917 if (!should_auto_resize_) |
1912 return; | 1918 return; |
1913 | 1919 |
1914 OnRenderAutoResized(new_size); | 1920 OnRenderAutoResized(new_size); |
1915 } | 1921 } |
1916 | 1922 |
1917 } // namespace content | 1923 } // namespace content |
OLD | NEW |