Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: content/renderer/browser_plugin/browser_plugin_compositing_helper.cc

Issue 11888010: Cosmetic cleanup to texture_layer mailboxes. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« cc/resource_provider.cc ('K') | « cc/texture_mailbox.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/texture_layer.h" 7 #include "cc/texture_layer.h"
8 #include "content/common/browser_plugin_messages.h" 8 #include "content/common/browser_plugin_messages.h"
9 #include "content/renderer/render_thread_impl.h" 9 #include "content/renderer/render_thread_impl.h"
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 buffer_size_ = size; 56 buffer_size_ = size;
57 UpdateUVRect(); 57 UpdateUVRect();
58 } 58 }
59 if (!last_mailbox_valid_) 59 if (!last_mailbox_valid_)
60 SendACK(std::string(), host_routing_id_, gpu_route_id, gpu_host_id, 0); 60 SendACK(std::string(), host_routing_id_, gpu_route_id, gpu_host_id, 0);
61 61
62 bool current_mailbox_valid = !mailbox_name.empty(); 62 bool current_mailbox_valid = !mailbox_name.empty();
63 if (!current_mailbox_valid && !last_mailbox_valid_) 63 if (!current_mailbox_valid && !last_mailbox_valid_)
64 return; 64 return;
65 65
66 cc::TextureLayer::MailboxCallback callback; 66 cc::TextureMailbox::ReleaseCallback callback;
67 if (current_mailbox_valid) { 67 if (current_mailbox_valid) {
68 callback = base::Bind(&SendACK, 68 callback = base::Bind(&SendACK,
69 mailbox_name, 69 mailbox_name,
70 host_routing_id_, 70 host_routing_id_,
71 gpu_route_id, 71 gpu_route_id,
72 gpu_host_id); 72 gpu_host_id);
73 } 73 }
74 texture_layer_->setTextureMailbox(mailbox_name, callback); 74 texture_layer_->setTextureMailbox(cc::TextureMailbox(mailbox_name,
75 callback));
75 last_mailbox_valid_ = current_mailbox_valid; 76 last_mailbox_valid_ = current_mailbox_valid;
76 } 77 }
77 78
78 void BrowserPluginCompositingHelper::SetContainerSize(const gfx::Size& size) { 79 void BrowserPluginCompositingHelper::SetContainerSize(const gfx::Size& size) {
79 if (container_size_ == size) 80 if (container_size_ == size)
80 return; 81 return;
81 82
82 container_size_ = size; 83 container_size_ = size;
83 UpdateUVRect(); 84 UpdateUVRect();
84 } 85 }
85 86
86 void BrowserPluginCompositingHelper::UpdateUVRect() { 87 void BrowserPluginCompositingHelper::UpdateUVRect() {
87 if (!texture_layer_) 88 if (!texture_layer_)
88 return; 89 return;
89 90
90 gfx::RectF uv_rect(0, 0, 1, 1); 91 gfx::RectF uv_rect(0, 0, 1, 1);
91 if (!buffer_size_.IsEmpty() && !container_size_.IsEmpty()) { 92 if (!buffer_size_.IsEmpty() && !container_size_.IsEmpty()) {
92 uv_rect.set_width(static_cast<float>(container_size_.width()) / 93 uv_rect.set_width(static_cast<float>(container_size_.width()) /
93 static_cast<float>(buffer_size_.width())); 94 static_cast<float>(buffer_size_.width()));
94 uv_rect.set_height(static_cast<float>(container_size_.height()) / 95 uv_rect.set_height(static_cast<float>(container_size_.height()) /
95 static_cast<float>(buffer_size_.height())); 96 static_cast<float>(buffer_size_.height()));
96 } 97 }
97 texture_layer_->setUVRect(uv_rect); 98 texture_layer_->setUVRect(uv_rect);
98 } 99 }
99 100
100 } // namespace content 101 } // namespace content
OLDNEW
« cc/resource_provider.cc ('K') | « cc/texture_mailbox.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698