| OLD | NEW |
| 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> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 self = [super initWithFrame:NSZeroRect]; | 32 self = [super initWithFrame:NSZeroRect]; |
| 33 return self; | 33 return self; |
| 34 } | 34 } |
| 35 | 35 |
| 36 -(void)setCompositor:(ui::Compositor*)compositor { | 36 -(void)setCompositor:(ui::Compositor*)compositor { |
| 37 compositor_ = compositor; | 37 compositor_ = compositor; |
| 38 } | 38 } |
| 39 | 39 |
| 40 - (void)drawRect:(NSRect)rect { | 40 - (void)drawRect:(NSRect)rect { |
| 41 DCHECK(compositor_) << "Drawing with no compositor set."; | 41 DCHECK(compositor_) << "Drawing with no compositor set."; |
| 42 compositor_->Draw(); | 42 compositor_->ScheduleFullRedraw(); |
| 43 } | 43 } |
| 44 @end | 44 @end |
| 45 | 45 |
| 46 namespace ui { | 46 namespace ui { |
| 47 | 47 |
| 48 // Tests that use Objective-C memory semantics need to have a top-level | 48 // Tests that use Objective-C memory semantics need to have a top-level |
| 49 // NSAutoreleasePool set up and initialized prior to execution and drained upon | 49 // NSAutoreleasePool set up and initialized prior to execution and drained upon |
| 50 // exit. The tests will leak otherwise. | 50 // exit. The tests will leak otherwise. |
| 51 class FoundationHost { | 51 class FoundationHost { |
| 52 protected: | 52 protected: |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 } | 142 } |
| 143 | 143 |
| 144 // static | 144 // static |
| 145 TestCompositorHost* TestCompositorHost::Create( | 145 TestCompositorHost* TestCompositorHost::Create( |
| 146 const gfx::Rect& bounds, | 146 const gfx::Rect& bounds, |
| 147 ui::ContextFactory* context_factory) { | 147 ui::ContextFactory* context_factory) { |
| 148 return new TestCompositorHostMac(bounds, context_factory); | 148 return new TestCompositorHostMac(bounds, context_factory); |
| 149 } | 149 } |
| 150 | 150 |
| 151 } // namespace ui | 151 } // namespace ui |
| OLD | NEW |