| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/output/compositor_frame_sink.h" | 5 #include "cc/output/compositor_frame_sink.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 if (!success) | 170 if (!success) |
| 171 DetachFromClient(); | 171 DetachFromClient(); |
| 172 return success; | 172 return success; |
| 173 } | 173 } |
| 174 | 174 |
| 175 void CompositorFrameSink::DetachFromClient() { | 175 void CompositorFrameSink::DetachFromClient() { |
| 176 DetachFromClientInternal(); | 176 DetachFromClientInternal(); |
| 177 } | 177 } |
| 178 | 178 |
| 179 void CompositorFrameSink::PostSwapBuffersComplete() { | |
| 180 base::ThreadTaskRunnerHandle::Get()->PostTask( | |
| 181 FROM_HERE, base::Bind(&CompositorFrameSink::OnSwapBuffersComplete, | |
| 182 weak_ptr_factory_.GetWeakPtr())); | |
| 183 } | |
| 184 | |
| 185 // We don't post tasks bound to the client directly since they might run | 179 // We don't post tasks bound to the client directly since they might run |
| 186 // after the CompositorFrameSink has been destroyed. | 180 // after the CompositorFrameSink has been destroyed. |
| 187 void CompositorFrameSink::OnSwapBuffersComplete() { | 181 void CompositorFrameSink::OnSwapBuffersComplete() { |
| 188 client_->DidSwapBuffersComplete(); | 182 client_->DidSwapBuffersComplete(); |
| 189 } | 183 } |
| 190 | 184 |
| 191 bool CompositorFrameSink::OnMemoryDump( | 185 bool CompositorFrameSink::OnMemoryDump( |
| 192 const base::trace_event::MemoryDumpArgs& args, | 186 const base::trace_event::MemoryDumpArgs& args, |
| 193 base::trace_event::ProcessMemoryDump* pmd) { | 187 base::trace_event::ProcessMemoryDump* pmd) { |
| 194 if (auto* context_provider = this->context_provider()) { | 188 if (auto* context_provider = this->context_provider()) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 client_ = nullptr; | 223 client_ = nullptr; |
| 230 weak_ptr_factory_.InvalidateWeakPtrs(); | 224 weak_ptr_factory_.InvalidateWeakPtrs(); |
| 231 } | 225 } |
| 232 | 226 |
| 233 void CompositorFrameSink::DidLoseCompositorFrameSink() { | 227 void CompositorFrameSink::DidLoseCompositorFrameSink() { |
| 234 TRACE_EVENT0("cc", "CompositorFrameSink::DidLoseCompositorFrameSink"); | 228 TRACE_EVENT0("cc", "CompositorFrameSink::DidLoseCompositorFrameSink"); |
| 235 client_->DidLoseCompositorFrameSink(); | 229 client_->DidLoseCompositorFrameSink(); |
| 236 } | 230 } |
| 237 | 231 |
| 238 } // namespace cc | 232 } // namespace cc |
| OLD | NEW |