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

Side by Side Diff: content/common/gpu/image_transport_surface_iosurface_mac.cc

Issue 454243002: Make GPU back-pressure work with remote CALayers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix flashes Created 6 years, 4 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 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 "content/common/gpu/image_transport_surface_iosurface_mac.h" 5 #include "content/common/gpu/image_transport_surface_iosurface_mac.h"
6 6
7 #include "content/common/gpu/gpu_messages.h" 7 #include "content/common/gpu/gpu_messages.h"
8 #include "content/common/gpu/surface_handle_types_mac.h" 8 #include "content/common/gpu/surface_handle_types_mac.h"
9 9
10 namespace content { 10 namespace content {
(...skipping 22 matching lines...) Expand all
33 void AddIntegerValue(CFMutableDictionaryRef dictionary, 33 void AddIntegerValue(CFMutableDictionaryRef dictionary,
34 const CFStringRef key, 34 const CFStringRef key,
35 int32 value) { 35 int32 value) {
36 base::ScopedCFTypeRef<CFNumberRef> number( 36 base::ScopedCFTypeRef<CFNumberRef> number(
37 CFNumberCreate(NULL, kCFNumberSInt32Type, &value)); 37 CFNumberCreate(NULL, kCFNumberSInt32Type, &value));
38 CFDictionaryAddValue(dictionary, key, number.get()); 38 CFDictionaryAddValue(dictionary, key, number.get());
39 } 39 }
40 40
41 } // namespace 41 } // namespace
42 42
43 IOSurfaceStorageProvider::IOSurfaceStorageProvider() {} 43 IOSurfaceStorageProvider::IOSurfaceStorageProvider(
44 ImageTransportSurfaceFBO* transport_surface)
45 : transport_surface_(transport_surface) {}
44 46
45 IOSurfaceStorageProvider::~IOSurfaceStorageProvider() { 47 IOSurfaceStorageProvider::~IOSurfaceStorageProvider() {
46 DCHECK(!io_surface_); 48 DCHECK(!io_surface_);
47 } 49 }
48 50
49 gfx::Size IOSurfaceStorageProvider::GetRoundedSize(gfx::Size size) { 51 gfx::Size IOSurfaceStorageProvider::GetRoundedSize(gfx::Size size) {
50 return gfx::Size(RoundUpSurfaceDimension(size.width()), 52 return gfx::Size(RoundUpSurfaceDimension(size.width()),
51 RoundUpSurfaceDimension(size.height())); 53 RoundUpSurfaceDimension(size.height()));
52 } 54 }
53 55
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 void IOSurfaceStorageProvider::FreeColorBufferStorage() { 103 void IOSurfaceStorageProvider::FreeColorBufferStorage() {
102 io_surface_.reset(); 104 io_surface_.reset();
103 io_surface_id_ = 0; 105 io_surface_id_ = 0;
104 } 106 }
105 107
106 uint64 IOSurfaceStorageProvider::GetSurfaceHandle() const { 108 uint64 IOSurfaceStorageProvider::GetSurfaceHandle() const {
107 return SurfaceHandleFromIOSurfaceID(io_surface_id_); 109 return SurfaceHandleFromIOSurfaceID(io_surface_id_);
108 } 110 }
109 111
110 void IOSurfaceStorageProvider::WillSwapBuffers() { 112 void IOSurfaceStorageProvider::WillSwapBuffers() {
113 // The browser compositor will throttle itself, so we are free to unblock the
114 // context immediately. Make sure that the browser is doing its throttling
115 // appropriately by ensuring that the previous swap was acknowledged before
116 // we get another swap.
117 DCHECK(pending_swapped_surfaces_.empty());
118 pending_swapped_surfaces_.push_back(io_surface_);
119 transport_surface_->UnblockContextAfterPendingSwap();
120 }
121
122 void IOSurfaceStorageProvider::CanFreeSwappedBuffer() {
123 DCHECK(!pending_swapped_surfaces_.empty());
124 pending_swapped_surfaces_.pop_front();
111 } 125 }
112 126
113 } // namespace content 127 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/image_transport_surface_iosurface_mac.h ('k') | content/common/gpu/image_transport_surface_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698