OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "CCResourceProvider.h" | 7 #include "CCResourceProvider.h" |
8 #ifdef LOG | 8 #ifdef LOG |
9 #undef LOG | 9 #undef LOG |
10 #endif | 10 #endif |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 } | 100 } |
101 | 101 |
102 CCResourceProvider::Child::Child() | 102 CCResourceProvider::Child::Child() |
103 { | 103 { |
104 } | 104 } |
105 | 105 |
106 CCResourceProvider::Child::~Child() | 106 CCResourceProvider::Child::~Child() |
107 { | 107 { |
108 } | 108 } |
109 | 109 |
110 PassOwnPtr<CCResourceProvider> CCResourceProvider::create(CCGraphicsContext* con
text, TextureUploaderOption option) | 110 PassOwnPtr<CCResourceProvider> CCResourceProvider::create(CCGraphicsContext* con
text) |
111 { | 111 { |
112 OwnPtr<CCResourceProvider> resourceProvider(adoptPtr(new CCResourceProvider(
context))); | 112 OwnPtr<CCResourceProvider> resourceProvider(adoptPtr(new CCResourceProvider(
context))); |
113 if (!resourceProvider->initialize(option)) | 113 if (!resourceProvider->initialize()) |
114 return nullptr; | 114 return nullptr; |
115 return resourceProvider.release(); | 115 return resourceProvider.release(); |
116 } | 116 } |
117 | 117 |
118 CCResourceProvider::~CCResourceProvider() | 118 CCResourceProvider::~CCResourceProvider() |
119 { | 119 { |
120 WebGraphicsContext3D* context3d = m_context->context3D(); | 120 WebGraphicsContext3D* context3d = m_context->context3D(); |
121 if (!context3d || !context3d->makeContextCurrent()) | 121 if (!context3d || !context3d->makeContextCurrent()) |
122 return; | 122 return; |
123 m_textureUploader.clear(); | 123 m_textureUploader.clear(); |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 , m_nextId(1) | 440 , m_nextId(1) |
441 , m_nextChild(1) | 441 , m_nextChild(1) |
442 , m_defaultResourceType(GLTexture) | 442 , m_defaultResourceType(GLTexture) |
443 , m_useTextureStorageExt(false) | 443 , m_useTextureStorageExt(false) |
444 , m_useTextureUsageHint(false) | 444 , m_useTextureUsageHint(false) |
445 , m_useShallowFlush(false) | 445 , m_useShallowFlush(false) |
446 , m_maxTextureSize(0) | 446 , m_maxTextureSize(0) |
447 { | 447 { |
448 } | 448 } |
449 | 449 |
450 bool CCResourceProvider::initialize(TextureUploaderOption textureUploaderOption) | 450 bool CCResourceProvider::initialize() |
451 { | 451 { |
452 ASSERT(CCProxy::isImplThread()); | 452 ASSERT(CCProxy::isImplThread()); |
453 WebGraphicsContext3D* context3d = m_context->context3D(); | 453 WebGraphicsContext3D* context3d = m_context->context3D(); |
454 if (!context3d) { | 454 if (!context3d) { |
455 m_maxTextureSize = INT_MAX; | 455 m_maxTextureSize = INT_MAX; |
456 m_textureUploader = UnthrottledTextureUploader::create(); | 456 m_textureUploader = UnthrottledTextureUploader::create(); |
457 | 457 |
458 // FIXME: Implement this path for software compositing. | 458 // FIXME: Implement this path for software compositing. |
459 return false; | 459 return false; |
460 } | 460 } |
(...skipping 14 matching lines...) Expand all Loading... |
475 useMapSub = true; | 475 useMapSub = true; |
476 else if (extensions[i] == "GL_CHROMIUM_shallow_flush") | 476 else if (extensions[i] == "GL_CHROMIUM_shallow_flush") |
477 m_useShallowFlush = true; | 477 m_useShallowFlush = true; |
478 else if (extensions[i] == "GL_CHROMIUM_bind_uniform_location") | 478 else if (extensions[i] == "GL_CHROMIUM_bind_uniform_location") |
479 useBindUniform = true; | 479 useBindUniform = true; |
480 } | 480 } |
481 | 481 |
482 m_texSubImage = adoptPtr(new LayerTextureSubImage(useMapSub)); | 482 m_texSubImage = adoptPtr(new LayerTextureSubImage(useMapSub)); |
483 m_textureCopier = AcceleratedTextureCopier::create(context3d, useBindUniform
); | 483 m_textureCopier = AcceleratedTextureCopier::create(context3d, useBindUniform
); |
484 | 484 |
485 if (textureUploaderOption == ThrottledUploader) | 485 m_textureUploader = ThrottledTextureUploader::create(context3d); |
486 m_textureUploader = ThrottledTextureUploader::create(context3d); | |
487 else | |
488 m_textureUploader = UnthrottledTextureUploader::create(); | |
489 GLC(context3d, context3d->getIntegerv(GraphicsContext3D::MAX_TEXTURE_SIZE, &
m_maxTextureSize)); | 486 GLC(context3d, context3d->getIntegerv(GraphicsContext3D::MAX_TEXTURE_SIZE, &
m_maxTextureSize)); |
490 return true; | 487 return true; |
491 } | 488 } |
492 | 489 |
493 int CCResourceProvider::createChild(int pool) | 490 int CCResourceProvider::createChild(int pool) |
494 { | 491 { |
495 ASSERT(CCProxy::isImplThread()); | 492 ASSERT(CCProxy::isImplThread()); |
496 Child childInfo; | 493 Child childInfo; |
497 childInfo.pool = pool; | 494 childInfo.pool = pool; |
498 int child = m_nextChild++; | 495 int child = m_nextChild++; |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 if (childPoolSet.contains(it->second.pool)) | 698 if (childPoolSet.contains(it->second.pool)) |
702 #endif | 699 #endif |
703 ++maxMailboxCount; | 700 ++maxMailboxCount; |
704 } | 701 } |
705 } | 702 } |
706 while (m_mailboxes.size() > maxMailboxCount) | 703 while (m_mailboxes.size() > maxMailboxCount) |
707 m_mailboxes.removeFirst(); | 704 m_mailboxes.removeFirst(); |
708 } | 705 } |
709 | 706 |
710 } | 707 } |
OLD | NEW |