| 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 "components/mus/surfaces/surfaces_context_provider.h" | 5 #include "components/mus/surfaces/surfaces_context_provider.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 } | 85 } |
| 86 | 86 |
| 87 void SurfacesContextProvider::SetupLock() {} | 87 void SurfacesContextProvider::SetupLock() {} |
| 88 | 88 |
| 89 base::Lock* SurfacesContextProvider::GetLock() { | 89 base::Lock* SurfacesContextProvider::GetLock() { |
| 90 return &context_lock_; | 90 return &context_lock_; |
| 91 } | 91 } |
| 92 | 92 |
| 93 void SurfacesContextProvider::SetLostContextCallback( | 93 void SurfacesContextProvider::SetLostContextCallback( |
| 94 const LostContextCallback& lost_context_callback) { | 94 const LostContextCallback& lost_context_callback) { |
| 95 lost_context_callback_ = lost_context_callback; | 95 implementation_->SetLostContextCallback(lost_context_callback); |
| 96 } | 96 } |
| 97 | 97 |
| 98 SurfacesContextProvider::~SurfacesContextProvider() { | 98 SurfacesContextProvider::~SurfacesContextProvider() { |
| 99 implementation_->Flush(); | 99 implementation_->Flush(); |
| 100 implementation_.reset(); | 100 implementation_.reset(); |
| 101 transfer_buffer_.reset(); | 101 transfer_buffer_.reset(); |
| 102 gles2_helper_.reset(); | 102 gles2_helper_.reset(); |
| 103 command_buffer_local_->Destroy(); | 103 command_buffer_local_->Destroy(); |
| 104 command_buffer_local_ = nullptr; | 104 command_buffer_local_ = nullptr; |
| 105 } | 105 } |
| 106 | 106 |
| 107 void SurfacesContextProvider::UpdateVSyncParameters(int64_t timebase, | 107 void SurfacesContextProvider::UpdateVSyncParameters(int64_t timebase, |
| 108 int64_t interval) { | 108 int64_t interval) { |
| 109 if (delegate_) | 109 if (delegate_) |
| 110 delegate_->OnVSyncParametersUpdated(timebase, interval); | 110 delegate_->OnVSyncParametersUpdated(timebase, interval); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void SurfacesContextProvider::DidLoseContext() { | |
| 114 lost_context_callback_.Run(); | |
| 115 } | |
| 116 | |
| 117 void SurfacesContextProvider::GpuCompletedSwapBuffers(gfx::SwapResult result) { | 113 void SurfacesContextProvider::GpuCompletedSwapBuffers(gfx::SwapResult result) { |
| 118 if (!swap_buffers_completion_callback_.is_null()) { | 114 if (!swap_buffers_completion_callback_.is_null()) { |
| 119 swap_buffers_completion_callback_.Run(result); | 115 swap_buffers_completion_callback_.Run(result); |
| 120 } | 116 } |
| 121 } | 117 } |
| 122 | 118 |
| 123 void SurfacesContextProvider::SetSwapBuffersCompletionCallback( | 119 void SurfacesContextProvider::SetSwapBuffersCompletionCallback( |
| 124 gfx::GLSurface::SwapCompletionCallback callback) { | 120 gfx::GLSurface::SwapCompletionCallback callback) { |
| 125 swap_buffers_completion_callback_ = callback; | 121 swap_buffers_completion_callback_ = callback; |
| 126 } | 122 } |
| 127 | 123 |
| 128 } // namespace mus | 124 } // namespace mus |
| OLD | NEW |