| 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 "cc/surfaces/direct_compositor_frame_sink.h" | 5 #include "cc/surfaces/direct_compositor_frame_sink.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "cc/output/compositor_frame.h" | 8 #include "cc/output/compositor_frame.h" |
| 9 #include "cc/output/compositor_frame_sink_client.h" | 9 #include "cc/output/compositor_frame_sink_client.h" |
| 10 #include "cc/surfaces/display.h" | 10 #include "cc/surfaces/display.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 // Avoid initializing GL context here, as this should be sharing the | 73 // Avoid initializing GL context here, as this should be sharing the |
| 74 // Display's context. | 74 // Display's context. |
| 75 display_->Initialize(this, surface_manager_, | 75 display_->Initialize(this, surface_manager_, |
| 76 surface_id_allocator_->client_id()); | 76 surface_id_allocator_->client_id()); |
| 77 return true; | 77 return true; |
| 78 } | 78 } |
| 79 | 79 |
| 80 void DirectCompositorFrameSink::DetachFromClient() { | 80 void DirectCompositorFrameSink::DetachFromClient() { |
| 81 DCHECK(HasClient()); | 81 DCHECK(HasClient()); |
| 82 | |
| 83 // Unregister the SurfaceFactoryClient here instead of the dtor so that only | 82 // Unregister the SurfaceFactoryClient here instead of the dtor so that only |
| 84 // one client is alive for this namespace at any given time. | 83 // one client is alive for this namespace at any given time. |
| 85 surface_manager_->UnregisterSurfaceFactoryClient( | 84 surface_manager_->UnregisterSurfaceFactoryClient( |
| 86 surface_id_allocator_->client_id()); | 85 surface_id_allocator_->client_id()); |
| 87 if (!delegated_surface_id_.is_null()) | 86 if (!delegated_surface_id_.is_null()) |
| 88 factory_.Destroy(delegated_surface_id_); | 87 factory_.Destroy(delegated_surface_id_); |
| 89 | 88 |
| 90 CompositorFrameSink::DetachFromClient(); | 89 CompositorFrameSink::DetachFromClient(); |
| 91 } | 90 } |
| 92 | 91 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // This notification is not relevant to our client outside of tests. | 139 // This notification is not relevant to our client outside of tests. |
| 141 } | 140 } |
| 142 | 141 |
| 143 void DirectCompositorFrameSink::DisplayDidDrawAndSwap() { | 142 void DirectCompositorFrameSink::DisplayDidDrawAndSwap() { |
| 144 // This notification is not relevant to our client outside of tests. We | 143 // This notification is not relevant to our client outside of tests. We |
| 145 // unblock the client from DidDrawCallback() when the surface is going to | 144 // unblock the client from DidDrawCallback() when the surface is going to |
| 146 // be drawn. | 145 // be drawn. |
| 147 } | 146 } |
| 148 | 147 |
| 149 void DirectCompositorFrameSink::DidDrawCallback() { | 148 void DirectCompositorFrameSink::DidDrawCallback() { |
| 150 CompositorFrameSink::PostSwapBuffersComplete(); | 149 // TODO(danakj): Why the lost check? |
| 150 if (!is_lost_) |
| 151 client_->DidSwapBuffersComplete(); |
| 151 } | 152 } |
| 152 | 153 |
| 153 } // namespace cc | 154 } // namespace cc |
| OLD | NEW |