OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/caps/generate_state_json.h" | 5 #include "chrome/browser/caps/generate_state_json.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 void OnDataReadyDelayed() { | 83 void OnDataReadyDelayed() { |
84 model_->StopListening(); | 84 model_->StopListening(); |
85 // Task manager finally computed (most) values. Lets generate the JSON | 85 // Task manager finally computed (most) values. Lets generate the JSON |
86 // data and send it over the pipe. | 86 // data and send it over the pipe. |
87 base::DictionaryValue dict; | 87 base::DictionaryValue dict; |
88 GatherComputerValues(&dict); | 88 GatherComputerValues(&dict); |
89 GatherChromeValues(&dict); | 89 GatherChromeValues(&dict); |
90 | 90 |
91 std::string json; | 91 std::string json; |
92 auto options = base::JSONWriter::OPTIONS_PRETTY_PRINT; | 92 auto options = base::JSONWriter::OPTIONS_PRETTY_PRINT; |
93 if (!base::JSONWriter::WriteWithOptions(&dict, options, &json)) | 93 if (!base::JSONWriter::WriteWithOptions(dict, options, &json)) |
94 return; | 94 return; |
95 | 95 |
96 file_.WriteAtCurrentPos(json.c_str(), json.size()); | 96 file_.WriteAtCurrentPos(json.c_str(), json.size()); |
97 file_.Close(); | 97 file_.Close(); |
98 // this Release() causes our destruction. | 98 // this Release() causes our destruction. |
99 Release(); | 99 Release(); |
100 } | 100 } |
101 | 101 |
102 private: | 102 private: |
103 // TODO(cpu): split the key names below into a separate header that both | 103 // TODO(cpu): split the key names below into a separate header that both |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 } // namespace | 195 } // namespace |
196 | 196 |
197 namespace caps { | 197 namespace caps { |
198 | 198 |
199 void GenerateStateJSON( | 199 void GenerateStateJSON( |
200 scoped_refptr<TaskManagerModel> model, base::File file) { | 200 scoped_refptr<TaskManagerModel> model, base::File file) { |
201 new TaskManagerDataDumper(model, file.Pass()); | 201 new TaskManagerDataDumper(model, file.Pass()); |
202 } | 202 } |
203 | 203 |
204 } | 204 } |
OLD | NEW |