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

Side by Side Diff: components/ukm/debug_page/debug_page.cc

Issue 2893943004: Refactor UKM interface for mojo-ification (Closed)
Patch Set: Fixed contextualsearch 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
« no previous file with comments | « components/ukm/DEPS ('k') | components/ukm/public/BUILD.gn » ('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 (c) 2017 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2017 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/ukm/debug_page/debug_page.h" 5 #include "components/ukm/debug_page/debug_page.h"
6 6
7 #include <inttypes.h> 7 #include <inttypes.h>
8 8
9 #include "base/memory/ref_counted_memory.h" 9 #include "base/memory/ref_counted_memory.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
11 #include "components/ukm/ukm_entry.h"
12 #include "components/ukm/ukm_service.h" 11 #include "components/ukm/ukm_service.h"
13 #include "components/ukm/ukm_source.h" 12 #include "components/ukm/ukm_source.h"
14 #include "url/gurl.h" 13 #include "url/gurl.h"
15 14
16 namespace ukm { 15 namespace ukm {
17 namespace debug { 16 namespace debug {
18 17
19 DebugPage::DebugPage(ServiceGetter service_getter) 18 DebugPage::DebugPage(ServiceGetter service_getter)
20 : service_getter_(service_getter) {} 19 : service_getter_(service_getter) {}
21 20
(...skipping 28 matching lines...) Expand all
50 base::StringPrintf("<p>IsEnabled:%s</p>", 49 base::StringPrintf("<p>IsEnabled:%s</p>",
51 ukm_service->recording_enabled_ ? "True" : "False")); 50 ukm_service->recording_enabled_ ? "True" : "False"));
52 data.append(base::StringPrintf("<p>ClientId:%" PRIu64 "</p>", 51 data.append(base::StringPrintf("<p>ClientId:%" PRIu64 "</p>",
53 ukm_service->client_id_)); 52 ukm_service->client_id_));
54 data.append( 53 data.append(
55 base::StringPrintf("<p>SessionId:%d</p>", ukm_service->session_id_)); 54 base::StringPrintf("<p>SessionId:%d</p>", ukm_service->session_id_));
56 55
57 data.append("<h2>Sources</h2>"); 56 data.append("<h2>Sources</h2>");
58 for (const auto& kv : ukm_service->sources_) { 57 for (const auto& kv : ukm_service->sources_) {
59 const auto* src = kv.second.get(); 58 const auto* src = kv.second.get();
60 data.append(base::StringPrintf("<p>Id:%d Url:%s</p>", src->id(), 59 data.append(base::StringPrintf("<p>Id:%" PRId64 " Url:%s</p>", src->id(),
61 src->url().spec().c_str())); 60 src->url().spec().c_str()));
62 } 61 }
63 62
64 data.append("<h2>Entries</h2>"); 63 data.append("<h2>Entries</h2>");
65 for (const auto& v : ukm_service->entries_) { 64 for (const auto& v : ukm_service->entries_) {
66 const auto* entry = v.get(); 65 const auto* entry = v.get();
67 data.append(base::StringPrintf("<h3>Id:%d Hash:%" PRIu64 "</h3>", 66 data.append(base::StringPrintf("<h3>Id:%" PRId64 " Hash:%" PRIu64 "</h3>",
68 entry->source_id(), entry->event_hash())); 67 entry->source_id, entry->event_hash));
69 } 68 }
70 } 69 }
71 70
72 data.append(R"""( 71 data.append(R"""(
73 </body> 72 </body>
74 </html> 73 </html>
75 )"""); 74 )""");
76 75
77 callback.Run(base::RefCountedString::TakeString(&data)); 76 callback.Run(base::RefCountedString::TakeString(&data));
78 } 77 }
79 78
80 bool DebugPage::AllowCaching() const { 79 bool DebugPage::AllowCaching() const {
81 return false; 80 return false;
82 } 81 }
83 82
84 } // namespace debug 83 } // namespace debug
85 } // namespace ukm 84 } // namespace ukm
OLDNEW
« no previous file with comments | « components/ukm/DEPS ('k') | components/ukm/public/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698