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

Side by Side Diff: cc/trees/layer_tree_host.cc

Issue 22313011: (not for review) Add overhang resource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add_wrap_mode
Patch Set: Created 7 years, 4 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
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "cc/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <stack> 8 #include <stack>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 20 matching lines...) Expand all
31 #include "cc/resources/prioritized_resource_manager.h" 31 #include "cc/resources/prioritized_resource_manager.h"
32 #include "cc/resources/ui_resource_client.h" 32 #include "cc/resources/ui_resource_client.h"
33 #include "cc/trees/layer_tree_host_client.h" 33 #include "cc/trees/layer_tree_host_client.h"
34 #include "cc/trees/layer_tree_host_common.h" 34 #include "cc/trees/layer_tree_host_common.h"
35 #include "cc/trees/layer_tree_host_impl.h" 35 #include "cc/trees/layer_tree_host_impl.h"
36 #include "cc/trees/layer_tree_impl.h" 36 #include "cc/trees/layer_tree_impl.h"
37 #include "cc/trees/occlusion_tracker.h" 37 #include "cc/trees/occlusion_tracker.h"
38 #include "cc/trees/single_thread_proxy.h" 38 #include "cc/trees/single_thread_proxy.h"
39 #include "cc/trees/thread_proxy.h" 39 #include "cc/trees/thread_proxy.h"
40 #include "cc/trees/tree_synchronizer.h" 40 #include "cc/trees/tree_synchronizer.h"
41 #include "ui/base/resource/resource_bundle.h"
41 #include "ui/gfx/size_conversions.h" 42 #include "ui/gfx/size_conversions.h"
42 43
43 namespace { 44 namespace {
44 static int s_num_layer_tree_instances; 45 static int s_num_layer_tree_instances;
45 } 46 }
46 47
47 namespace cc { 48 namespace cc {
48 49
49 RendererCapabilities::RendererCapabilities() 50 RendererCapabilities::RendererCapabilities()
50 : best_texture_format(0), 51 : best_texture_format(0),
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 settings_.max_partial_texture_updates = max_partial_texture_updates; 190 settings_.max_partial_texture_updates = max_partial_texture_updates;
190 191
191 if (!contents_texture_manager_ && 192 if (!contents_texture_manager_ &&
192 (!settings_.impl_side_painting || !settings_.solid_color_scrollbars)) { 193 (!settings_.impl_side_painting || !settings_.solid_color_scrollbars)) {
193 contents_texture_manager_ = 194 contents_texture_manager_ =
194 PrioritizedResourceManager::Create(proxy_.get()); 195 PrioritizedResourceManager::Create(proxy_.get());
195 surface_memory_placeholder_ = 196 surface_memory_placeholder_ =
196 contents_texture_manager_->CreateTexture(gfx::Size(), GL_RGBA); 197 contents_texture_manager_->CreateTexture(gfx::Size(), GL_RGBA);
197 } 198 }
198 199
200 // Okay, this should be done in a more principled way...
201 if (1) {
202 // So this is supposed to come from a header file (but only on platforms
203 // that have an overhang...).
204 int IDR_IDR_OVERHANG_PATTERN = 4740;
205 // And this can't be called in unit tests...
206 const gfx::Image& overhang_image =
207 ui::ResourceBundle::GetSharedInstance().GetImageNamed(
208 IDR_IDR_OVERHANG_PATTERN);
209 overhang_bitmap_ = UIResourceBitmap::Create(
210 new uint8_t[overhang_image.Size().width() *
211 overhang_image.Size().height() * 4],
212 UIResourceBitmap::RGBA8,
213 UIResourceBitmap::Repeat,
214 overhang_image.Size());
215 overhang_image.CopySkBitmap()->copyPixelsTo(
216 overhang_bitmap_->GetPixels(),
217 overhang_image.Size().width() * overhang_image.Size().height() * 4,
218 overhang_image.Size().width() * 4,
219 false);
220 overhang_ui_resource_ = ScopedUIResource::Create(this, overhang_bitmap_);
221 }
222
199 client_->DidInitializeOutputSurface(true); 223 client_->DidInitializeOutputSurface(true);
200 return CreateSucceeded; 224 return CreateSucceeded;
201 } 225 }
202 226
203 // Failure path. 227 // Failure path.
204 228
205 client_->DidFailToInitializeOutputSurface(); 229 client_->DidFailToInitializeOutputSurface();
206 230
207 // Tolerate a certain number of recreation failures to work around races 231 // Tolerate a certain number of recreation failures to work around races
208 // in the output-surface-lost machinery. 232 // in the output-surface-lost machinery.
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 } 386 }
363 387
364 if (!ui_resource_request_queue_.empty()) { 388 if (!ui_resource_request_queue_.empty()) {
365 sync_tree->set_ui_resource_request_queue(ui_resource_request_queue_); 389 sync_tree->set_ui_resource_request_queue(ui_resource_request_queue_);
366 ui_resource_request_queue_.clear(); 390 ui_resource_request_queue_.clear();
367 // Process any ui resource requests in the queue. For impl-side-painting, 391 // Process any ui resource requests in the queue. For impl-side-painting,
368 // the queue is processed in LayerTreeHostImpl::ActivatePendingTree. 392 // the queue is processed in LayerTreeHostImpl::ActivatePendingTree.
369 if (!settings_.impl_side_painting) 393 if (!settings_.impl_side_painting)
370 sync_tree->ProcessUIResourceRequestQueue(); 394 sync_tree->ProcessUIResourceRequestQueue();
371 } 395 }
396 if (overhang_ui_resource_ && overhang_bitmap_) {
397 host_impl->SetOverhangUIResource(
398 overhang_ui_resource_->id(), overhang_bitmap_->GetSize());
399 }
372 400
373 DCHECK(!sync_tree->ViewportSizeInvalid()); 401 DCHECK(!sync_tree->ViewportSizeInvalid());
374 402
375 if (new_impl_tree_has_no_evicted_resources) { 403 if (new_impl_tree_has_no_evicted_resources) {
376 if (sync_tree->ContentsTexturesPurged()) 404 if (sync_tree->ContentsTexturesPurged())
377 sync_tree->ResetContentsTexturesPurged(); 405 sync_tree->ResetContentsTexturesPurged();
378 } 406 }
379 407
380 if (!settings_.impl_side_painting) { 408 if (!settings_.impl_side_painting) {
381 // If we're not in impl-side painting, the tree is immediately 409 // If we're not in impl-side painting, the tree is immediately
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
1172 void LayerTreeHost::DidLoseUIResources() { 1200 void LayerTreeHost::DidLoseUIResources() {
1173 // When output surface is lost, we need to recreate the resource. 1201 // When output surface is lost, we need to recreate the resource.
1174 for (UIResourceClientMap::iterator iter = ui_resource_client_map_.begin(); 1202 for (UIResourceClientMap::iterator iter = ui_resource_client_map_.begin();
1175 iter != ui_resource_client_map_.end(); 1203 iter != ui_resource_client_map_.end();
1176 ++iter) { 1204 ++iter) {
1177 UIResourceLost(iter->first); 1205 UIResourceLost(iter->first);
1178 } 1206 }
1179 } 1207 }
1180 1208
1181 } // namespace cc 1209 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698