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_private_mac.h" | 5 #include "content/browser/compositor/browser_compositor_view_private_mac.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 } | 84 } |
85 | 85 |
86 void BrowserCompositorViewMacInternal::ResetClient() { | 86 void BrowserCompositorViewMacInternal::ResetClient() { |
87 if (!client_) | 87 if (!client_) |
88 return; | 88 return; |
89 | 89 |
90 // Disable the fade-out animation as the view is removed. | 90 // Disable the fade-out animation as the view is removed. |
91 ScopedCAActionDisabler disabler; | 91 ScopedCAActionDisabler disabler; |
92 | 92 |
93 [flipped_layer_ removeFromSuperlayer]; | 93 [flipped_layer_ removeFromSuperlayer]; |
| 94 DestroyIOSurfaceLayer(io_surface_layer_); |
| 95 DestroyCAContextLayer(ca_context_layer_); |
| 96 DestroySoftwareLayer(); |
94 | 97 |
95 [io_surface_layer_ removeFromSuperlayer]; | |
96 [io_surface_layer_ resetClient]; | |
97 io_surface_layer_.reset(); | |
98 accelerated_output_surface_id_ = 0; | 98 accelerated_output_surface_id_ = 0; |
99 | |
100 [software_layer_ removeFromSuperlayer]; | |
101 software_layer_.reset(); | |
102 | |
103 last_swap_size_dip_ = gfx::Size(); | 99 last_swap_size_dip_ = gfx::Size(); |
104 | 100 |
105 compositor_->SetScaleAndSize(1.0, gfx::Size(0, 0)); | 101 compositor_->SetScaleAndSize(1.0, gfx::Size(0, 0)); |
106 compositor_->SetRootLayer(NULL); | 102 compositor_->SetRootLayer(NULL); |
107 client_ = NULL; | 103 client_ = NULL; |
108 } | 104 } |
109 | 105 |
110 bool BrowserCompositorViewMacInternal::HasFrameOfSize( | 106 bool BrowserCompositorViewMacInternal::HasFrameOfSize( |
111 const gfx::Size& dip_size) const { | 107 const gfx::Size& dip_size) const { |
112 return last_swap_size_dip_ == dip_size; | 108 return last_swap_size_dip_ == dip_size; |
113 } | 109 } |
114 | 110 |
| 111 int BrowserCompositorViewMacInternal::GetRendererID() const { |
| 112 if (io_surface_layer_) |
| 113 return [io_surface_layer_ iosurface]->GetRendererID(); |
| 114 return 0; |
| 115 } |
| 116 |
115 void BrowserCompositorViewMacInternal::BeginPumpingFrames() { | 117 void BrowserCompositorViewMacInternal::BeginPumpingFrames() { |
116 [io_surface_layer_ beginPumpingFrames]; | 118 [io_surface_layer_ beginPumpingFrames]; |
117 } | 119 } |
118 | 120 |
119 void BrowserCompositorViewMacInternal::EndPumpingFrames() { | 121 void BrowserCompositorViewMacInternal::EndPumpingFrames() { |
120 [io_surface_layer_ endPumpingFrames]; | 122 [io_surface_layer_ endPumpingFrames]; |
121 } | 123 } |
122 | 124 |
123 void BrowserCompositorViewMacInternal::GotAcceleratedFrame( | 125 void BrowserCompositorViewMacInternal::GotAcceleratedFrame( |
124 uint64 surface_handle, int output_surface_id, | 126 uint64 surface_handle, int output_surface_id, |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 g_widget_to_internals_map.Pointer()->find(widget); | 369 g_widget_to_internals_map.Pointer()->find(widget); |
368 // This can end up being accessed after the underlying widget has been | 370 // This can end up being accessed after the underlying widget has been |
369 // destroyed, but while the ui::Compositor is still being destroyed. | 371 // destroyed, but while the ui::Compositor is still being destroyed. |
370 // Return NULL in these cases. | 372 // Return NULL in these cases. |
371 if (found == g_widget_to_internals_map.Pointer()->end()) | 373 if (found == g_widget_to_internals_map.Pointer()->end()) |
372 return NULL; | 374 return NULL; |
373 return found->second; | 375 return found->second; |
374 } | 376 } |
375 | 377 |
376 } // namespace content | 378 } // namespace content |
OLD | NEW |