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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // the sync IPC, while deferring the creation of the actual Host objects to | 43 // the sync IPC, while deferring the creation of the actual Host objects to |
44 // the UI thread. | 44 // the UI thread. |
45 } | 45 } |
46 if (factory_) { | 46 if (factory_) { |
47 return factory_->CreateRenderViewHost(instance, delegate, widget_delegate, | 47 return factory_->CreateRenderViewHost(instance, delegate, widget_delegate, |
48 routing_id, main_frame_routing_id, | 48 routing_id, main_frame_routing_id, |
49 swapped_out); | 49 swapped_out); |
50 } | 50 } |
51 return new RenderViewHostImpl( | 51 return new RenderViewHostImpl( |
52 instance, | 52 instance, |
53 base::WrapUnique(new RenderWidgetHostImpl( | 53 base::MakeUnique<RenderWidgetHostImpl>( |
54 widget_delegate, instance->GetProcess(), routing_id, hidden)), | 54 widget_delegate, instance->GetProcess(), routing_id, hidden), |
55 delegate, main_frame_routing_id, swapped_out, | 55 delegate, main_frame_routing_id, swapped_out, |
56 true /* has_initialized_audio_host */); | 56 true /* has_initialized_audio_host */); |
57 } | 57 } |
58 | 58 |
59 // static | 59 // static |
60 void RenderViewHostFactory::RegisterFactory(RenderViewHostFactory* factory) { | 60 void RenderViewHostFactory::RegisterFactory(RenderViewHostFactory* factory) { |
61 DCHECK(!factory_) << "Can't register two factories at once."; | 61 DCHECK(!factory_) << "Can't register two factories at once."; |
62 factory_ = factory; | 62 factory_ = factory; |
63 } | 63 } |
64 | 64 |
65 // static | 65 // static |
66 void RenderViewHostFactory::UnregisterFactory() { | 66 void RenderViewHostFactory::UnregisterFactory() { |
67 DCHECK(factory_) << "No factory to unregister."; | 67 DCHECK(factory_) << "No factory to unregister."; |
68 factory_ = nullptr; | 68 factory_ = nullptr; |
69 } | 69 } |
70 | 70 |
71 } // namespace content | 71 } // namespace content |
OLD | NEW |