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

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

Issue 2888303002: Rename TaskRunner::RunsTasksOnCurrentThread() in //media, //ui, //ipc (Closed)
Patch Set: Created 3 years, 7 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 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 <utility> 7 #include <utility>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/json/json_file_value_serializer.h" 10 #include "base/json/json_file_value_serializer.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 base::Bind(&DictionaryDataStore::LoadOnBlockingPool, this), 58 base::Bind(&DictionaryDataStore::LoadOnBlockingPool, this),
59 on_loaded); 59 on_loaded);
60 } 60 }
61 61
62 void DictionaryDataStore::ScheduleWrite() { 62 void DictionaryDataStore::ScheduleWrite() {
63 writer_->ScheduleWrite(this); 63 writer_->ScheduleWrite(this);
64 } 64 }
65 65
66 std::unique_ptr<base::DictionaryValue> 66 std::unique_ptr<base::DictionaryValue>
67 DictionaryDataStore::LoadOnBlockingPool() { 67 DictionaryDataStore::LoadOnBlockingPool() {
68 DCHECK(worker_pool_->RunsTasksOnCurrentThread()); 68 DCHECK(worker_pool_->RunsTasksInCurrentSequence());
69 69
70 int error_code = JSONFileValueDeserializer::JSON_NO_ERROR; 70 int error_code = JSONFileValueDeserializer::JSON_NO_ERROR;
71 std::string error_message; 71 std::string error_message;
72 JSONFileValueDeserializer deserializer(data_file_); 72 JSONFileValueDeserializer deserializer(data_file_);
73 std::unique_ptr<base::DictionaryValue> dict_value = 73 std::unique_ptr<base::DictionaryValue> dict_value =
74 base::DictionaryValue::From( 74 base::DictionaryValue::From(
75 deserializer.Deserialize(&error_code, &error_message)); 75 deserializer.Deserialize(&error_code, &error_message));
76 if (error_code != JSONFileValueDeserializer::JSON_NO_ERROR || !dict_value) { 76 if (error_code != JSONFileValueDeserializer::JSON_NO_ERROR || !dict_value) {
77 return nullptr; 77 return nullptr;
78 } 78 }
79 79
80 std::unique_ptr<base::DictionaryValue> return_dict = 80 std::unique_ptr<base::DictionaryValue> return_dict =
81 dict_value->CreateDeepCopy(); 81 dict_value->CreateDeepCopy();
82 cached_dict_ = std::move(dict_value); 82 cached_dict_ = std::move(dict_value);
83 return return_dict; 83 return return_dict;
84 } 84 }
85 85
86 bool DictionaryDataStore::SerializeData(std::string* data) { 86 bool DictionaryDataStore::SerializeData(std::string* data) {
87 JSONStringValueSerializer serializer(data); 87 JSONStringValueSerializer serializer(data);
88 serializer.set_pretty_print(true); 88 serializer.set_pretty_print(true);
89 return serializer.Serialize(*cached_dict_.get()); 89 return serializer.Serialize(*cached_dict_.get());
90 } 90 }
91 91
92 } // namespace app_list 92 } // namespace app_list
OLDNEW
« no previous file with comments | « media/cast/sender/external_video_encoder.cc ('k') | ui/events/ozone/evdev/input_device_factory_evdev.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698