| 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_view_host_factory.h" | 5 #include "content/browser/renderer_host/render_view_host_factory.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/browser/gpu/gpu_surface_tracker.h" | 8 #include "content/browser/gpu/gpu_surface_tracker.h" |
| 9 #include "content/browser/renderer_host/render_view_host_impl.h" | 9 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 | 12 |
| 13 // static | 13 // static |
| 14 RenderViewHostFactory* RenderViewHostFactory::factory_ = NULL; | 14 RenderViewHostFactory* RenderViewHostFactory::factory_ = NULL; |
| 15 | 15 |
| 16 // static | 16 // static |
| 17 RenderViewHost* RenderViewHostFactory::Create( | 17 RenderViewHost* RenderViewHostFactory::Create( |
| 18 SiteInstance* instance, | 18 SiteInstance* instance, |
| 19 RenderViewHostDelegate* delegate, | 19 RenderViewHostDelegate* delegate, |
| 20 RenderWidgetHostDelegate* widget_delegate, | 20 RenderWidgetHostDelegate* widget_delegate, |
| 21 int32 routing_id, | 21 int32 routing_id, |
| 22 int32 main_frame_routing_id, | 22 int32 main_frame_routing_id, |
| 23 bool swapped_out, | 23 bool swapped_out, |
| 24 bool hidden) { | 24 bool hidden) { |
| 25 // TODO(dcheng): Once the main frame's RenderWidgetHost is used for painting, |
| 26 // the surface creation/lookup here can be removed and the values hardcoded to |
| 27 // 0. https://crbug.com/526958 |
| 25 int32 surface_id; | 28 int32 surface_id; |
| 26 // RenderViewHost creation can be either browser-driven (by the user opening a | 29 // RenderViewHost creation can be either browser-driven (by the user opening a |
| 27 // new tab) or renderer-driven (by script calling window.open, etc). | 30 // new tab) or renderer-driven (by script calling window.open, etc). |
| 28 // | 31 // |
| 29 // In the browser-driven case, the routing ID of the view is lazily assigned: | 32 // In the browser-driven case, the routing ID of the view is lazily assigned: |
| 30 // this is signified by passing MSG_ROUTING_NONE for |routing_id|. | 33 // this is signified by passing MSG_ROUTING_NONE for |routing_id|. |
| 31 if (routing_id == MSG_ROUTING_NONE) { | 34 if (routing_id == MSG_ROUTING_NONE) { |
| 32 routing_id = instance->GetProcess()->GetNextRoutingID(); | 35 routing_id = instance->GetProcess()->GetNextRoutingID(); |
| 33 // No surface has yet been created for the RVH. | 36 // No surface has yet been created for the RVH. |
| 34 surface_id = GpuSurfaceTracker::Get()->AddSurfaceForRenderer( | 37 surface_id = GpuSurfaceTracker::Get()->AddSurfaceForRenderer( |
| (...skipping 24 matching lines...) Expand all Loading... |
| 59 factory_ = factory; | 62 factory_ = factory; |
| 60 } | 63 } |
| 61 | 64 |
| 62 // static | 65 // static |
| 63 void RenderViewHostFactory::UnregisterFactory() { | 66 void RenderViewHostFactory::UnregisterFactory() { |
| 64 DCHECK(factory_) << "No factory to unregister."; | 67 DCHECK(factory_) << "No factory to unregister."; |
| 65 factory_ = NULL; | 68 factory_ = NULL; |
| 66 } | 69 } |
| 67 | 70 |
| 68 } // namespace content | 71 } // namespace content |
| OLD | NEW |