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

Side by Side Diff: ui/app_list/search/dictionary_data_store.cc

Issue 855023003: Add presubmit check for scoped_ptr usage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: REBASE Created 5 years, 11 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
« no previous file with comments | « no previous file | ui/app_list/search/history_data_store.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ui/app_list/search/dictionary_data_store.h" 5 #include "ui/app_list/search/dictionary_data_store.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/json/json_file_value_serializer.h" 8 #include "base/json/json_file_value_serializer.h"
9 #include "base/json/json_string_value_serializer.h" 9 #include "base/json/json_string_value_serializer.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 scoped_ptr<base::DictionaryValue> DictionaryDataStore::LoadOnBlockingPool() { 64 scoped_ptr<base::DictionaryValue> DictionaryDataStore::LoadOnBlockingPool() {
65 DCHECK(worker_pool_->RunsTasksOnCurrentThread()); 65 DCHECK(worker_pool_->RunsTasksOnCurrentThread());
66 66
67 int error_code = JSONFileValueSerializer::JSON_NO_ERROR; 67 int error_code = JSONFileValueSerializer::JSON_NO_ERROR;
68 std::string error_message; 68 std::string error_message;
69 JSONFileValueSerializer serializer(data_file_); 69 JSONFileValueSerializer serializer(data_file_);
70 base::Value* value = serializer.Deserialize(&error_code, &error_message); 70 base::Value* value = serializer.Deserialize(&error_code, &error_message);
71 base::DictionaryValue* dict_value = NULL; 71 base::DictionaryValue* dict_value = NULL;
72 if (error_code != JSONFileValueSerializer::JSON_NO_ERROR || !value || 72 if (error_code != JSONFileValueSerializer::JSON_NO_ERROR || !value ||
73 !value->GetAsDictionary(&dict_value) || !dict_value) { 73 !value->GetAsDictionary(&dict_value) || !dict_value) {
74 return scoped_ptr<base::DictionaryValue>(); 74 return nullptr;
75 } 75 }
76 76
77 base::DictionaryValue* return_dict = dict_value->DeepCopy(); 77 base::DictionaryValue* return_dict = dict_value->DeepCopy();
78 cached_dict_.reset(dict_value); 78 cached_dict_.reset(dict_value);
79 return make_scoped_ptr(return_dict).Pass(); 79 return make_scoped_ptr(return_dict);
80 } 80 }
81 81
82 bool DictionaryDataStore::SerializeData(std::string* data) { 82 bool DictionaryDataStore::SerializeData(std::string* data) {
83 JSONStringValueSerializer serializer(data); 83 JSONStringValueSerializer serializer(data);
84 serializer.set_pretty_print(true); 84 serializer.set_pretty_print(true);
85 return serializer.Serialize(*cached_dict_.get()); 85 return serializer.Serialize(*cached_dict_.get());
86 } 86 }
87 87
88 } // namespace app_list 88 } // namespace app_list
OLDNEW
« no previous file with comments | « no previous file | ui/app_list/search/history_data_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698