| OLD | NEW |
| 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 #import "ui/views/widget/native_widget_mac.h" | 5 #import "ui/views/widget/native_widget_mac.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #import "base/mac/foundation_util.h" | 9 #import "base/mac/foundation_util.h" |
| 10 #import "base/mac/scoped_nsobject.h" | 10 #import "base/mac/scoped_nsobject.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 // BridgedNativeWidget friend to access private members. | 58 // BridgedNativeWidget friend to access private members. |
| 59 class BridgedNativeWidgetTestApi { | 59 class BridgedNativeWidgetTestApi { |
| 60 public: | 60 public: |
| 61 explicit BridgedNativeWidgetTestApi(NSWindow* window) { | 61 explicit BridgedNativeWidgetTestApi(NSWindow* window) { |
| 62 bridge_ = NativeWidgetMac::GetBridgeForNativeWindow(window); | 62 bridge_ = NativeWidgetMac::GetBridgeForNativeWindow(window); |
| 63 } | 63 } |
| 64 | 64 |
| 65 // Simulate a frame swap from the compositor. Assumes scale factor of 1.0f. | 65 // Simulate a frame swap from the compositor. Assumes scale factor of 1.0f. |
| 66 void SimulateFrameSwap(const gfx::Size& size) { | 66 void SimulateFrameSwap(const gfx::Size& size) { |
| 67 const float kScaleFactor = 1.0f; | 67 const float kScaleFactor = 1.0f; |
| 68 SkBitmap bitmap; | 68 bridge_->compositor_widget_->GotIOSurfaceFrame( |
| 69 bitmap.allocN32Pixels(size.width(), size.height()); | 69 base::ScopedCFTypeRef<IOSurfaceRef>(), size, kScaleFactor, false); |
| 70 SkCanvas canvas(bitmap); | |
| 71 bridge_->compositor_widget_->GotSoftwareFrame(kScaleFactor, &canvas); | |
| 72 std::vector<ui::LatencyInfo> latency_info; | 70 std::vector<ui::LatencyInfo> latency_info; |
| 73 bridge_->AcceleratedWidgetSwapCompleted(latency_info); | 71 bridge_->AcceleratedWidgetSwapCompleted(latency_info); |
| 74 } | 72 } |
| 75 | 73 |
| 76 private: | 74 private: |
| 77 BridgedNativeWidget* bridge_; | 75 BridgedNativeWidget* bridge_; |
| 78 | 76 |
| 79 DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidgetTestApi); | 77 DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidgetTestApi); |
| 80 }; | 78 }; |
| 81 | 79 |
| (...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 @implementation NativeWidgetMacTestWindow | 1101 @implementation NativeWidgetMacTestWindow |
| 1104 | 1102 |
| 1105 @synthesize invalidateShadowCount = invalidateShadowCount_; | 1103 @synthesize invalidateShadowCount = invalidateShadowCount_; |
| 1106 | 1104 |
| 1107 - (void)invalidateShadow { | 1105 - (void)invalidateShadow { |
| 1108 ++invalidateShadowCount_; | 1106 ++invalidateShadowCount_; |
| 1109 [super invalidateShadow]; | 1107 [super invalidateShadow]; |
| 1110 } | 1108 } |
| 1111 | 1109 |
| 1112 @end | 1110 @end |
| OLD | NEW |