OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |