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

Side by Side Diff: chrome/browser/tab_contents/thumbnail_generator.cc

Issue 1807006: This fixes an InvalidRead error that valgrind found.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 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 | Annotate | Revision Log
« 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 (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/tab_contents/thumbnail_generator.h" 5 #include "chrome/browser/tab_contents/thumbnail_generator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/histogram.h" 10 #include "base/histogram.h"
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 } 386 }
387 387
388 void ThumbnailGenerator::TabContentsDisconnected(TabContents* contents) { 388 void ThumbnailGenerator::TabContentsDisconnected(TabContents* contents) {
389 // Go through the existing callbacks, and find any that have the 389 // Go through the existing callbacks, and find any that have the
390 // same renderer as this TabContents and remove them so they don't 390 // same renderer as this TabContents and remove them so they don't
391 // hang around. 391 // hang around.
392 ThumbnailCallbackMap::iterator iterator = callback_map_.begin(); 392 ThumbnailCallbackMap::iterator iterator = callback_map_.begin();
393 RenderWidgetHost* renderer = contents->render_view_host(); 393 RenderWidgetHost* renderer = contents->render_view_host();
394 while (iterator != callback_map_.end()) { 394 while (iterator != callback_map_.end()) {
395 if (iterator->second->renderer == renderer) { 395 if (iterator->second->renderer == renderer) {
396 callback_map_.erase(iterator); 396 ThumbnailCallbackMap::iterator nuked = iterator;
397 ++iterator;
398 callback_map_.erase(nuked);
399 continue;
397 } 400 }
398 ++iterator; 401 ++iterator;
399 } 402 }
400 } 403 }
401 404
402 void ThumbnailGenerator::ShownDelayHandler() { 405 void ThumbnailGenerator::ShownDelayHandler() {
403 base::TimeTicks threshold = base::TimeTicks::Now() - 406 base::TimeTicks threshold = base::TimeTicks::Now() -
404 base::TimeDelta::FromMilliseconds(kVisibilitySlopMS); 407 base::TimeDelta::FromMilliseconds(kVisibilitySlopMS);
405 408
406 // Check the list of all pending RWHs (normally only one) to see if any of 409 // Check the list of all pending RWHs (normally only one) to see if any of
(...skipping 17 matching lines...) Expand all
424 &ThumbnailGenerator::ShownDelayHandler); 427 &ThumbnailGenerator::ShownDelayHandler);
425 } 428 }
426 } 429 }
427 430
428 void ThumbnailGenerator::EraseHostFromShownList(RenderWidgetHost* widget) { 431 void ThumbnailGenerator::EraseHostFromShownList(RenderWidgetHost* widget) {
429 std::vector<RenderWidgetHost*>::iterator found = 432 std::vector<RenderWidgetHost*>::iterator found =
430 std::find(shown_hosts_.begin(), shown_hosts_.end(), widget); 433 std::find(shown_hosts_.begin(), shown_hosts_.end(), widget);
431 if (found != shown_hosts_.end()) 434 if (found != shown_hosts_.end())
432 shown_hosts_.erase(found); 435 shown_hosts_.erase(found);
433 } 436 }
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