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

Side by Side Diff: third_party/WebKit/Source/platform/scheduler/renderer/wake_up_budget_pool.cc

Issue 2837323002: Merged all PointerToId functions into TraceHelper::PointerToString. (Closed)
Patch Set: Converted TraceHelper the class to trace_helper the namespace. 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 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 "platform/scheduler/renderer/wake_up_budget_pool.h" 5 #include "platform/scheduler/renderer/wake_up_budget_pool.h"
6 6
7 #include <cstdint> 7 #include <cstdint>
8 8
9 #include "base/format_macros.h" 9 #include "platform/scheduler/base/trace_helper.h"
10 #include "base/strings/stringprintf.h"
11 #include "platform/scheduler/renderer/task_queue_throttler.h" 10 #include "platform/scheduler/renderer/task_queue_throttler.h"
12 11
13 namespace blink { 12 namespace blink {
14 namespace scheduler { 13 namespace scheduler {
15 14
16 namespace {
17
18 std::string PointerToId(void* pointer) {
19 return base::StringPrintf(
20 "0x%" PRIx64,
21 static_cast<uint64_t>(reinterpret_cast<uintptr_t>(pointer)));
22 }
23
24 } // namespace
25
26 WakeUpBudgetPool::WakeUpBudgetPool(const char* name, 15 WakeUpBudgetPool::WakeUpBudgetPool(const char* name,
27 BudgetPoolController* budget_pool_controller, 16 BudgetPoolController* budget_pool_controller,
28 base::TimeTicks now) 17 base::TimeTicks now)
29 : BudgetPool(name, budget_pool_controller), wakeups_per_second_(1) {} 18 : BudgetPool(name, budget_pool_controller), wakeups_per_second_(1) {}
30 19
31 WakeUpBudgetPool::~WakeUpBudgetPool() {} 20 WakeUpBudgetPool::~WakeUpBudgetPool() {}
32 21
33 QueueBlockType WakeUpBudgetPool::GetBlockType() const { 22 QueueBlockType WakeUpBudgetPool::GetBlockType() const {
34 return QueueBlockType::kNewTasksOnly; 23 return QueueBlockType::kNewTasksOnly;
35 } 24 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 state->SetDouble("wakeups_per_second_rate", wakeups_per_second_); 91 state->SetDouble("wakeups_per_second_rate", wakeups_per_second_);
103 state->SetDouble("wakeup_duration_in_seconds", wakeup_duration_.InSecondsF()); 92 state->SetDouble("wakeup_duration_in_seconds", wakeup_duration_.InSecondsF());
104 if (last_wakeup_) { 93 if (last_wakeup_) {
105 state->SetDouble("last_wakeup_seconds_ago", 94 state->SetDouble("last_wakeup_seconds_ago",
106 (now - last_wakeup_.value()).InSecondsF()); 95 (now - last_wakeup_.value()).InSecondsF());
107 } 96 }
108 state->SetBoolean("is_enabled", is_enabled_); 97 state->SetBoolean("is_enabled", is_enabled_);
109 98
110 state->BeginArray("task_queues"); 99 state->BeginArray("task_queues");
111 for (TaskQueue* queue : associated_task_queues_) { 100 for (TaskQueue* queue : associated_task_queues_) {
112 state->AppendString(PointerToId(queue)); 101 state->AppendString(trace_helper::PointerToString(queue));
113 } 102 }
114 state->EndArray(); 103 state->EndArray();
115 104
116 state->EndDictionary(); 105 state->EndDictionary();
117 } 106 }
118 107
119 } // namespace scheduler 108 } // namespace scheduler
120 } // namespace blink 109 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698