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 <memory> | 5 #include <memory> |
6 | 6 |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 43 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
44 | 44 |
45 config->IntoDict(dict.get()); | 45 config->IntoDict(dict.get()); |
46 | 46 |
47 std::string results; | 47 std::string results; |
48 if (base::JSONWriter::Write(*dict.get(), &results)) | 48 if (base::JSONWriter::Write(*dict.get(), &results)) |
49 return results; | 49 return results; |
50 return ""; | 50 return ""; |
51 } | 51 } |
52 | 52 |
53 std::string RuleToString(const BackgroundTracingRule* rule) { | 53 std::string RuleToString(const std::unique_ptr<BackgroundTracingRule>& rule) { |
54 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 54 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
55 | 55 |
56 rule->IntoDict(dict.get()); | 56 rule->IntoDict(dict.get()); |
57 | 57 |
58 std::string results; | 58 std::string results; |
59 if (base::JSONWriter::Write(*dict.get(), &results)) | 59 if (base::JSONWriter::Write(*dict.get(), &results)) |
60 return results; | 60 return results; |
61 return ""; | 61 return ""; |
62 } | 62 } |
63 | 63 |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 ConfigToString(config.get()), | 624 ConfigToString(config.get()), |
625 "{\"configs\":[{\"category\":\"BENCHMARK_DEEP\",\"rule\":\"TRACE_" | 625 "{\"configs\":[{\"category\":\"BENCHMARK_DEEP\",\"rule\":\"TRACE_" |
626 "ON_NAVIGATION_UNTIL_TRIGGER_OR_FULL\",\"trigger_delay\":30," | 626 "ON_NAVIGATION_UNTIL_TRIGGER_OR_FULL\",\"trigger_delay\":30," |
627 "\"trigger_name\":\"foo1\"},{\"category\":\"BENCHMARK_DEEP\",\"rule\":" | 627 "\"trigger_name\":\"foo1\"},{\"category\":\"BENCHMARK_DEEP\",\"rule\":" |
628 "\"TRACE_ON_NAVIGATION_UNTIL_TRIGGER_OR_FULL\",\"trigger_delay\":30," | 628 "\"TRACE_ON_NAVIGATION_UNTIL_TRIGGER_OR_FULL\",\"trigger_delay\":30," |
629 "\"trigger_name\":\"foo2\"}],\"mode\":\"REACTIVE_TRACING_MODE\"}"); | 629 "\"trigger_name\":\"foo2\"}],\"mode\":\"REACTIVE_TRACING_MODE\"}"); |
630 } | 630 } |
631 } | 631 } |
632 | 632 |
633 } // namspace content | 633 } // namspace content |
OLD | NEW |