| 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 |
| 11 | 11 |
| 12 #include <limits.h> | 12 #include <limits.h> |
| 13 | 13 |
| 14 #include "base/debug/alias.h" | 14 #include "base/debug/alias.h" |
| 15 #include "base/string_split.h" | 15 #include "base/string_split.h" |
| 16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
| 17 #include "cc/transferable_resource.h" |
| 17 #include "CCProxy.h" | 18 #include "CCProxy.h" |
| 18 #include "CCRendererGL.h" // For the GLC() macro. | 19 #include "CCRendererGL.h" // For the GLC() macro. |
| 19 #include "Extensions3DChromium.h" | 20 #include "Extensions3DChromium.h" |
| 20 #include "IntRect.h" | 21 #include "IntRect.h" |
| 21 #include "LayerTextureSubImage.h" | 22 #include "LayerTextureSubImage.h" |
| 22 #include "ThrottledTextureUploader.h" | 23 #include "ThrottledTextureUploader.h" |
| 23 #include "UnthrottledTextureUploader.h" | 24 #include "UnthrottledTextureUploader.h" |
| 24 #include <public/WebGraphicsContext3D.h> | 25 #include <public/WebGraphicsContext3D.h> |
| 25 #include <wtf/HashSet.h> | 26 #include <wtf/HashSet.h> |
| 26 | 27 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 43 } | 44 } |
| 44 | 45 |
| 45 return storageFormat; | 46 return storageFormat; |
| 46 } | 47 } |
| 47 | 48 |
| 48 static bool isTextureFormatSupportedForStorage(GC3Denum format) | 49 static bool isTextureFormatSupportedForStorage(GC3Denum format) |
| 49 { | 50 { |
| 50 return (format == GraphicsContext3D::RGBA || format == Extensions3D::BGRA_EX
T); | 51 return (format == GraphicsContext3D::RGBA || format == Extensions3D::BGRA_EX
T); |
| 51 } | 52 } |
| 52 | 53 |
| 53 CCResourceProvider::TransferableResourceList::TransferableResourceList() | |
| 54 { | |
| 55 } | |
| 56 | |
| 57 CCResourceProvider::TransferableResourceList::~TransferableResourceList() | |
| 58 { | |
| 59 } | |
| 60 | |
| 61 CCResourceProvider::Resource::Resource() | 54 CCResourceProvider::Resource::Resource() |
| 62 : glId(0) | 55 : glId(0) |
| 63 , pixels(0) | 56 , pixels(0) |
| 64 , pool(0) | 57 , pool(0) |
| 65 , lockForReadCount(0) | 58 , lockForReadCount(0) |
| 66 , lockedForWrite(false) | 59 , lockedForWrite(false) |
| 67 , external(false) | 60 , external(false) |
| 68 , exported(false) | 61 , exported(false) |
| 69 , markedForDeletion(false) | 62 , deleted(false) |
| 70 , size() | 63 , size() |
| 71 , format(0) | 64 , format(0) |
| 72 , type(static_cast<ResourceType>(0)) | 65 , type(static_cast<ResourceType>(0)) |
| 73 { | 66 { |
| 74 } | 67 } |
| 75 | 68 |
| 76 CCResourceProvider::Resource::Resource(unsigned textureId, int pool, const IntSi
ze& size, GC3Denum format) | 69 CCResourceProvider::Resource::Resource(unsigned textureId, int pool, const IntSi
ze& size, GC3Denum format) |
| 77 : glId(textureId) | 70 : glId(textureId) |
| 78 , pixels(0) | 71 , pixels(0) |
| 79 , pool(pool) | 72 , pool(pool) |
| 80 , lockForReadCount(0) | 73 , lockForReadCount(0) |
| 81 , lockedForWrite(false) | 74 , lockedForWrite(false) |
| 82 , external(false) | 75 , external(false) |
| 83 , exported(false) | 76 , exported(false) |
| 84 , markedForDeletion(false) | 77 , deleted(false) |
| 85 , size(size) | 78 , size(size) |
| 86 , format(format) | 79 , format(format) |
| 87 , type(GLTexture) | 80 , type(GLTexture) |
| 88 { | 81 { |
| 89 } | 82 } |
| 90 | 83 |
| 91 CCResourceProvider::Resource::Resource(uint8_t* pixels, int pool, const IntSize&
size, GC3Denum format) | 84 CCResourceProvider::Resource::Resource(uint8_t* pixels, int pool, const IntSize&
size, GC3Denum format) |
| 92 : glId(0) | 85 : glId(0) |
| 93 , pixels(pixels) | 86 , pixels(pixels) |
| 94 , pool(pool) | 87 , pool(pool) |
| 95 , lockForReadCount(0) | 88 , lockForReadCount(0) |
| 96 , lockedForWrite(false) | 89 , lockedForWrite(false) |
| 97 , external(false) | 90 , external(false) |
| 98 , exported(false) | 91 , exported(false) |
| 99 , markedForDeletion(false) | 92 , deleted(false) |
| 100 , size(size) | 93 , size(size) |
| 101 , format(format) | 94 , format(format) |
| 102 , type(Bitmap) | 95 , type(Bitmap) |
| 103 { | 96 { |
| 104 } | 97 } |
| 105 | 98 |
| 106 CCResourceProvider::Child::Child() | 99 CCResourceProvider::Child::Child() |
| 107 { | 100 { |
| 108 } | 101 } |
| 109 | 102 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 ASSERT(CCProxy::isImplThread()); | 208 ASSERT(CCProxy::isImplThread()); |
| 216 ResourceMap::iterator it = m_resources.find(id); | 209 ResourceMap::iterator it = m_resources.find(id); |
| 217 CHECK(it != m_resources.end()); | 210 CHECK(it != m_resources.end()); |
| 218 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE | 211 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE |
| 219 Resource* resource = &it->value; | 212 Resource* resource = &it->value; |
| 220 #else | 213 #else |
| 221 Resource* resource = &it->second; | 214 Resource* resource = &it->second; |
| 222 #endif | 215 #endif |
| 223 ASSERT(!resource->lockedForWrite); | 216 ASSERT(!resource->lockedForWrite); |
| 224 ASSERT(!resource->lockForReadCount); | 217 ASSERT(!resource->lockForReadCount); |
| 225 ASSERT(!resource->markedForDeletion); | 218 ASSERT(!resource->deleted); |
| 226 | 219 |
| 227 if (resource->exported) { | 220 if (resource->exported) { |
| 228 resource->markedForDeletion = true; | 221 resource->deleted = true; |
| 229 return; | 222 return; |
| 230 } else | 223 } else |
| 231 deleteResourceInternal(it); | 224 deleteResourceInternal(it); |
| 232 } | 225 } |
| 233 | 226 |
| 234 void CCResourceProvider::deleteResourceInternal(ResourceMap::iterator it) | 227 void CCResourceProvider::deleteResourceInternal(ResourceMap::iterator it) |
| 235 { | 228 { |
| 236 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE | 229 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE |
| 237 Resource* resource = &it->value; | 230 Resource* resource = &it->value; |
| 238 #else | 231 #else |
| 239 Resource* resource = &it->second; | 232 Resource* resource = &it->second; |
| 240 #endif | 233 #endif |
| 241 if (resource->glId && !resource->external) { | 234 if (resource->glId && !resource->external) { |
| 242 WebGraphicsContext3D* context3d = m_context->context3D(); | 235 WebGraphicsContext3D* context3d = m_context->context3D(); |
| 243 ASSERT(context3d); | 236 ASSERT(context3d); |
| 244 GLC(context3d, context3d->deleteTexture(resource->glId)); | 237 GLC(context3d, context3d->deleteTexture(resource->glId)); |
| 245 } | 238 } |
| 246 if (resource->pixels) | 239 if (resource->pixels) |
| 247 delete resource->pixels; | 240 delete resource->pixels; |
| 248 | 241 |
| 249 m_resources.remove(it); | 242 m_resources.remove(it); |
| 250 } | 243 } |
| 251 | 244 |
| 252 void CCResourceProvider::deleteOwnedResources(int pool) | 245 void CCResourceProvider::deleteOwnedResources(int pool) |
| 253 { | 246 { |
| 254 ASSERT(CCProxy::isImplThread()); | 247 ASSERT(CCProxy::isImplThread()); |
| 255 ResourceIdArray toDelete; | 248 ResourceIdArray toDelete; |
| 256 for (ResourceMap::iterator it = m_resources.begin(); it != m_resources.end()
; ++it) { | 249 for (ResourceMap::iterator it = m_resources.begin(); it != m_resources.end()
; ++it) { |
| 257 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE | 250 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE |
| 258 if (it->value.pool == pool && !it->value.external && !it->value.markedFo
rDeletion) | 251 if (it->value.pool == pool && !it->value.external && !it->value.deleted) |
| 259 toDelete.append(it->key); | 252 toDelete.append(it->key); |
| 260 #else | 253 #else |
| 261 if (it->second.pool == pool && !it->second.external && !it->value.marked
ForDeletion) | 254 if (it->second.pool == pool && !it->second.external && !it->value.delete
d) |
| 262 toDelete.append(it->first); | 255 toDelete.append(it->first); |
| 263 #endif | 256 #endif |
| 264 } | 257 } |
| 265 for (ResourceIdArray::iterator it = toDelete.begin(); it != toDelete.end();
++it) | 258 for (ResourceIdArray::iterator it = toDelete.begin(); it != toDelete.end();
++it) |
| 266 deleteResource(*it); | 259 deleteResource(*it); |
| 267 } | 260 } |
| 268 | 261 |
| 269 CCResourceProvider::ResourceType CCResourceProvider::resourceType(ResourceId id) | 262 CCResourceProvider::ResourceType CCResourceProvider::resourceType(ResourceId id) |
| 270 { | 263 { |
| 271 ResourceMap::iterator it = m_resources.find(id); | 264 ResourceMap::iterator it = m_resources.find(id); |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 ASSERT(CCProxy::isImplThread()); | 532 ASSERT(CCProxy::isImplThread()); |
| 540 ChildMap::const_iterator it = m_children.find(child); | 533 ChildMap::const_iterator it = m_children.find(child); |
| 541 ASSERT(it != m_children.end()); | 534 ASSERT(it != m_children.end()); |
| 542 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE | 535 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE |
| 543 return it->value.childToParentMap; | 536 return it->value.childToParentMap; |
| 544 #else | 537 #else |
| 545 return it->second.childToParentMap; | 538 return it->second.childToParentMap; |
| 546 #endif | 539 #endif |
| 547 } | 540 } |
| 548 | 541 |
| 549 CCResourceProvider::TransferableResourceList CCResourceProvider::prepareSendToPa
rent(const ResourceIdArray& resources) | 542 void CCResourceProvider::prepareSendToParent(const ResourceIdArray& resources, T
ransferableResourceList* list) |
| 550 { | 543 { |
| 551 ASSERT(CCProxy::isImplThread()); | 544 ASSERT(CCProxy::isImplThread()); |
| 552 TransferableResourceList list; | 545 list->sync_point = 0; |
| 553 list.syncPoint = 0; | 546 list->resources.clear(); |
| 554 WebGraphicsContext3D* context3d = m_context->context3D(); | 547 WebGraphicsContext3D* context3d = m_context->context3D(); |
| 555 if (!context3d || !context3d->makeContextCurrent()) { | 548 if (!context3d || !context3d->makeContextCurrent()) { |
| 556 // FIXME: Implement this path for software compositing. | 549 // FIXME: Implement this path for software compositing. |
| 557 return list; | 550 return; |
| 558 } | 551 } |
| 559 for (ResourceIdArray::const_iterator it = resources.begin(); it != resources
.end(); ++it) { | 552 for (ResourceIdArray::const_iterator it = resources.begin(); it != resources
.end(); ++it) { |
| 560 TransferableResource resource; | 553 TransferableResource resource; |
| 561 if (transferResource(context3d, *it, &resource)) { | 554 if (transferResource(context3d, *it, &resource)) { |
| 562 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE | 555 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE |
| 563 m_resources.find(*it)->value.exported = true; | 556 m_resources.find(*it)->value.exported = true; |
| 564 #else | 557 #else |
| 565 m_resources.find(*it)->second.exported = true; | 558 m_resources.find(*it)->second.exported = true; |
| 566 #endif | 559 #endif |
| 567 list.resources.append(resource); | 560 list->resources.push_back(resource); |
| 568 } | 561 } |
| 569 } | 562 } |
| 570 if (list.resources.size()) | 563 if (list->resources.size()) |
| 571 list.syncPoint = context3d->insertSyncPoint(); | 564 list->sync_point = context3d->insertSyncPoint(); |
| 572 return list; | |
| 573 } | 565 } |
| 574 | 566 |
| 575 CCResourceProvider::TransferableResourceList CCResourceProvider::prepareSendToCh
ild(int child, const ResourceIdArray& resources) | 567 void CCResourceProvider::prepareSendToChild(int child, const ResourceIdArray& re
sources, TransferableResourceList* list) |
| 576 { | 568 { |
| 577 ASSERT(CCProxy::isImplThread()); | 569 ASSERT(CCProxy::isImplThread()); |
| 578 TransferableResourceList list; | 570 list->sync_point = 0; |
| 579 list.syncPoint = 0; | 571 list->resources.clear(); |
| 580 WebGraphicsContext3D* context3d = m_context->context3D(); | 572 WebGraphicsContext3D* context3d = m_context->context3D(); |
| 581 if (!context3d || !context3d->makeContextCurrent()) { | 573 if (!context3d || !context3d->makeContextCurrent()) { |
| 582 // FIXME: Implement this path for software compositing. | 574 // FIXME: Implement this path for software compositing. |
| 583 return list; | 575 return; |
| 584 } | 576 } |
| 585 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE | 577 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE |
| 586 Child& childInfo = m_children.find(child)->value; | 578 Child& childInfo = m_children.find(child)->value; |
| 587 #else | 579 #else |
| 588 Child& childInfo = m_children.find(child)->second; | 580 Child& childInfo = m_children.find(child)->second; |
| 589 #endif | 581 #endif |
| 590 for (ResourceIdArray::const_iterator it = resources.begin(); it != resources
.end(); ++it) { | 582 for (ResourceIdArray::const_iterator it = resources.begin(); it != resources
.end(); ++it) { |
| 591 TransferableResource resource; | 583 TransferableResource resource; |
| 592 if (!transferResource(context3d, *it, &resource)) | 584 if (!transferResource(context3d, *it, &resource)) |
| 593 ASSERT_NOT_REACHED(); | 585 ASSERT_NOT_REACHED(); |
| 594 resource.id = childInfo.parentToChildMap.get(*it); | 586 resource.id = childInfo.parentToChildMap.get(*it); |
| 595 childInfo.parentToChildMap.remove(*it); | 587 childInfo.parentToChildMap.remove(*it); |
| 596 childInfo.childToParentMap.remove(resource.id); | 588 childInfo.childToParentMap.remove(resource.id); |
| 597 list.resources.append(resource); | 589 list->resources.push_back(resource); |
| 598 deleteResource(*it); | 590 deleteResource(*it); |
| 599 } | 591 } |
| 600 if (list.resources.size()) | 592 if (list->resources.size()) |
| 601 list.syncPoint = context3d->insertSyncPoint(); | 593 list->sync_point = context3d->insertSyncPoint(); |
| 602 return list; | |
| 603 } | 594 } |
| 604 | 595 |
| 605 void CCResourceProvider::receiveFromChild(int child, const TransferableResourceL
ist& resources) | 596 void CCResourceProvider::receiveFromChild(int child, const TransferableResourceL
ist& resources) |
| 606 { | 597 { |
| 607 ASSERT(CCProxy::isImplThread()); | 598 ASSERT(CCProxy::isImplThread()); |
| 608 WebGraphicsContext3D* context3d = m_context->context3D(); | 599 WebGraphicsContext3D* context3d = m_context->context3D(); |
| 609 if (!context3d || !context3d->makeContextCurrent()) { | 600 if (!context3d || !context3d->makeContextCurrent()) { |
| 610 // FIXME: Implement this path for software compositing. | 601 // FIXME: Implement this path for software compositing. |
| 611 return; | 602 return; |
| 612 } | 603 } |
| 613 if (resources.syncPoint) { | 604 if (resources.sync_point) { |
| 614 // NOTE: If the parent is a browser and the child a renderer, the parent | 605 // NOTE: If the parent is a browser and the child a renderer, the parent |
| 615 // is not supposed to have its context wait, because that could induce | 606 // is not supposed to have its context wait, because that could induce |
| 616 // deadlocks and/or security issues. The caller is responsible for | 607 // deadlocks and/or security issues. The caller is responsible for |
| 617 // waiting asynchronously, and resetting syncPoint before calling this. | 608 // waiting asynchronously, and resetting sync_point before calling this. |
| 618 // However if the parent is a renderer (e.g. browser tag), it may be ok | 609 // However if the parent is a renderer (e.g. browser tag), it may be ok |
| 619 // (and is simpler) to wait. | 610 // (and is simpler) to wait. |
| 620 GLC(context3d, context3d->waitSyncPoint(resources.syncPoint)); | 611 GLC(context3d, context3d->waitSyncPoint(resources.sync_point)); |
| 621 } | 612 } |
| 622 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE | 613 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE |
| 623 Child& childInfo = m_children.find(child)->value; | 614 Child& childInfo = m_children.find(child)->value; |
| 624 #else | 615 #else |
| 625 Child& childInfo = m_children.find(child)->second; | 616 Child& childInfo = m_children.find(child)->second; |
| 626 #endif | 617 #endif |
| 627 for (Vector<TransferableResource>::const_iterator it = resources.resources.b
egin(); it != resources.resources.end(); ++it) { | 618 for (std::vector<TransferableResource>::const_iterator it = resources.resour
ces.begin(); it != resources.resources.end(); ++it) { |
| 628 unsigned textureId; | 619 unsigned textureId; |
| 629 GLC(context3d, textureId = context3d->createTexture()); | 620 GLC(context3d, textureId = context3d->createTexture()); |
| 630 GLC(context3d, context3d->bindTexture(GraphicsContext3D::TEXTURE_2D, tex
tureId)); | 621 GLC(context3d, context3d->bindTexture(GraphicsContext3D::TEXTURE_2D, tex
tureId)); |
| 631 GLC(context3d, context3d->consumeTextureCHROMIUM(GraphicsContext3D::TEXT
URE_2D, it->mailbox.name)); | 622 GLC(context3d, context3d->consumeTextureCHROMIUM(GraphicsContext3D::TEXT
URE_2D, it->mailbox.name)); |
| 632 ResourceId id = m_nextId++; | 623 ResourceId id = m_nextId++; |
| 633 Resource resource(textureId, childInfo.pool, it->size, it->format); | 624 Resource resource(textureId, childInfo.pool, IntSize(it->size.width(), i
t->size.height()), it->format); |
| 634 m_resources.add(id, resource); | 625 m_resources.add(id, resource); |
| 635 m_mailboxes.append(it->mailbox); | 626 m_mailboxes.append(it->mailbox); |
| 636 childInfo.parentToChildMap.add(id, it->id); | 627 childInfo.parentToChildMap.add(id, it->id); |
| 637 childInfo.childToParentMap.add(it->id, id); | 628 childInfo.childToParentMap.add(it->id, id); |
| 638 } | 629 } |
| 639 } | 630 } |
| 640 | 631 |
| 641 void CCResourceProvider::receiveFromParent(const TransferableResourceList& resou
rces) | 632 void CCResourceProvider::receiveFromParent(const TransferableResourceList& resou
rces) |
| 642 { | 633 { |
| 643 ASSERT(CCProxy::isImplThread()); | 634 ASSERT(CCProxy::isImplThread()); |
| 644 WebGraphicsContext3D* context3d = m_context->context3D(); | 635 WebGraphicsContext3D* context3d = m_context->context3D(); |
| 645 if (!context3d || !context3d->makeContextCurrent()) { | 636 if (!context3d || !context3d->makeContextCurrent()) { |
| 646 // FIXME: Implement this path for software compositing. | 637 // FIXME: Implement this path for software compositing. |
| 647 return; | 638 return; |
| 648 } | 639 } |
| 649 if (resources.syncPoint) | 640 if (resources.sync_point) |
| 650 GLC(context3d, context3d->waitSyncPoint(resources.syncPoint)); | 641 GLC(context3d, context3d->waitSyncPoint(resources.sync_point)); |
| 651 for (Vector<TransferableResource>::const_iterator it = resources.resources.b
egin(); it != resources.resources.end(); ++it) { | 642 for (std::vector<TransferableResource>::const_iterator it = resources.resour
ces.begin(); it != resources.resources.end(); ++it) { |
| 652 ResourceMap::iterator mapIterator = m_resources.find(it->id); | 643 ResourceMap::iterator mapIterator = m_resources.find(it->id); |
| 653 ASSERT(mapIterator != m_resources.end()); | 644 ASSERT(mapIterator != m_resources.end()); |
| 654 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE | 645 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE |
| 655 Resource* resource = &mapIterator->value; | 646 Resource* resource = &mapIterator->value; |
| 656 #else | 647 #else |
| 657 Resource* resource = &mapIterator->second; | 648 Resource* resource = &mapIterator->second; |
| 658 #endif | 649 #endif |
| 659 ASSERT(resource->exported); | 650 ASSERT(resource->exported); |
| 660 resource->exported = false; | 651 resource->exported = false; |
| 661 GLC(context3d, context3d->bindTexture(GraphicsContext3D::TEXTURE_2D, res
ource->glId)); | 652 GLC(context3d, context3d->bindTexture(GraphicsContext3D::TEXTURE_2D, res
ource->glId)); |
| 662 GLC(context3d, context3d->consumeTextureCHROMIUM(GraphicsContext3D::TEXT
URE_2D, it->mailbox.name)); | 653 GLC(context3d, context3d->consumeTextureCHROMIUM(GraphicsContext3D::TEXT
URE_2D, it->mailbox.name)); |
| 663 m_mailboxes.append(it->mailbox); | 654 m_mailboxes.append(it->mailbox); |
| 664 if (resource->markedForDeletion) | 655 if (resource->deleted) |
| 665 deleteResourceInternal(mapIterator); | 656 deleteResourceInternal(mapIterator); |
| 666 } | 657 } |
| 667 } | 658 } |
| 668 | 659 |
| 669 bool CCResourceProvider::transferResource(WebGraphicsContext3D* context, Resourc
eId id, TransferableResource* resource) | 660 bool CCResourceProvider::transferResource(WebGraphicsContext3D* context, Resourc
eId id, TransferableResource* resource) |
| 670 { | 661 { |
| 671 ASSERT(CCProxy::isImplThread()); | 662 ASSERT(CCProxy::isImplThread()); |
| 672 ResourceMap::const_iterator it = m_resources.find(id); | 663 ResourceMap::const_iterator it = m_resources.find(id); |
| 673 CHECK(it != m_resources.end()); | 664 CHECK(it != m_resources.end()); |
| 674 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE | 665 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE |
| 675 const Resource* source = &it->value; | 666 const Resource* source = &it->value; |
| 676 #else | 667 #else |
| 677 const Resource* source = &it->second; | 668 const Resource* source = &it->second; |
| 678 #endif | 669 #endif |
| 679 ASSERT(!source->lockedForWrite); | 670 ASSERT(!source->lockedForWrite); |
| 680 ASSERT(!source->lockForReadCount); | 671 ASSERT(!source->lockForReadCount); |
| 681 ASSERT(!source->external); | 672 ASSERT(!source->external); |
| 682 if (source->exported) | 673 if (source->exported) |
| 683 return false; | 674 return false; |
| 684 resource->id = id; | 675 resource->id = id; |
| 685 resource->format = source->format; | 676 resource->format = source->format; |
| 686 resource->size = source->size; | 677 resource->size = gfx::Size(source->size.height(), source->size.width()); |
| 687 if (!m_mailboxes.isEmpty()) | 678 if (!m_mailboxes.isEmpty()) |
| 688 resource->mailbox = m_mailboxes.takeFirst(); | 679 resource->mailbox = m_mailboxes.takeFirst(); |
| 689 else | 680 else |
| 690 GLC(context, context->genMailboxCHROMIUM(resource->mailbox.name)); | 681 GLC(context, context->genMailboxCHROMIUM(resource->mailbox.name)); |
| 691 GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, source->glI
d)); | 682 GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, source->glI
d)); |
| 692 GLC(context, context->produceTextureCHROMIUM(GraphicsContext3D::TEXTURE_2D,
resource->mailbox.name)); | 683 GLC(context, context->produceTextureCHROMIUM(GraphicsContext3D::TEXTURE_2D,
resource->mailbox.name)); |
| 693 return true; | 684 return true; |
| 694 } | 685 } |
| 695 | 686 |
| 696 void CCResourceProvider::trimMailboxDeque() | 687 void CCResourceProvider::trimMailboxDeque() |
| (...skipping 28 matching lines...) Expand all Loading... |
| 725 if (childPoolSet.contains(it->second.pool)) | 716 if (childPoolSet.contains(it->second.pool)) |
| 726 #endif | 717 #endif |
| 727 ++maxMailboxCount; | 718 ++maxMailboxCount; |
| 728 } | 719 } |
| 729 } | 720 } |
| 730 while (m_mailboxes.size() > maxMailboxCount) | 721 while (m_mailboxes.size() > maxMailboxCount) |
| 731 m_mailboxes.removeFirst(); | 722 m_mailboxes.removeFirst(); |
| 732 } | 723 } |
| 733 | 724 |
| 734 } | 725 } |
| OLD | NEW |