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

Side by Side Diff: chrome/browser/history/top_sites.cc

Issue 7397021: Re-land r93365 - add RefCountedString (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: erg comments Created 9 years, 5 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/history/top_sites.h" 5 #include "chrome/browser/history/top_sites.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 if (!gfx::JPEGCodec::Encode( 599 if (!gfx::JPEGCodec::Encode(
600 reinterpret_cast<unsigned char*>(bitmap.getAddr32(0, 0)), 600 reinterpret_cast<unsigned char*>(bitmap.getAddr32(0, 0)),
601 gfx::JPEGCodec::FORMAT_BGRA, bitmap.width(), 601 gfx::JPEGCodec::FORMAT_BGRA, bitmap.width(),
602 bitmap.height(), 602 bitmap.height(),
603 static_cast<int>(bitmap.rowBytes()), 90, 603 static_cast<int>(bitmap.rowBytes()), 90,
604 &data)) { 604 &data)) {
605 return false; 605 return false;
606 } 606 }
607 // As we're going to cache this data, make sure the vector is only as big as 607 // As we're going to cache this data, make sure the vector is only as big as
608 // it needs to be. 608 // it needs to be.
609 (*bytes)->data = data; 609 (*bytes)->data()->swap(data);
610 return true; 610 return true;
611 } 611 }
612 612
613 void TopSites::RemoveTemporaryThumbnailByURL(const GURL& url) { 613 void TopSites::RemoveTemporaryThumbnailByURL(const GURL& url) {
614 for (TempImages::iterator i = temp_images_.begin(); i != temp_images_.end(); 614 for (TempImages::iterator i = temp_images_.begin(); i != temp_images_.end();
615 ++i) { 615 ++i) {
616 if (i->first == url) { 616 if (i->first == url) {
617 temp_images_.erase(i); 617 temp_images_.erase(i);
618 return; 618 return;
619 } 619 }
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 SetTopSites(pages); 1012 SetTopSites(pages);
1013 1013
1014 // Used only in testing. 1014 // Used only in testing.
1015 NotificationService::current()->Notify( 1015 NotificationService::current()->Notify(
1016 chrome::NOTIFICATION_TOP_SITES_UPDATED, 1016 chrome::NOTIFICATION_TOP_SITES_UPDATED,
1017 Source<TopSites>(this), 1017 Source<TopSites>(this),
1018 Details<CancelableRequestProvider::Handle>(&handle)); 1018 Details<CancelableRequestProvider::Handle>(&handle));
1019 } 1019 }
1020 1020
1021 } // namespace history 1021 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698