OLD | NEW |
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 "components/enhanced_bookmarks/test_image_store.h" | 5 #include "components/enhanced_bookmarks/test_image_store.h" |
6 | 6 |
7 #include "third_party/skia/include/core/SkBitmap.h" | 7 #include "third_party/skia/include/core/SkBitmap.h" |
8 #include "ui/gfx/geometry/size.h" | 8 #include "ui/gfx/geometry/size.h" |
9 #include "url/gurl.h" | 9 #include "url/gurl.h" |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 for (ImageMap::const_iterator it = store_.begin(); it != store_.end(); ++it) | 61 for (ImageMap::const_iterator it = store_.begin(); it != store_.end(); ++it) |
62 urls->insert(it->first); | 62 urls->insert(it->first); |
63 } | 63 } |
64 | 64 |
65 void TestImageStore::ClearAll() { | 65 void TestImageStore::ClearAll() { |
66 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); | 66 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); |
67 | 67 |
68 store_.clear(); | 68 store_.clear(); |
69 } | 69 } |
70 | 70 |
71 int64 TestImageStore::GetStoreSizeInBytes() { | 71 int64_t TestImageStore::GetStoreSizeInBytes() { |
72 // Not 100% accurate, but it's for testing so the actual value is not | 72 // Not 100% accurate, but it's for testing so the actual value is not |
73 // important. | 73 // important. |
74 int64 size = sizeof(store_); | 74 int64_t size = sizeof(store_); |
75 for (ImageMap::const_iterator it = store_.begin(); it != store_.end(); ++it) { | 75 for (ImageMap::const_iterator it = store_.begin(); it != store_.end(); ++it) { |
76 size += sizeof(it->first); | 76 size += sizeof(it->first); |
77 size += it->first.spec().length(); | 77 size += it->first.spec().length(); |
78 size += sizeof(it->second); | 78 size += sizeof(it->second); |
79 SkBitmap bitmap = it->second->image->AsBitmap(); | 79 SkBitmap bitmap = it->second->image->AsBitmap(); |
80 size += bitmap.getSize(); | 80 size += bitmap.getSize(); |
81 size += it->second->url.spec().length(); | 81 size += it->second->url.spec().length(); |
82 size += sizeof(it->second->dominant_color); | 82 size += sizeof(it->second->dominant_color); |
83 } | 83 } |
84 return size; | 84 return size; |
85 } | 85 } |
86 | 86 |
87 TestImageStore::~TestImageStore() { | 87 TestImageStore::~TestImageStore() { |
88 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); | 88 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); |
89 } | 89 } |
OLD | NEW |