| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "webkit/renderer/compositor_bindings/web_external_texture_layer_impl.h" | 5 #include "webkit/renderer/compositor_bindings/web_external_texture_layer_impl.h" |
| 6 | 6 |
| 7 #include "cc/layers/texture_layer.h" | 7 #include "cc/layers/texture_layer.h" |
| 8 #include "cc/resources/resource_update_queue.h" | 8 #include "cc/resources/resource_update_queue.h" |
| 9 #include "cc/resources/single_release_callback.h" | 9 #include "cc/resources/single_release_callback.h" |
| 10 #include "cc/resources/texture_mailbox.h" | 10 #include "cc/resources/texture_mailbox.h" |
| 11 #include "third_party/WebKit/public/platform/WebExternalTextureLayerClient.h" | 11 #include "third_party/WebKit/public/platform/WebExternalTextureLayerClient.h" |
| 12 #include "third_party/WebKit/public/platform/WebExternalTextureMailbox.h" | 12 #include "third_party/WebKit/public/platform/WebExternalTextureMailbox.h" |
| 13 #include "third_party/WebKit/public/platform/WebFloatRect.h" | 13 #include "third_party/WebKit/public/platform/WebFloatRect.h" |
| 14 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 14 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
| 15 #include "third_party/WebKit/public/platform/WebSize.h" | 15 #include "third_party/WebKit/public/platform/WebSize.h" |
| 16 #include "third_party/khronos/GLES2/gl2.h" |
| 16 #include "webkit/renderer/compositor_bindings/web_external_bitmap_impl.h" | 17 #include "webkit/renderer/compositor_bindings/web_external_bitmap_impl.h" |
| 17 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" | 18 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" |
| 18 | 19 |
| 19 using cc::TextureLayer; | 20 using cc::TextureLayer; |
| 20 using cc::ResourceUpdateQueue; | 21 using cc::ResourceUpdateQueue; |
| 21 | 22 |
| 22 namespace webkit { | 23 namespace webkit { |
| 23 | 24 |
| 24 WebExternalTextureLayerImpl::WebExternalTextureLayerImpl( | 25 WebExternalTextureLayerImpl::WebExternalTextureLayerImpl( |
| 25 blink::WebExternalTextureLayerClient* client) | 26 blink::WebExternalTextureLayerClient* client) |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 76 |
| 76 if (use_shared_memory) | 77 if (use_shared_memory) |
| 77 bitmap = AllocateBitmap(); | 78 bitmap = AllocateBitmap(); |
| 78 if (!client_->prepareMailbox(&client_mailbox, bitmap)) { | 79 if (!client_->prepareMailbox(&client_mailbox, bitmap)) { |
| 79 if (bitmap) | 80 if (bitmap) |
| 80 free_bitmaps_.push_back(bitmap); | 81 free_bitmaps_.push_back(bitmap); |
| 81 return false; | 82 return false; |
| 82 } | 83 } |
| 83 gpu::Mailbox name; | 84 gpu::Mailbox name; |
| 84 name.SetName(client_mailbox.name); | 85 name.SetName(client_mailbox.name); |
| 85 if (bitmap) | 86 if (bitmap) { |
| 86 *mailbox = cc::TextureMailbox(bitmap->shared_memory(), bitmap->size()); | 87 *mailbox = cc::TextureMailbox(bitmap->shared_memory(), bitmap->size()); |
| 87 else | 88 } else { |
| 88 *mailbox = cc::TextureMailbox(name, client_mailbox.syncPoint); | 89 *mailbox = |
| 90 cc::TextureMailbox(name, GL_TEXTURE_2D, client_mailbox.syncPoint); |
| 91 } |
| 89 | 92 |
| 90 if (mailbox->IsValid()) { | 93 if (mailbox->IsValid()) { |
| 91 *release_callback = cc::SingleReleaseCallback::Create(base::Bind( | 94 *release_callback = cc::SingleReleaseCallback::Create(base::Bind( |
| 92 &WebExternalTextureLayerImpl::DidReleaseMailbox, | 95 &WebExternalTextureLayerImpl::DidReleaseMailbox, |
| 93 this->AsWeakPtr(), | 96 this->AsWeakPtr(), |
| 94 client_mailbox, | 97 client_mailbox, |
| 95 bitmap)); | 98 bitmap)); |
| 96 } | 99 } |
| 97 | 100 |
| 98 return true; | 101 return true; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 121 | 124 |
| 122 blink::WebExternalTextureMailbox available_mailbox; | 125 blink::WebExternalTextureMailbox available_mailbox; |
| 123 memcpy(available_mailbox.name, mailbox.name, sizeof(available_mailbox.name)); | 126 memcpy(available_mailbox.name, mailbox.name, sizeof(available_mailbox.name)); |
| 124 available_mailbox.syncPoint = sync_point; | 127 available_mailbox.syncPoint = sync_point; |
| 125 if (bitmap) | 128 if (bitmap) |
| 126 layer->free_bitmaps_.push_back(bitmap); | 129 layer->free_bitmaps_.push_back(bitmap); |
| 127 layer->client_->mailboxReleased(available_mailbox); | 130 layer->client_->mailboxReleased(available_mailbox); |
| 128 } | 131 } |
| 129 | 132 |
| 130 } // namespace webkit | 133 } // namespace webkit |
| OLD | NEW |