| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/android/compositor/tab_content_manager.h" | 5 #include "chrome/browser/android/compositor/tab_content_manager.h" |
| 6 | 6 |
| 7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 127 |
| 128 void TabContentManager::SetUIResourceProvider( | 128 void TabContentManager::SetUIResourceProvider( |
| 129 ui::UIResourceProvider* ui_resource_provider) { | 129 ui::UIResourceProvider* ui_resource_provider) { |
| 130 thumbnail_cache_->SetUIResourceProvider(ui_resource_provider); | 130 thumbnail_cache_->SetUIResourceProvider(ui_resource_provider); |
| 131 } | 131 } |
| 132 | 132 |
| 133 scoped_refptr<cc::Layer> TabContentManager::GetLiveLayer(int tab_id) { | 133 scoped_refptr<cc::Layer> TabContentManager::GetLiveLayer(int tab_id) { |
| 134 return live_layer_list_[tab_id]; | 134 return live_layer_list_[tab_id]; |
| 135 } | 135 } |
| 136 | 136 |
| 137 scoped_refptr<ThumbnailLayer> TabContentManager::GetStaticLayer( | 137 scoped_refptr<ThumbnailLayer> TabContentManager::GetStaticLayer(int tab_id) { |
| 138 return static_layer_cache_[tab_id]; |
| 139 } |
| 140 |
| 141 scoped_refptr<ThumbnailLayer> TabContentManager::GetOrCreateStaticLayer( |
| 138 int tab_id, | 142 int tab_id, |
| 139 bool force_disk_read) { | 143 bool force_disk_read) { |
| 140 Thumbnail* thumbnail = thumbnail_cache_->Get(tab_id, force_disk_read, true); | 144 Thumbnail* thumbnail = thumbnail_cache_->Get(tab_id, force_disk_read, true); |
| 141 scoped_refptr<ThumbnailLayer> static_layer = static_layer_cache_[tab_id]; | 145 scoped_refptr<ThumbnailLayer> static_layer = static_layer_cache_[tab_id]; |
| 142 | 146 |
| 143 if (!thumbnail || !thumbnail->ui_resource_id()) { | 147 if (!thumbnail || !thumbnail->ui_resource_id()) { |
| 144 if (static_layer.get()) { | 148 if (static_layer.get()) { |
| 145 static_layer->layer()->RemoveFromParent(); | 149 static_layer->layer()->RemoveFromParent(); |
| 146 static_layer_cache_.erase(tab_id); | 150 static_layer_cache_.erase(tab_id); |
| 147 } | 151 } |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 jint write_queue_max_size, | 344 jint write_queue_max_size, |
| 341 jboolean use_approximation_thumbnail) { | 345 jboolean use_approximation_thumbnail) { |
| 342 TabContentManager* manager = new TabContentManager( | 346 TabContentManager* manager = new TabContentManager( |
| 343 env, obj, default_cache_size, approximation_cache_size, | 347 env, obj, default_cache_size, approximation_cache_size, |
| 344 compression_queue_max_size, write_queue_max_size, | 348 compression_queue_max_size, write_queue_max_size, |
| 345 use_approximation_thumbnail); | 349 use_approximation_thumbnail); |
| 346 return reinterpret_cast<intptr_t>(manager); | 350 return reinterpret_cast<intptr_t>(manager); |
| 347 } | 351 } |
| 348 | 352 |
| 349 } // namespace android | 353 } // namespace android |
| OLD | NEW |