OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/renderer/browser_plugin/browser_plugin_compositing_helper.h" | 5 #include "content/renderer/browser_plugin/browser_plugin_compositing_helper.h" |
6 | 6 |
7 #include "cc/layers/solid_color_layer.h" | 7 #include "cc/layers/solid_color_layer.h" |
8 #include "cc/layers/texture_layer.h" | 8 #include "cc/layers/texture_layer.h" |
9 #include "cc/output/context_provider.h" | 9 #include "cc/output/context_provider.h" |
10 #include "content/common/browser_plugin/browser_plugin_messages.h" | 10 #include "content/common/browser_plugin/browser_plugin_messages.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 if (enable && !texture_layer_) { | 42 if (enable && !texture_layer_) { |
43 texture_layer_ = cc::TextureLayer::CreateForMailbox(); | 43 texture_layer_ = cc::TextureLayer::CreateForMailbox(); |
44 texture_layer_->SetIsDrawable(true); | 44 texture_layer_->SetIsDrawable(true); |
45 texture_layer_->SetContentsOpaque(true); | 45 texture_layer_->SetContentsOpaque(true); |
46 | 46 |
47 background_layer_ = cc::SolidColorLayer::Create(); | 47 background_layer_ = cc::SolidColorLayer::Create(); |
48 background_layer_->SetMasksToBounds(true); | 48 background_layer_->SetMasksToBounds(true); |
49 background_layer_->SetBackgroundColor( | 49 background_layer_->SetBackgroundColor( |
50 SkColorSetARGBInline(255, 255, 255, 255)); | 50 SkColorSetARGBInline(255, 255, 255, 255)); |
51 background_layer_->AddChild(texture_layer_); | 51 background_layer_->AddChild(texture_layer_); |
52 web_layer_.reset(new WebKit::WebLayerImpl(background_layer_)); | 52 web_layer_.reset(new webkit::WebLayerImpl(background_layer_)); |
53 } | 53 } |
54 | 54 |
55 container_->setWebLayer(enable ? web_layer_.get() : NULL); | 55 container_->setWebLayer(enable ? web_layer_.get() : NULL); |
56 } | 56 } |
57 | 57 |
58 // If we have a mailbox that was freed up from the compositor, | 58 // If we have a mailbox that was freed up from the compositor, |
59 // but we are not expected to return it to the guest renderer | 59 // but we are not expected to return it to the guest renderer |
60 // via an ACK, we should free it because we now own it. | 60 // via an ACK, we should free it because we now own it. |
61 // To free the mailbox memory, we need a context to consume it | 61 // To free the mailbox memory, we need a context to consume it |
62 // into a texture ID and then delete this texture ID. | 62 // into a texture ID and then delete this texture ID. |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 texture_layer_->SetNeedsDisplay(); | 221 texture_layer_->SetNeedsDisplay(); |
222 last_mailbox_valid_ = current_mailbox_valid; | 222 last_mailbox_valid_ = current_mailbox_valid; |
223 } | 223 } |
224 | 224 |
225 void BrowserPluginCompositingHelper::UpdateVisibility(bool visible) { | 225 void BrowserPluginCompositingHelper::UpdateVisibility(bool visible) { |
226 if (texture_layer_) | 226 if (texture_layer_) |
227 texture_layer_->SetIsDrawable(visible); | 227 texture_layer_->SetIsDrawable(visible); |
228 } | 228 } |
229 | 229 |
230 } // namespace content | 230 } // namespace content |
OLD | NEW |