| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 context_provider()->SetLostContextCallback(base::Closure()); | 71 context_provider()->SetLostContextCallback(base::Closure()); |
| 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_, frame_sink_id_); | 75 display_->Initialize(this, surface_manager_, frame_sink_id_); |
| 76 return true; | 76 return true; |
| 77 } | 77 } |
| 78 | 78 |
| 79 void DirectCompositorFrameSink::DetachFromClient() { | 79 void DirectCompositorFrameSink::DetachFromClient() { |
| 80 DCHECK(HasClient()); | 80 DCHECK(HasClient()); |
| 81 |
| 81 // Unregister the SurfaceFactoryClient here instead of the dtor so that only | 82 // Unregister the SurfaceFactoryClient here instead of the dtor so that only |
| 82 // one client is alive for this namespace at any given time. | 83 // one client is alive for this namespace at any given time. |
| 83 surface_manager_->UnregisterSurfaceFactoryClient(frame_sink_id_); | 84 surface_manager_->UnregisterSurfaceFactoryClient(frame_sink_id_); |
| 84 if (!delegated_local_frame_id_.is_null()) | 85 if (!delegated_local_frame_id_.is_null()) |
| 85 factory_.Destroy(delegated_local_frame_id_); | 86 factory_.Destroy(delegated_local_frame_id_); |
| 86 | 87 |
| 87 CompositorFrameSink::DetachFromClient(); | 88 CompositorFrameSink::DetachFromClient(); |
| 88 } | 89 } |
| 89 | 90 |
| 90 void DirectCompositorFrameSink::SwapBuffers(CompositorFrame frame) { | 91 void DirectCompositorFrameSink::SwapBuffers(CompositorFrame frame) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 // This notification is not relevant to our client outside of tests. | 138 // This notification is not relevant to our client outside of tests. |
| 138 } | 139 } |
| 139 | 140 |
| 140 void DirectCompositorFrameSink::DisplayDidDrawAndSwap() { | 141 void DirectCompositorFrameSink::DisplayDidDrawAndSwap() { |
| 141 // This notification is not relevant to our client outside of tests. We | 142 // This notification is not relevant to our client outside of tests. We |
| 142 // unblock the client from DidDrawCallback() when the surface is going to | 143 // unblock the client from DidDrawCallback() when the surface is going to |
| 143 // be drawn. | 144 // be drawn. |
| 144 } | 145 } |
| 145 | 146 |
| 146 void DirectCompositorFrameSink::DidDrawCallback() { | 147 void DirectCompositorFrameSink::DidDrawCallback() { |
| 147 // TODO(danakj): Why the lost check? | 148 CompositorFrameSink::PostSwapBuffersComplete(); |
| 148 if (!is_lost_) | |
| 149 client_->DidSwapBuffersComplete(); | |
| 150 } | 149 } |
| 151 | 150 |
| 152 } // namespace cc | 151 } // namespace cc |
| OLD | NEW |