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" |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "content/browser/renderer_host/tap_suppression_controller.h" | 28 #include "content/browser/renderer_host/tap_suppression_controller.h" |
29 #include "content/common/accessibility_messages.h" | 29 #include "content/common/accessibility_messages.h" |
30 #include "content/common/gpu/gpu_messages.h" | 30 #include "content/common/gpu/gpu_messages.h" |
31 #include "content/common/view_messages.h" | 31 #include "content/common/view_messages.h" |
32 #include "content/port/browser/render_widget_host_view_port.h" | 32 #include "content/port/browser/render_widget_host_view_port.h" |
33 #include "content/port/browser/smooth_scroll_gesture.h" | 33 #include "content/port/browser/smooth_scroll_gesture.h" |
34 #include "content/public/browser/native_web_keyboard_event.h" | 34 #include "content/public/browser/native_web_keyboard_event.h" |
35 #include "content/public/browser/notification_service.h" | 35 #include "content/public/browser/notification_service.h" |
36 #include "content/public/browser/notification_types.h" | 36 #include "content/public/browser/notification_types.h" |
37 #include "content/public/browser/user_metrics.h" | 37 #include "content/public/browser/user_metrics.h" |
| 38 #include "content/public/common/compositor_util.h" |
38 #include "content/public/common/content_constants.h" | 39 #include "content/public/common/content_constants.h" |
39 #include "content/public/common/content_switches.h" | 40 #include "content/public/common/content_switches.h" |
40 #include "content/public/common/result_codes.h" | 41 #include "content/public/common/result_codes.h" |
41 #include "skia/ext/image_operations.h" | 42 #include "skia/ext/image_operations.h" |
42 #include "skia/ext/platform_canvas.h" | 43 #include "skia/ext/platform_canvas.h" |
43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" | 44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" |
44 #if defined(OS_WIN) | 45 #if defined(OS_WIN) |
45 #include "third_party/WebKit/Source/WebKit/chromium/public/win/WebScreenInfoFact
ory.h" | 46 #include "third_party/WebKit/Source/WebKit/chromium/public/win/WebScreenInfoFact
ory.h" |
46 #endif | 47 #endif |
47 #include "ui/base/keycodes/keyboard_codes.h" | 48 #include "ui/base/keycodes/keyboard_codes.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 // would be a layering violation. Since we don't expect more than a few | 165 // would be a layering violation. Since we don't expect more than a few |
165 // hundreds of RWH, this seems acceptable. Revisit if performance become a | 166 // hundreds of RWH, this seems acceptable. Revisit if performance become a |
166 // problem, for example by tracking in the RenderWidgetHelper the routing id | 167 // problem, for example by tracking in the RenderWidgetHelper the routing id |
167 // (and surface id) that have been created, but whose RWH haven't yet. | 168 // (and surface id) that have been created, but whose RWH haven't yet. |
168 surface_id_ = GpuSurfaceTracker::Get()->LookupSurfaceForRenderer( | 169 surface_id_ = GpuSurfaceTracker::Get()->LookupSurfaceForRenderer( |
169 process_->GetID(), | 170 process_->GetID(), |
170 routing_id_); | 171 routing_id_); |
171 DCHECK(surface_id_); | 172 DCHECK(surface_id_); |
172 } | 173 } |
173 | 174 |
| 175 is_threaded_compositing_enabled_ = IsThreadedCompositingEnabled(); |
| 176 |
174 process_->Attach(this, routing_id_); | 177 process_->Attach(this, routing_id_); |
175 // Because the widget initializes as is_hidden_ == false, | 178 // Because the widget initializes as is_hidden_ == false, |
176 // tell the process host that we're alive. | 179 // tell the process host that we're alive. |
177 process_->WidgetRestored(); | 180 process_->WidgetRestored(); |
178 } | 181 } |
179 | 182 |
180 RenderWidgetHostImpl::~RenderWidgetHostImpl() { | 183 RenderWidgetHostImpl::~RenderWidgetHostImpl() { |
181 SetView(NULL); | 184 SetView(NULL); |
182 | 185 |
183 // Clear our current or cached backing store if either remains. | 186 // Clear our current or cached backing store if either remains. |
(...skipping 1707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1891 // static | 1894 // static |
1892 void RenderWidgetHostImpl::AcknowledgeBufferPresent( | 1895 void RenderWidgetHostImpl::AcknowledgeBufferPresent( |
1893 int32 route_id, int gpu_host_id, uint32 sync_point) { | 1896 int32 route_id, int gpu_host_id, uint32 sync_point) { |
1894 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); | 1897 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); |
1895 if (ui_shim) | 1898 if (ui_shim) |
1896 ui_shim->Send(new AcceleratedSurfaceMsg_BufferPresented(route_id, | 1899 ui_shim->Send(new AcceleratedSurfaceMsg_BufferPresented(route_id, |
1897 sync_point)); | 1900 sync_point)); |
1898 } | 1901 } |
1899 | 1902 |
1900 void RenderWidgetHostImpl::AcknowledgeSwapBuffersToRenderer() { | 1903 void RenderWidgetHostImpl::AcknowledgeSwapBuffersToRenderer() { |
1901 base::FieldTrial* trial = | 1904 if (!is_threaded_compositing_enabled_) |
1902 base::FieldTrialList::Find(content::kGpuCompositingFieldTrialName); | |
1903 bool is_thread_trial = trial && trial->group_name() == | |
1904 content::kGpuCompositingFieldTrialThreadEnabledName; | |
1905 bool has_enable = CommandLine::ForCurrentProcess()->HasSwitch( | |
1906 switches::kEnableThreadedCompositing); | |
1907 bool has_disable = CommandLine::ForCurrentProcess()->HasSwitch( | |
1908 switches::kDisableThreadedCompositing); | |
1909 DCHECK(!is_thread_trial || !has_disable); | |
1910 bool enable_threaded_compositing = | |
1911 is_thread_trial || (has_enable && !has_disable); | |
1912 if (!enable_threaded_compositing) | |
1913 Send(new ViewMsg_SwapBuffers_ACK(routing_id_)); | 1905 Send(new ViewMsg_SwapBuffers_ACK(routing_id_)); |
1914 } | 1906 } |
1915 | 1907 |
1916 #if defined(USE_AURA) | 1908 #if defined(USE_AURA) |
1917 // static | 1909 // static |
1918 void RenderWidgetHostImpl::SendFrontSurfaceIsProtected( | 1910 void RenderWidgetHostImpl::SendFrontSurfaceIsProtected( |
1919 bool is_protected, | 1911 bool is_protected, |
1920 uint32 protection_state_id, | 1912 uint32 protection_state_id, |
1921 int32 route_id, | 1913 int32 route_id, |
1922 int gpu_host_id) { | 1914 int gpu_host_id) { |
(...skipping 11 matching lines...) Expand all Loading... |
1934 // indicate that no callback is in progress (i.e. without this line | 1926 // indicate that no callback is in progress (i.e. without this line |
1935 // DelayedAutoResized will not get called again). | 1927 // DelayedAutoResized will not get called again). |
1936 new_auto_size_.SetSize(0, 0); | 1928 new_auto_size_.SetSize(0, 0); |
1937 if (!should_auto_resize_) | 1929 if (!should_auto_resize_) |
1938 return; | 1930 return; |
1939 | 1931 |
1940 OnRenderAutoResized(new_size); | 1932 OnRenderAutoResized(new_size); |
1941 } | 1933 } |
1942 | 1934 |
1943 } // namespace content | 1935 } // namespace content |
OLD | NEW |