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

Side by Side Diff: components/bookmarks/browser/bookmark_storage.cc

Issue 1546143002: Switch to standard integer types in components/, part 1 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
OLDNEW
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/bookmarks/browser/bookmark_storage.h" 5 #include "components/bookmarks/browser/bookmark_storage.h"
6 6
7 #include <stddef.h>
8
7 #include <algorithm> 9 #include <algorithm>
8 10
9 #include "base/bind.h" 11 #include "base/bind.h"
10 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
11 #include "base/files/file_util.h" 13 #include "base/files/file_util.h"
12 #include "base/json/json_file_value_serializer.h" 14 #include "base/json/json_file_value_serializer.h"
13 #include "base/json/json_string_value_serializer.h" 15 #include "base/json/json_string_value_serializer.h"
14 #include "base/metrics/histogram_macros.h" 16 #include "base/metrics/histogram_macros.h"
15 #include "base/sequenced_task_runner.h" 17 #include "base/sequenced_task_runner.h"
16 #include "base/time/time.h" 18 #include "base/time/time.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 base::SequencedTaskRunner* task_runner) { 56 base::SequencedTaskRunner* task_runner) {
55 bool load_index = false; 57 bool load_index = false;
56 bool bookmark_file_exists = base::PathExists(path); 58 bool bookmark_file_exists = base::PathExists(path);
57 if (bookmark_file_exists) { 59 if (bookmark_file_exists) {
58 JSONFileValueDeserializer deserializer(path); 60 JSONFileValueDeserializer deserializer(path);
59 scoped_ptr<base::Value> root = deserializer.Deserialize(NULL, NULL); 61 scoped_ptr<base::Value> root = deserializer.Deserialize(NULL, NULL);
60 62
61 if (root.get()) { 63 if (root.get()) {
62 // Building the index can take a while, so we do it on the background 64 // Building the index can take a while, so we do it on the background
63 // thread. 65 // thread.
64 int64 max_node_id = 0; 66 int64_t max_node_id = 0;
65 BookmarkCodec codec; 67 BookmarkCodec codec;
66 TimeTicks start_time = TimeTicks::Now(); 68 TimeTicks start_time = TimeTicks::Now();
67 codec.Decode(details->bb_node(), details->other_folder_node(), 69 codec.Decode(details->bb_node(), details->other_folder_node(),
68 details->mobile_folder_node(), &max_node_id, *root.get()); 70 details->mobile_folder_node(), &max_node_id, *root.get());
69 details->set_max_id(std::max(max_node_id, details->max_id())); 71 details->set_max_id(std::max(max_node_id, details->max_id()));
70 details->set_computed_checksum(codec.computed_checksum()); 72 details->set_computed_checksum(codec.computed_checksum());
71 details->set_stored_checksum(codec.stored_checksum()); 73 details->set_stored_checksum(codec.stored_checksum());
72 details->set_ids_reassigned(codec.ids_reassigned()); 74 details->set_ids_reassigned(codec.ids_reassigned());
73 details->set_model_meta_info_map(codec.model_meta_info_map()); 75 details->set_model_meta_info_map(codec.model_meta_info_map());
74 details->set_model_sync_transaction_version( 76 details->set_model_sync_transaction_version(
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } // namespace 114 } // namespace
113 115
114 // BookmarkLoadDetails --------------------------------------------------------- 116 // BookmarkLoadDetails ---------------------------------------------------------
115 117
116 BookmarkLoadDetails::BookmarkLoadDetails( 118 BookmarkLoadDetails::BookmarkLoadDetails(
117 BookmarkPermanentNode* bb_node, 119 BookmarkPermanentNode* bb_node,
118 BookmarkPermanentNode* other_folder_node, 120 BookmarkPermanentNode* other_folder_node,
119 BookmarkPermanentNode* mobile_folder_node, 121 BookmarkPermanentNode* mobile_folder_node,
120 const LoadExtraCallback& load_extra_callback, 122 const LoadExtraCallback& load_extra_callback,
121 BookmarkIndex* index, 123 BookmarkIndex* index,
122 int64 max_id) 124 int64_t max_id)
123 : bb_node_(bb_node), 125 : bb_node_(bb_node),
124 other_folder_node_(other_folder_node), 126 other_folder_node_(other_folder_node),
125 mobile_folder_node_(mobile_folder_node), 127 mobile_folder_node_(mobile_folder_node),
126 load_extra_callback_(load_extra_callback), 128 load_extra_callback_(load_extra_callback),
127 index_(index), 129 index_(index),
128 model_sync_transaction_version_( 130 model_sync_transaction_version_(
129 BookmarkNode::kInvalidSyncTransactionVersion), 131 BookmarkNode::kInvalidSyncTransactionVersion),
130 max_id_(max_id), 132 max_id_(max_id),
131 ids_reassigned_(false) { 133 ids_reassigned_(false) {}
132 }
133 134
134 BookmarkLoadDetails::~BookmarkLoadDetails() { 135 BookmarkLoadDetails::~BookmarkLoadDetails() {
135 } 136 }
136 137
137 void BookmarkLoadDetails::LoadExtraNodes() { 138 void BookmarkLoadDetails::LoadExtraNodes() {
138 if (!load_extra_callback_.is_null()) 139 if (!load_extra_callback_.is_null())
139 extra_nodes_ = load_extra_callback_.Run(&max_id_); 140 extra_nodes_ = load_extra_callback_.Run(&max_id_);
140 } 141 }
141 142
142 // BookmarkStorage ------------------------------------------------------------- 143 // BookmarkStorage -------------------------------------------------------------
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 } 226 }
226 227
227 scoped_ptr<std::string> data(new std::string); 228 scoped_ptr<std::string> data(new std::string);
228 if (!SerializeData(data.get())) 229 if (!SerializeData(data.get()))
229 return false; 230 return false;
230 writer_.WriteNow(data.Pass()); 231 writer_.WriteNow(data.Pass());
231 return true; 232 return true;
232 } 233 }
233 234
234 } // namespace bookmarks 235 } // namespace bookmarks
OLDNEW
« no previous file with comments | « components/bookmarks/browser/bookmark_storage.h ('k') | components/bookmarks/browser/bookmark_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698