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

Side by Side Diff: ui/compositor/mac/io_surface_layer_mac.mm

Issue 753933002: MacViews: Move content::AcceleratedWidget to new component, ui/accelerated_widget_mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20141124-MacViews-MoveSoftwareLayerMac-fromcl
Patch Set: nit DEPS, deps and gn Created 6 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "content/browser/compositor/io_surface_layer_mac.h" 5 #include "ui/compositor/mac/io_surface_layer_mac.h"
6 6
7 #include <CoreFoundation/CoreFoundation.h> 7 #include <CoreFoundation/CoreFoundation.h>
8 #include <OpenGL/CGLIOSurface.h> 8 #include <OpenGL/CGLIOSurface.h>
9 #include <OpenGL/CGLRenderers.h> 9 #include <OpenGL/CGLRenderers.h>
10 #include <OpenGL/gl.h> 10 #include <OpenGL/gl.h>
11 #include <OpenGL/OpenGL.h> 11 #include <OpenGL/OpenGL.h>
12 12
13 #include "base/debug/trace_event.h" 13 #include "base/debug/trace_event.h"
14 #include "base/mac/mac_util.h" 14 #include "base/mac/mac_util.h"
15 #include "base/mac/sdk_forward_declarations.h" 15 #include "base/mac/sdk_forward_declarations.h"
16 #include "content/browser/compositor/io_surface_context_mac.h"
17 #include "content/browser/compositor/io_surface_texture_mac.h"
18 #include "ui/base/cocoa/animation_utils.h" 16 #include "ui/base/cocoa/animation_utils.h"
17 #include "ui/compositor/mac/io_surface_context_mac.h"
18 #include "ui/compositor/mac/io_surface_texture_mac.h"
19 #include "ui/gfx/size_conversions.h" 19 #include "ui/gfx/size_conversions.h"
20 #include "ui/gl/gpu_switching_manager.h" 20 #include "ui/gl/gpu_switching_manager.h"
21 21
22 //////////////////////////////////////////////////////////////////////////////// 22 ////////////////////////////////////////////////////////////////////////////////
23 // IOSurfaceLayerHelper 23 // IOSurfaceLayerHelper
24 24
25 namespace content { 25 namespace content {
26 26
27 IOSurfaceLayerHelper::IOSurfaceLayerHelper( 27 IOSurfaceLayerHelper::IOSurfaceLayerHelper(
28 IOSurfaceLayerClient* client, 28 IOSurfaceLayerClient* client,
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 //////////////////////////////////////////////////////////////////////////////// 165 ////////////////////////////////////////////////////////////////////////////////
166 // IOSurfaceLayer 166 // IOSurfaceLayer
167 167
168 @implementation IOSurfaceLayer 168 @implementation IOSurfaceLayer
169 169
170 - (id)initWithClient:(content::IOSurfaceLayerClient*)client 170 - (id)initWithClient:(content::IOSurfaceLayerClient*)client
171 withScaleFactor:(float)scale_factor { 171 withScaleFactor:(float)scale_factor {
172 if (self = [super init]) { 172 if (self = [super init]) {
173 helper_.reset(new content::IOSurfaceLayerHelper(client, self)); 173 helper_.reset(new content::IOSurfaceLayerHelper(client, self));
174 174
175 iosurface_ = content::IOSurfaceTexture::Create(); 175 iosurface_ = content::IOSurfaceTexture::Create(
176 client->IOSurfaceNeedsGLFinishWorkaround());
176 context_ = content::IOSurfaceContext::Get( 177 context_ = content::IOSurfaceContext::Get(
177 content::IOSurfaceContext::kCALayerContext); 178 content::IOSurfaceContext::kCALayerContext);
178 if (!iosurface_.get() || !context_.get()) { 179 if (!iosurface_.get() || !context_.get()) {
179 LOG(ERROR) << "Failed create CompositingIOSurface or context"; 180 LOG(ERROR) << "Failed create CompositingIOSurface or context";
180 [self resetClient]; 181 [self resetClient];
181 [self release]; 182 [self release];
182 return nil; 183 return nil;
183 } 184 }
184 185
185 [self setBackgroundColor:CGColorGetConstantColor(kCGColorWhite)]; 186 [self setBackgroundColor:CGColorGetConstantColor(kCGColorWhite)];
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 if (helper_) 293 if (helper_)
293 helper_->DidDraw(draw_succeeded); 294 helper_->DidDraw(draw_succeeded);
294 295
295 [super drawInCGLContext:glContext 296 [super drawInCGLContext:glContext
296 pixelFormat:pixelFormat 297 pixelFormat:pixelFormat
297 forLayerTime:timeInterval 298 forLayerTime:timeInterval
298 displayTime:timeStamp]; 299 displayTime:timeStamp];
299 } 300 }
300 301
301 @end 302 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698