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

Side by Side Diff: ui/compositor/test/test_compositor_host_mac.mm

Issue 421483003: Parameterize TaskRunner used by ui::Compositor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@task_runner
Patch Set: Add missing includes 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
« no previous file with comments | « ui/compositor/compositor.cc ('k') | ui/compositor/test/test_compositor_host_ozone.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/compositor/test/test_compositor_host.h" 5 #include "ui/compositor/test/test_compositor_host.h"
6 6
7 #import <AppKit/NSApplication.h> 7 #import <AppKit/NSApplication.h>
8 #import <AppKit/NSOpenGL.h> 8 #import <AppKit/NSOpenGL.h>
9 #import <AppKit/NSView.h> 9 #import <AppKit/NSView.h>
10 #import <AppKit/NSWindow.h> 10 #import <AppKit/NSWindow.h>
11 #import <Foundation/NSAutoreleasePool.h> 11 #import <Foundation/NSAutoreleasePool.h>
12 12
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/mac/scoped_nsobject.h" 14 #include "base/mac/scoped_nsobject.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/message_loop/message_loop.h"
16 #include "ui/compositor/compositor.h" 17 #include "ui/compositor/compositor.h"
17 #include "ui/gfx/rect.h" 18 #include "ui/gfx/rect.h"
18 19
19 // AcceleratedTestView provides an NSView class that delegates drawing to a 20 // AcceleratedTestView provides an NSView class that delegates drawing to a
20 // ui::Compositor delegate, setting up the NSOpenGLContext as required. 21 // ui::Compositor delegate, setting up the NSOpenGLContext as required.
21 @interface AcceleratedTestView : NSView { 22 @interface AcceleratedTestView : NSView {
22 ui::Compositor* compositor_; 23 ui::Compositor* compositor_;
23 } 24 }
24 // Designated initializer. 25 // Designated initializer.
25 -(id)init; 26 -(id)init;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 window_ = [[NSWindow alloc] 124 window_ = [[NSWindow alloc]
124 initWithContentRect:NSMakeRect(bounds_.x(), 125 initWithContentRect:NSMakeRect(bounds_.x(),
125 bounds_.y(), 126 bounds_.y(),
126 bounds_.width(), 127 bounds_.width(),
127 bounds_.height()) 128 bounds_.height())
128 styleMask:NSBorderlessWindowMask 129 styleMask:NSBorderlessWindowMask
129 backing:NSBackingStoreBuffered 130 backing:NSBackingStoreBuffered
130 defer:NO]; 131 defer:NO];
131 base::scoped_nsobject<AcceleratedTestView> view( 132 base::scoped_nsobject<AcceleratedTestView> view(
132 [[AcceleratedTestView alloc] init]); 133 [[AcceleratedTestView alloc] init]);
133 compositor_.reset(new ui::Compositor(view, context_factory_)); 134 compositor_.reset(new ui::Compositor(view,
135 context_factory_,
136 base::MessageLoopProxy::current()));
134 compositor_->SetScaleAndSize(1.0f, bounds_.size()); 137 compositor_->SetScaleAndSize(1.0f, bounds_.size());
135 [view setCompositor:compositor_.get()]; 138 [view setCompositor:compositor_.get()];
136 [window_ setContentView:view]; 139 [window_ setContentView:view];
137 [window_ orderFront:nil]; 140 [window_ orderFront:nil];
138 } 141 }
139 142
140 ui::Compositor* TestCompositorHostMac::GetCompositor() { 143 ui::Compositor* TestCompositorHostMac::GetCompositor() {
141 return compositor_.get(); 144 return compositor_.get();
142 } 145 }
143 146
144 // static 147 // static
145 TestCompositorHost* TestCompositorHost::Create( 148 TestCompositorHost* TestCompositorHost::Create(
146 const gfx::Rect& bounds, 149 const gfx::Rect& bounds,
147 ui::ContextFactory* context_factory) { 150 ui::ContextFactory* context_factory) {
148 return new TestCompositorHostMac(bounds, context_factory); 151 return new TestCompositorHostMac(bounds, context_factory);
149 } 152 }
150 153
151 } // namespace ui 154 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/compositor.cc ('k') | ui/compositor/test/test_compositor_host_ozone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698