OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/compositor/browser_compositor_view_mac.h" | 5 #include "content/browser/compositor/browser_compositor_view_mac.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
| 9 #include <utility> |
| 10 |
9 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
10 #include "base/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" |
11 #include "content/browser/compositor/image_transport_factory.h" | 13 #include "content/browser/compositor/image_transport_factory.h" |
12 #include "content/browser/gpu/gpu_data_manager_impl.h" | 14 #include "content/browser/gpu/gpu_data_manager_impl.h" |
13 #include "content/public/browser/context_factory.h" | 15 #include "content/public/browser/context_factory.h" |
14 #include "gpu/config/gpu_driver_bug_workaround_type.h" | 16 #include "gpu/config/gpu_driver_bug_workaround_type.h" |
15 #include "ui/accelerated_widget_mac/accelerated_widget_mac.h" | 17 #include "ui/accelerated_widget_mac/accelerated_widget_mac.h" |
16 #include "ui/accelerated_widget_mac/window_resize_helper_mac.h" | 18 #include "ui/accelerated_widget_mac/window_resize_helper_mac.h" |
17 | 19 |
18 //////////////////////////////////////////////////////////////////////////////// | 20 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 ui::Compositor* compositor_that_did_commit) { | 71 ui::Compositor* compositor_that_did_commit) { |
70 DCHECK_EQ(compositor_that_did_commit, compositor()); | 72 DCHECK_EQ(compositor_that_did_commit, compositor()); |
71 content::ImageTransportFactory::GetInstance() | 73 content::ImageTransportFactory::GetInstance() |
72 ->SetCompositorSuspendedForRecycle(compositor(), false); | 74 ->SetCompositorSuspendedForRecycle(compositor(), false); |
73 } | 75 } |
74 | 76 |
75 // static | 77 // static |
76 scoped_ptr<BrowserCompositorMac> BrowserCompositorMac::Create() { | 78 scoped_ptr<BrowserCompositorMac> BrowserCompositorMac::Create() { |
77 DCHECK(ui::WindowResizeHelperMac::Get()->task_runner()); | 79 DCHECK(ui::WindowResizeHelperMac::Get()->task_runner()); |
78 if (g_recyclable_browser_compositor.Get()) | 80 if (g_recyclable_browser_compositor.Get()) |
79 return g_recyclable_browser_compositor.Get().Pass(); | 81 return std::move(g_recyclable_browser_compositor.Get()); |
80 return scoped_ptr<BrowserCompositorMac>(new BrowserCompositorMac).Pass(); | 82 return scoped_ptr<BrowserCompositorMac>(new BrowserCompositorMac); |
81 } | 83 } |
82 | 84 |
83 // static | 85 // static |
84 void BrowserCompositorMac::Recycle( | 86 void BrowserCompositorMac::Recycle( |
85 scoped_ptr<BrowserCompositorMac> compositor) { | 87 scoped_ptr<BrowserCompositorMac> compositor) { |
86 DCHECK(compositor); | 88 DCHECK(compositor); |
87 content::ImageTransportFactory::GetInstance() | 89 content::ImageTransportFactory::GetInstance() |
88 ->SetCompositorSuspendedForRecycle(compositor->compositor(), true); | 90 ->SetCompositorSuspendedForRecycle(compositor->compositor(), true); |
89 | 91 |
90 // It is an error to have a browser compositor continue to exist after | 92 // It is an error to have a browser compositor continue to exist after |
(...skipping 26 matching lines...) Expand all Loading... |
117 DCHECK_GT(g_placeholder_count, 0u); | 119 DCHECK_GT(g_placeholder_count, 0u); |
118 g_placeholder_count -= 1; | 120 g_placeholder_count -= 1; |
119 | 121 |
120 // If there are no placeholders allocated, destroy the recyclable | 122 // If there are no placeholders allocated, destroy the recyclable |
121 // BrowserCompositorMac. | 123 // BrowserCompositorMac. |
122 if (!g_placeholder_count) | 124 if (!g_placeholder_count) |
123 g_recyclable_browser_compositor.Get().reset(); | 125 g_recyclable_browser_compositor.Get().reset(); |
124 } | 126 } |
125 | 127 |
126 } // namespace content | 128 } // namespace content |
OLD | NEW |