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

Side by Side Diff: chrome/browser/android/compositor/tab_content_manager.cc

Issue 2497383002: Fix DCHECK failure when ChromeActivity#onPauseWithNative() is called many times quickly (Closed)
Patch Set: Created 4 years, 1 month 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 | « no previous file | 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 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 const JavaParamRef<jobject>& tab, 210 const JavaParamRef<jobject>& tab,
211 jfloat thumbnail_scale) { 211 jfloat thumbnail_scale) {
212 TabAndroid* tab_android = TabAndroid::GetNativeTab(env, tab); 212 TabAndroid* tab_android = TabAndroid::GetNativeTab(env, tab);
213 DCHECK(tab_android); 213 DCHECK(tab_android);
214 int tab_id = tab_android->GetAndroidId(); 214 int tab_id = tab_android->GetAndroidId();
215 GURL url = tab_android->GetURL(); 215 GURL url = tab_android->GetURL();
216 216
217 content::WebContents* web_contents = tab_android->web_contents(); 217 content::WebContents* web_contents = tab_android->web_contents();
218 DCHECK(web_contents); 218 DCHECK(web_contents);
219 219
220 if (pending_tab_readbacks_.find(tab_id) != pending_tab_readbacks_.end())
221 return;
222
220 if (thumbnail_cache_->CheckAndUpdateThumbnailMetaData(tab_id, url)) { 223 if (thumbnail_cache_->CheckAndUpdateThumbnailMetaData(tab_id, url)) {
221 if (!web_contents->GetRenderViewHost() || 224 if (!web_contents->GetRenderViewHost() ||
222 !web_contents->GetRenderViewHost()->GetWidget() || 225 !web_contents->GetRenderViewHost()->GetWidget() ||
223 !web_contents->GetRenderViewHost() 226 !web_contents->GetRenderViewHost()
224 ->GetWidget() 227 ->GetWidget()
225 ->CanCopyFromBackingStore() || 228 ->CanCopyFromBackingStore() ||
226 pending_tab_readbacks_.find(tab_id) != pending_tab_readbacks_.end() ||
227 pending_tab_readbacks_.size() >= kMaxReadbacks) { 229 pending_tab_readbacks_.size() >= kMaxReadbacks) {
228 thumbnail_cache_->Remove(tab_id); 230 thumbnail_cache_->Remove(tab_id);
229 return; 231 return;
230 } 232 }
231 233
232 TabReadbackCallback readback_done_callback = 234 TabReadbackCallback readback_done_callback =
233 base::Bind(&TabContentManager::PutThumbnailIntoCache, 235 base::Bind(&TabContentManager::PutThumbnailIntoCache,
234 weak_factory_.GetWeakPtr(), tab_id); 236 weak_factory_.GetWeakPtr(), tab_id);
235 pending_tab_readbacks_.set( 237 pending_tab_readbacks_.set(
236 tab_id, base::MakeUnique<TabReadbackRequest>( 238 tab_id, base::MakeUnique<TabReadbackRequest>(
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 jint write_queue_max_size, 340 jint write_queue_max_size,
339 jboolean use_approximation_thumbnail) { 341 jboolean use_approximation_thumbnail) {
340 TabContentManager* manager = new TabContentManager( 342 TabContentManager* manager = new TabContentManager(
341 env, obj, default_cache_size, approximation_cache_size, 343 env, obj, default_cache_size, approximation_cache_size,
342 compression_queue_max_size, write_queue_max_size, 344 compression_queue_max_size, write_queue_max_size,
343 use_approximation_thumbnail); 345 use_approximation_thumbnail);
344 return reinterpret_cast<intptr_t>(manager); 346 return reinterpret_cast<intptr_t>(manager);
345 } 347 }
346 348
347 } // namespace android 349 } // namespace android
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698