OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 using testing::_; | 62 using testing::_; |
63 | 63 |
64 namespace blink { | 64 namespace blink { |
65 | 65 |
66 namespace { | 66 namespace { |
67 | 67 |
68 class Canvas2DLayerBridgePtr { | 68 class Canvas2DLayerBridgePtr { |
69 public: | 69 public: |
70 Canvas2DLayerBridgePtr() {} | 70 Canvas2DLayerBridgePtr() {} |
71 Canvas2DLayerBridgePtr(PassRefPtr<Canvas2DLayerBridge> layer_bridge) | 71 Canvas2DLayerBridgePtr(PassRefPtr<Canvas2DLayerBridge> layer_bridge) |
72 : layer_bridge_(layer_bridge) {} | 72 : layer_bridge_(std::move(layer_bridge)) {} |
73 | 73 |
74 ~Canvas2DLayerBridgePtr() { Clear(); } | 74 ~Canvas2DLayerBridgePtr() { Clear(); } |
75 | 75 |
76 void Clear() { | 76 void Clear() { |
77 if (layer_bridge_) { | 77 if (layer_bridge_) { |
78 layer_bridge_->BeginDestruction(); | 78 layer_bridge_->BeginDestruction(); |
79 layer_bridge_.Clear(); | 79 layer_bridge_.Clear(); |
80 } | 80 } |
81 } | 81 } |
82 | 82 |
83 void operator=(PassRefPtr<Canvas2DLayerBridge> layer_bridge) { | 83 void operator=(PassRefPtr<Canvas2DLayerBridge> layer_bridge) { |
84 DCHECK(!layer_bridge_); | 84 DCHECK(!layer_bridge_); |
85 layer_bridge_ = layer_bridge; | 85 layer_bridge_ = std::move(layer_bridge); |
86 } | 86 } |
87 | 87 |
88 Canvas2DLayerBridge* operator->() { return layer_bridge_.Get(); } | 88 Canvas2DLayerBridge* operator->() { return layer_bridge_.Get(); } |
89 Canvas2DLayerBridge* Get() { return layer_bridge_.Get(); } | 89 Canvas2DLayerBridge* Get() { return layer_bridge_.Get(); } |
90 | 90 |
91 private: | 91 private: |
92 RefPtr<Canvas2DLayerBridge> layer_bridge_; | 92 RefPtr<Canvas2DLayerBridge> layer_bridge_; |
93 }; | 93 }; |
94 | 94 |
95 class FakeGLES2InterfaceWithImageSupport : public FakeGLES2Interface { | 95 class FakeGLES2InterfaceWithImageSupport : public FakeGLES2Interface { |
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1379 EXPECT_FALSE(bridge->HasRecordedDrawCommands()); | 1379 EXPECT_FALSE(bridge->HasRecordedDrawCommands()); |
1380 ::testing::Mock::VerifyAndClearExpectations(&gl); | 1380 ::testing::Mock::VerifyAndClearExpectations(&gl); |
1381 | 1381 |
1382 EXPECT_CALL(gl, Flush()).Times(1); | 1382 EXPECT_CALL(gl, Flush()).Times(1); |
1383 bridge->FlushGpu(); | 1383 bridge->FlushGpu(); |
1384 EXPECT_FALSE(bridge->HasRecordedDrawCommands()); | 1384 EXPECT_FALSE(bridge->HasRecordedDrawCommands()); |
1385 ::testing::Mock::VerifyAndClearExpectations(&gl); | 1385 ::testing::Mock::VerifyAndClearExpectations(&gl); |
1386 } | 1386 } |
1387 | 1387 |
1388 } // namespace blink | 1388 } // namespace blink |
OLD | NEW |