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 153 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 | 164 // 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 | 165 // hundreds of RWH, this seems acceptable. Revisit if performance become a |
166 // problem, for example by tracking in the RenderWidgetHelper the routing id | 166 // 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. | 167 // (and surface id) that have been created, but whose RWH haven't yet. |
168 surface_id_ = GpuSurfaceTracker::Get()->LookupSurfaceForRenderer( | 168 surface_id_ = GpuSurfaceTracker::Get()->LookupSurfaceForRenderer( |
169 process_->GetID(), | 169 process_->GetID(), |
170 routing_id_); | 170 routing_id_); |
171 DCHECK(surface_id_); | 171 DCHECK(surface_id_); |
172 } | 172 } |
173 | 173 |
174 base::FieldTrial* compositing_trial = | |
175 base::FieldTrialList::Find(content::kGpuCompositingFieldTrialName); | |
176 bool is_thread_trial = compositing_trial && | |
177 compositing_trial->group_name() == | |
178 content::kGpuCompositingFieldTrialThreadEnabledName; | |
179 bool has_enable = CommandLine::ForCurrentProcess()->HasSwitch( | |
180 switches::kEnableThreadedCompositing); | |
181 bool has_disable = CommandLine::ForCurrentProcess()->HasSwitch( | |
182 switches::kDisableThreadedCompositing); | |
183 DCHECK(!is_thread_trial || !has_disable); | |
184 is_threaded_compositing_enabled_ = | |
darin (slow to review)
2012/08/03 21:16:06
nit: place the above code into a static helper fun
| |
185 is_thread_trial || (has_enable && !has_disable); | |
186 | |
174 process_->Attach(this, routing_id_); | 187 process_->Attach(this, routing_id_); |
175 // Because the widget initializes as is_hidden_ == false, | 188 // Because the widget initializes as is_hidden_ == false, |
176 // tell the process host that we're alive. | 189 // tell the process host that we're alive. |
177 process_->WidgetRestored(); | 190 process_->WidgetRestored(); |
178 } | 191 } |
179 | 192 |
180 RenderWidgetHostImpl::~RenderWidgetHostImpl() { | 193 RenderWidgetHostImpl::~RenderWidgetHostImpl() { |
181 SetView(NULL); | 194 SetView(NULL); |
182 | 195 |
183 // Clear our current or cached backing store if either remains. | 196 // 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 | 1904 // static |
1892 void RenderWidgetHostImpl::AcknowledgeBufferPresent( | 1905 void RenderWidgetHostImpl::AcknowledgeBufferPresent( |
1893 int32 route_id, int gpu_host_id, uint32 sync_point) { | 1906 int32 route_id, int gpu_host_id, uint32 sync_point) { |
1894 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); | 1907 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); |
1895 if (ui_shim) | 1908 if (ui_shim) |
1896 ui_shim->Send(new AcceleratedSurfaceMsg_BufferPresented(route_id, | 1909 ui_shim->Send(new AcceleratedSurfaceMsg_BufferPresented(route_id, |
1897 sync_point)); | 1910 sync_point)); |
1898 } | 1911 } |
1899 | 1912 |
1900 void RenderWidgetHostImpl::AcknowledgeSwapBuffersToRenderer() { | 1913 void RenderWidgetHostImpl::AcknowledgeSwapBuffersToRenderer() { |
1901 base::FieldTrial* trial = | 1914 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_)); | 1915 Send(new ViewMsg_SwapBuffers_ACK(routing_id_)); |
1914 } | 1916 } |
1915 | 1917 |
1916 #if defined(USE_AURA) | 1918 #if defined(USE_AURA) |
1917 // static | 1919 // static |
1918 void RenderWidgetHostImpl::SendFrontSurfaceIsProtected( | 1920 void RenderWidgetHostImpl::SendFrontSurfaceIsProtected( |
1919 bool is_protected, | 1921 bool is_protected, |
1920 uint32 protection_state_id, | 1922 uint32 protection_state_id, |
1921 int32 route_id, | 1923 int32 route_id, |
1922 int gpu_host_id) { | 1924 int gpu_host_id) { |
(...skipping 11 matching lines...) Expand all Loading... | |
1934 // indicate that no callback is in progress (i.e. without this line | 1936 // indicate that no callback is in progress (i.e. without this line |
1935 // DelayedAutoResized will not get called again). | 1937 // DelayedAutoResized will not get called again). |
1936 new_auto_size_.SetSize(0, 0); | 1938 new_auto_size_.SetSize(0, 0); |
1937 if (!should_auto_resize_) | 1939 if (!should_auto_resize_) |
1938 return; | 1940 return; |
1939 | 1941 |
1940 OnRenderAutoResized(new_size); | 1942 OnRenderAutoResized(new_size); |
1941 } | 1943 } |
1942 | 1944 |
1943 } // namespace content | 1945 } // namespace content |
OLD | NEW |