Chromium Code Reviews| 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>(), |
| 70 SkCanvas canvas(bitmap); | 70 size, |
| 71 bridge_->compositor_widget_->GotSoftwareFrame(kScaleFactor, &canvas); | 71 kScaleFactor, |
| 72 false); | |
|
tapted
2015/10/26 02:51:42
Sadly the NativeWidgetMacTest.InvalidateShadow vie
ccameron
2015/10/26 06:40:34
I went with the last solution -- yes, last_swap_si
| |
| 72 std::vector<ui::LatencyInfo> latency_info; | 73 std::vector<ui::LatencyInfo> latency_info; |
| 73 bridge_->AcceleratedWidgetSwapCompleted(latency_info); | 74 bridge_->AcceleratedWidgetSwapCompleted(latency_info); |
| 74 } | 75 } |
| 75 | 76 |
| 76 private: | 77 private: |
| 77 BridgedNativeWidget* bridge_; | 78 BridgedNativeWidget* bridge_; |
| 78 | 79 |
| 79 DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidgetTestApi); | 80 DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidgetTestApi); |
| 80 }; | 81 }; |
| 81 | 82 |
| (...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1103 @implementation NativeWidgetMacTestWindow | 1104 @implementation NativeWidgetMacTestWindow |
| 1104 | 1105 |
| 1105 @synthesize invalidateShadowCount = invalidateShadowCount_; | 1106 @synthesize invalidateShadowCount = invalidateShadowCount_; |
| 1106 | 1107 |
| 1107 - (void)invalidateShadow { | 1108 - (void)invalidateShadow { |
| 1108 ++invalidateShadowCount_; | 1109 ++invalidateShadowCount_; |
| 1109 [super invalidateShadow]; | 1110 [super invalidateShadow]; |
| 1110 } | 1111 } |
| 1111 | 1112 |
| 1112 @end | 1113 @end |
| OLD | NEW |