| 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 22 matching lines...) Expand all Loading... |
| 33 #include "public/platform/WebExternalBitmap.h" | 33 #include "public/platform/WebExternalBitmap.h" |
| 34 #include "public/platform/WebGraphicsContext3DProvider.h" | 34 #include "public/platform/WebGraphicsContext3DProvider.h" |
| 35 #include "public/platform/WebScheduler.h" | 35 #include "public/platform/WebScheduler.h" |
| 36 #include "public/platform/WebTaskRunner.h" | 36 #include "public/platform/WebTaskRunner.h" |
| 37 #include "public/platform/WebThread.h" | 37 #include "public/platform/WebThread.h" |
| 38 #include "public/platform/WebTraceLocation.h" | 38 #include "public/platform/WebTraceLocation.h" |
| 39 #include "testing/gmock/include/gmock/gmock.h" | 39 #include "testing/gmock/include/gmock/gmock.h" |
| 40 #include "testing/gtest/include/gtest/gtest.h" | 40 #include "testing/gtest/include/gtest/gtest.h" |
| 41 #include "third_party/skia/include/core/SkCanvas.h" | 41 #include "third_party/skia/include/core/SkCanvas.h" |
| 42 #include "third_party/skia/include/gpu/GrContext.h" | 42 #include "third_party/skia/include/gpu/GrContext.h" |
| 43 #include "third_party/skia/include/gpu/gl/GrGLTypes.h" |
| 43 #include "third_party/skia/include/gpu/gl/SkNullGLContext.h" | 44 #include "third_party/skia/include/gpu/gl/SkNullGLContext.h" |
| 44 #include "wtf/RefPtr.h" | 45 #include "wtf/RefPtr.h" |
| 45 | 46 |
| 46 using testing::AnyNumber; | 47 using testing::AnyNumber; |
| 47 using testing::AtLeast; | 48 using testing::AtLeast; |
| 48 using testing::InSequence; | 49 using testing::InSequence; |
| 49 using testing::Return; | 50 using testing::Return; |
| 50 using testing::Test; | 51 using testing::Test; |
| 51 using testing::_; | 52 using testing::_; |
| 52 | 53 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 MockCanvasContext mainMock; | 151 MockCanvasContext mainMock; |
| 151 OwnPtr<MockWebGraphicsContext3DProvider> mainMockProvider = adoptPtr(new
MockWebGraphicsContext3DProvider(&mainMock)); | 152 OwnPtr<MockWebGraphicsContext3DProvider> mainMockProvider = adoptPtr(new
MockWebGraphicsContext3DProvider(&mainMock)); |
| 152 | 153 |
| 153 ::testing::Mock::VerifyAndClearExpectations(&mainMock); | 154 ::testing::Mock::VerifyAndClearExpectations(&mainMock); |
| 154 | 155 |
| 155 { | 156 { |
| 156 Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(mainM
ockProvider.release(), IntSize(300, 150), 0, NonOpaque, Canvas2DLayerBridge::Dis
ableAcceleration))); | 157 Canvas2DLayerBridgePtr bridge(adoptRef(new Canvas2DLayerBridge(mainM
ockProvider.release(), IntSize(300, 150), 0, NonOpaque, Canvas2DLayerBridge::Dis
ableAcceleration))); |
| 157 | 158 |
| 158 ::testing::Mock::VerifyAndClearExpectations(&mainMock); | 159 ::testing::Mock::VerifyAndClearExpectations(&mainMock); |
| 159 | 160 |
| 160 unsigned textureId = bridge->newImageSnapshot(PreferAcceleration)->g
etTextureHandle(true); | 161 unsigned textureId = reinterpret_cast<const GrGLTextureInfo*>(bridge
->newImageSnapshot(PreferAcceleration)->getTextureHandle(true))->fID; |
| 161 EXPECT_EQ(textureId, 0u); | 162 EXPECT_EQ(textureId, 0u); |
| 162 | 163 |
| 163 ::testing::Mock::VerifyAndClearExpectations(&mainMock); | 164 ::testing::Mock::VerifyAndClearExpectations(&mainMock); |
| 164 } // bridge goes out of scope here | 165 } // bridge goes out of scope here |
| 165 | 166 |
| 166 ::testing::Mock::VerifyAndClearExpectations(&mainMock); | 167 ::testing::Mock::VerifyAndClearExpectations(&mainMock); |
| 167 } | 168 } |
| 168 | 169 |
| 169 void fallbackToSoftwareIfContextLost() | 170 void fallbackToSoftwareIfContextLost() |
| 170 { | 171 { |
| (...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 967 // Tear down the bridge on the thread so that 'bridge' can go out of scope | 968 // Tear down the bridge on the thread so that 'bridge' can go out of scope |
| 968 // without crashing due to thread checks | 969 // without crashing due to thread checks |
| 969 OwnPtr<WebWaitableEvent> bridgeDestroyedEvent = adoptPtr(Platform::current()
->createWaitableEvent()); | 970 OwnPtr<WebWaitableEvent> bridgeDestroyedEvent = adoptPtr(Platform::current()
->createWaitableEvent()); |
| 970 testThread->taskRunner()->postTask(BLINK_FROM_HERE, new DestroyBridgeTask(&b
ridge, bridgeDestroyedEvent.get())); | 971 testThread->taskRunner()->postTask(BLINK_FROM_HERE, new DestroyBridgeTask(&b
ridge, bridgeDestroyedEvent.get())); |
| 971 bridgeDestroyedEvent->wait(); | 972 bridgeDestroyedEvent->wait(); |
| 972 | 973 |
| 973 ::testing::Mock::VerifyAndClearExpectations(&mainMock); | 974 ::testing::Mock::VerifyAndClearExpectations(&mainMock); |
| 974 } | 975 } |
| 975 | 976 |
| 976 } // namespace blink | 977 } // namespace blink |
| OLD | NEW |