Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: cc/output/output_surface.cc

Issue 2402173002: cc: Get rid of PostSwapBuffersComplete. (Closed)
Patch Set: postswap: . Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/output_surface.h" 5 #include "cc/output/output_surface.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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 device_scale_factor_ = scale_factor; 201 device_scale_factor_ = scale_factor;
202 has_alpha_ = has_alpha; 202 has_alpha_ = has_alpha;
203 if (context_provider_.get()) { 203 if (context_provider_.get()) {
204 context_provider_->ContextGL()->ResizeCHROMIUM(size.width(), size.height(), 204 context_provider_->ContextGL()->ResizeCHROMIUM(size.width(), size.height(),
205 scale_factor, has_alpha); 205 scale_factor, has_alpha);
206 } 206 }
207 if (software_device_) 207 if (software_device_)
208 software_device_->Resize(size, scale_factor); 208 software_device_->Resize(size, scale_factor);
209 } 209 }
210 210
211 void OutputSurface::PostSwapBuffersComplete() {
212 base::ThreadTaskRunnerHandle::Get()->PostTask(
213 FROM_HERE, base::Bind(&OutputSurface::OnSwapBuffersComplete,
214 weak_ptr_factory_.GetWeakPtr()));
215 }
216
217 // We don't post tasks bound to the client directly since they might run 211 // We don't post tasks bound to the client directly since they might run
218 // after the OutputSurface has been destroyed. 212 // after the OutputSurface has been destroyed.
219 void OutputSurface::OnSwapBuffersComplete() { 213 void OutputSurface::OnSwapBuffersComplete() {
220 client_->DidSwapBuffersComplete(); 214 client_->DidSwapBuffersComplete();
221 } 215 }
222 216
223 bool OutputSurface::OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, 217 bool OutputSurface::OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
224 base::trace_event::ProcessMemoryDump* pmd) { 218 base::trace_event::ProcessMemoryDump* pmd) {
225 if (auto* context_provider = this->context_provider()) { 219 if (auto* context_provider = this->context_provider()) {
226 // No need to lock, main context provider is not shared. 220 // No need to lock, main context provider is not shared.
227 if (auto* gr_context = context_provider->GrContext()) { 221 if (auto* gr_context = context_provider->GrContext()) {
228 SkiaGpuTraceMemoryDump trace_memory_dump( 222 SkiaGpuTraceMemoryDump trace_memory_dump(
229 pmd, context_provider->ContextSupport()->ShareGroupTracingGUID()); 223 pmd, context_provider->ContextSupport()->ShareGroupTracingGUID());
230 gr_context->dumpMemoryStatistics(&trace_memory_dump); 224 gr_context->dumpMemoryStatistics(&trace_memory_dump);
231 } 225 }
232 } 226 }
233 return true; 227 return true;
234 } 228 }
235 229
236 void OutputSurface::DidLoseOutputSurface() { 230 void OutputSurface::DidLoseOutputSurface() {
237 TRACE_EVENT0("cc", "OutputSurface::DidLoseOutputSurface"); 231 TRACE_EVENT0("cc", "OutputSurface::DidLoseOutputSurface");
238 client_->DidLoseOutputSurface(); 232 client_->DidLoseOutputSurface();
239 } 233 }
240 234
241 } // namespace cc 235 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698