OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "gpu/command_buffer/common/capabilities.h" | 5 #include "gpu/command_buffer/common/capabilities.h" |
6 #include "platform/RuntimeEnabledFeatures.h" | 6 #include "platform/RuntimeEnabledFeatures.h" |
7 #include "platform/graphics/gpu/DrawingBuffer.h" | 7 #include "platform/graphics/gpu/DrawingBuffer.h" |
8 #include "platform/graphics/gpu/Extensions3DUtil.h" | 8 #include "platform/graphics/gpu/Extensions3DUtil.h" |
9 #include "public/platform/WebGraphicsContext3DProvider.h" | 9 #include "public/platform/WebGraphicsContext3DProvider.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 GLsizei height, | 244 GLsizei height, |
245 GLenum internalformat) override { | 245 GLenum internalformat) override { |
246 if (m_createImageChromiumFail) | 246 if (m_createImageChromiumFail) |
247 return 0; | 247 return 0; |
248 m_imageSizes.set(m_currentImageId, IntSize(width, height)); | 248 m_imageSizes.set(m_currentImageId, IntSize(width, height)); |
249 return m_currentImageId++; | 249 return m_currentImageId++; |
250 } | 250 } |
251 | 251 |
252 MOCK_METHOD1(DestroyImageMock, void(GLuint imageId)); | 252 MOCK_METHOD1(DestroyImageMock, void(GLuint imageId)); |
253 void DestroyImageCHROMIUM(GLuint imageId) { | 253 void DestroyImageCHROMIUM(GLuint imageId) { |
254 m_imageSizes.remove(imageId); | 254 m_imageSizes.erase(imageId); |
255 // No textures should be bound to this. | 255 // No textures should be bound to this. |
256 CHECK(m_imageToTextureMap.find(imageId) == m_imageToTextureMap.end()); | 256 CHECK(m_imageToTextureMap.find(imageId) == m_imageToTextureMap.end()); |
257 m_imageSizes.remove(imageId); | 257 m_imageSizes.erase(imageId); |
258 DestroyImageMock(imageId); | 258 DestroyImageMock(imageId); |
259 } | 259 } |
260 | 260 |
261 MOCK_METHOD1(BindTexImage2DMock, void(GLint imageId)); | 261 MOCK_METHOD1(BindTexImage2DMock, void(GLint imageId)); |
262 void BindTexImage2DCHROMIUM(GLenum target, GLint imageId) { | 262 void BindTexImage2DCHROMIUM(GLenum target, GLint imageId) { |
263 if (target == imageCHROMIUMTextureTarget()) { | 263 if (target == imageCHROMIUMTextureTarget()) { |
264 m_textureSizes.set(m_boundTextures[target], | 264 m_textureSizes.set(m_boundTextures[target], |
265 m_imageSizes.find(imageId)->value); | 265 m_imageSizes.find(imageId)->value); |
266 m_imageToTextureMap.set(imageId, m_boundTextures[target]); | 266 m_imageToTextureMap.set(imageId, m_boundTextures[target]); |
267 BindTexImage2DMock(imageId); | 267 BindTexImage2DMock(imageId); |
268 } | 268 } |
269 } | 269 } |
270 | 270 |
271 MOCK_METHOD1(ReleaseTexImage2DMock, void(GLint imageId)); | 271 MOCK_METHOD1(ReleaseTexImage2DMock, void(GLint imageId)); |
272 void ReleaseTexImage2DCHROMIUM(GLenum target, GLint imageId) { | 272 void ReleaseTexImage2DCHROMIUM(GLenum target, GLint imageId) { |
273 if (target == imageCHROMIUMTextureTarget()) { | 273 if (target == imageCHROMIUMTextureTarget()) { |
274 m_imageSizes.set(m_currentImageId, IntSize()); | 274 m_imageSizes.set(m_currentImageId, IntSize()); |
275 m_imageToTextureMap.remove(imageId); | 275 m_imageToTextureMap.erase(imageId); |
276 ReleaseTexImage2DMock(imageId); | 276 ReleaseTexImage2DMock(imageId); |
277 } | 277 } |
278 } | 278 } |
279 | 279 |
280 void GenSyncTokenCHROMIUM(GLuint64 fenceSync, GLbyte* syncToken) override { | 280 void GenSyncTokenCHROMIUM(GLuint64 fenceSync, GLbyte* syncToken) override { |
281 static uint64_t uniqueId = 1; | 281 static uint64_t uniqueId = 1; |
282 gpu::SyncToken source(gpu::GPU_IO, 1, | 282 gpu::SyncToken source(gpu::GPU_IO, 1, |
283 gpu::CommandBufferId::FromUnsafeValue(uniqueId++), 2); | 283 gpu::CommandBufferId::FromUnsafeValue(uniqueId++), 2); |
284 memcpy(syncToken, &source, sizeof(source)); | 284 memcpy(syncToken, &source, sizeof(source)); |
285 } | 285 } |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 GLbyte m_currentMailboxByte = 0; | 392 GLbyte m_currentMailboxByte = 0; |
393 IntSize m_mostRecentlyProducedSize; | 393 IntSize m_mostRecentlyProducedSize; |
394 bool m_createImageChromiumFail = false; | 394 bool m_createImageChromiumFail = false; |
395 GLuint m_currentImageId = 1; | 395 GLuint m_currentImageId = 1; |
396 HashMap<GLuint, IntSize> m_textureSizes; | 396 HashMap<GLuint, IntSize> m_textureSizes; |
397 HashMap<GLuint, IntSize> m_imageSizes; | 397 HashMap<GLuint, IntSize> m_imageSizes; |
398 HashMap<GLuint, GLuint> m_imageToTextureMap; | 398 HashMap<GLuint, GLuint> m_imageToTextureMap; |
399 }; | 399 }; |
400 | 400 |
401 } // blink | 401 } // blink |
OLD | NEW |