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 bool WebExternalTextureLayerImpl::IsContextLost() { |
69 DCHECK(client_); | 70 DCHECK(client_); |
70 return client_->context(); | 71 return client_->context()->isContextLost(); |
| 72 } |
| 73 |
| 74 void WebExternalTextureLayerImpl::RateLimitContext() { |
| 75 DCHECK(client_); |
| 76 client_->context()->rateLimitOffscreenContextCHROMIUM(); |
71 } | 77 } |
72 | 78 |
73 bool WebExternalTextureLayerImpl::PrepareTextureMailbox( | 79 bool WebExternalTextureLayerImpl::PrepareTextureMailbox( |
74 cc::TextureMailbox* mailbox, | 80 cc::TextureMailbox* mailbox, |
75 scoped_ptr<cc::SingleReleaseCallback>* release_callback, | 81 scoped_ptr<cc::SingleReleaseCallback>* release_callback, |
76 bool use_shared_memory) { | 82 bool use_shared_memory) { |
77 WebKit::WebExternalTextureMailbox client_mailbox; | 83 WebKit::WebExternalTextureMailbox client_mailbox; |
78 WebExternalBitmapImpl* bitmap = NULL; | 84 WebExternalBitmapImpl* bitmap = NULL; |
79 | 85 |
80 if (use_shared_memory) | 86 if (use_shared_memory) |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 131 |
126 WebKit::WebExternalTextureMailbox available_mailbox; | 132 WebKit::WebExternalTextureMailbox available_mailbox; |
127 memcpy(available_mailbox.name, mailbox.name, sizeof(available_mailbox.name)); | 133 memcpy(available_mailbox.name, mailbox.name, sizeof(available_mailbox.name)); |
128 available_mailbox.syncPoint = sync_point; | 134 available_mailbox.syncPoint = sync_point; |
129 if (bitmap) | 135 if (bitmap) |
130 layer->free_bitmaps_.push_back(bitmap); | 136 layer->free_bitmaps_.push_back(bitmap); |
131 layer->client_->mailboxReleased(available_mailbox); | 137 layer->client_->mailboxReleased(available_mailbox); |
132 } | 138 } |
133 | 139 |
134 } // namespace webkit | 140 } // namespace webkit |
OLD | NEW |