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/WebSize.h" | 15 #include "third_party/WebKit/public/platform/WebSize.h" |
15 #include "webkit/renderer/compositor_bindings/web_external_bitmap_impl.h" | 16 #include "webkit/renderer/compositor_bindings/web_external_bitmap_impl.h" |
16 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" | 17 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" |
17 | 18 |
18 using cc::TextureLayer; | 19 using cc::TextureLayer; |
19 using cc::ResourceUpdateQueue; | 20 using cc::ResourceUpdateQueue; |
20 | 21 |
21 namespace webkit { | 22 namespace webkit { |
22 | 23 |
23 WebExternalTextureLayerImpl::WebExternalTextureLayerImpl( | 24 WebExternalTextureLayerImpl::WebExternalTextureLayerImpl( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 59 |
59 void WebExternalTextureLayerImpl::setRateLimitContext(bool rate_limit) { | 60 void WebExternalTextureLayerImpl::setRateLimitContext(bool rate_limit) { |
60 static_cast<TextureLayer*>(layer_->layer())->SetRateLimitContext(rate_limit); | 61 static_cast<TextureLayer*>(layer_->layer())->SetRateLimitContext(rate_limit); |
61 } | 62 } |
62 | 63 |
63 unsigned WebExternalTextureLayerImpl::PrepareTexture() { | 64 unsigned WebExternalTextureLayerImpl::PrepareTexture() { |
64 NOTREACHED(); | 65 NOTREACHED(); |
65 return 0; | 66 return 0; |
66 } | 67 } |
67 | 68 |
68 WebKit::WebGraphicsContext3D* WebExternalTextureLayerImpl::Context3d() { | |
69 DCHECK(client_); | |
70 return client_->context(); | |
71 } | |
72 | |
73 bool WebExternalTextureLayerImpl::PrepareTextureMailbox( | 69 bool WebExternalTextureLayerImpl::PrepareTextureMailbox( |
74 cc::TextureMailbox* mailbox, | 70 cc::TextureMailbox* mailbox, |
75 scoped_ptr<cc::SingleReleaseCallback>* release_callback, | 71 scoped_ptr<cc::SingleReleaseCallback>* release_callback, |
76 bool use_shared_memory) { | 72 bool use_shared_memory) { |
77 WebKit::WebExternalTextureMailbox client_mailbox; | 73 WebKit::WebExternalTextureMailbox client_mailbox; |
78 WebExternalBitmapImpl* bitmap = NULL; | 74 WebExternalBitmapImpl* bitmap = NULL; |
79 | 75 |
80 if (use_shared_memory) | 76 if (use_shared_memory) |
81 bitmap = AllocateBitmap(); | 77 bitmap = AllocateBitmap(); |
82 if (!client_->prepareMailbox(&client_mailbox, bitmap)) { | 78 if (!client_->prepareMailbox(&client_mailbox, bitmap)) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 121 |
126 WebKit::WebExternalTextureMailbox available_mailbox; | 122 WebKit::WebExternalTextureMailbox available_mailbox; |
127 memcpy(available_mailbox.name, mailbox.name, sizeof(available_mailbox.name)); | 123 memcpy(available_mailbox.name, mailbox.name, sizeof(available_mailbox.name)); |
128 available_mailbox.syncPoint = sync_point; | 124 available_mailbox.syncPoint = sync_point; |
129 if (bitmap) | 125 if (bitmap) |
130 layer->free_bitmaps_.push_back(bitmap); | 126 layer->free_bitmaps_.push_back(bitmap); |
131 layer->client_->mailboxReleased(available_mailbox); | 127 layer->client_->mailboxReleased(available_mailbox); |
132 } | 128 } |
133 | 129 |
134 } // namespace webkit | 130 } // namespace webkit |
OLD | NEW |