| 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 | 8 |
| 9 #include "base/histogram.h" | 9 #include "base/histogram.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // The last performance consideration is when the user switches tabs quickly. | 39 // The last performance consideration is when the user switches tabs quickly. |
| 40 // This can happen by doing Control-PageUp/Down or juct clicking quickly on | 40 // This can happen by doing Control-PageUp/Down or juct clicking quickly on |
| 41 // many different tabs (like when you're looking for one). We don't want to | 41 // many different tabs (like when you're looking for one). We don't want to |
| 42 // slow this down by making thumbnails for each tab as it's hidden. Therefore, | 42 // slow this down by making thumbnails for each tab as it's hidden. Therefore, |
| 43 // we have a timer so that we don't invalidate thumbnails for tabs that are | 43 // we have a timer so that we don't invalidate thumbnails for tabs that are |
| 44 // only shown briefly (which would cause the thumbnail to be regenerated when | 44 // only shown briefly (which would cause the thumbnail to be regenerated when |
| 45 // the tab is hidden). | 45 // the tab is hidden). |
| 46 | 46 |
| 47 namespace { | 47 namespace { |
| 48 | 48 |
| 49 static const int kThumbnailWidth = 294; | 49 static const int kThumbnailWidth = 212; |
| 50 static const int kThumbnailHeight = 204; | 50 static const int kThumbnailHeight = 132; |
| 51 | 51 |
| 52 // Indicates the time that the RWH must be visible for us to update the | 52 // Indicates the time that the RWH must be visible for us to update the |
| 53 // thumbnail on it. If the user holds down control enter, there will be a lot | 53 // thumbnail on it. If the user holds down control enter, there will be a lot |
| 54 // of backing stores created and destroyed. WE don't want to interfere with | 54 // of backing stores created and destroyed. WE don't want to interfere with |
| 55 // that. | 55 // that. |
| 56 // | 56 // |
| 57 // Any operation that happens within this time of being shown is ignored. | 57 // Any operation that happens within this time of being shown is ignored. |
| 58 // This means we won't throw the thumbnail away when the backing store is | 58 // This means we won't throw the thumbnail away when the backing store is |
| 59 // painted in this time. | 59 // painted in this time. |
| 60 static const int kVisibilitySlopMS = 3000; | 60 static const int kVisibilitySlopMS = 3000; |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 &ThumbnailGenerator::ShownDelayHandler); | 356 &ThumbnailGenerator::ShownDelayHandler); |
| 357 } | 357 } |
| 358 } | 358 } |
| 359 | 359 |
| 360 void ThumbnailGenerator::EraseHostFromShownList(RenderWidgetHost* widget) { | 360 void ThumbnailGenerator::EraseHostFromShownList(RenderWidgetHost* widget) { |
| 361 std::vector<RenderWidgetHost*>::iterator found = | 361 std::vector<RenderWidgetHost*>::iterator found = |
| 362 std::find(shown_hosts_.begin(), shown_hosts_.end(), widget); | 362 std::find(shown_hosts_.begin(), shown_hosts_.end(), widget); |
| 363 if (found != shown_hosts_.end()) | 363 if (found != shown_hosts_.end()) |
| 364 shown_hosts_.erase(found); | 364 shown_hosts_.erase(found); |
| 365 } | 365 } |
| OLD | NEW |