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 "platform/scheduler/renderer/web_frame_scheduler_impl.h" | 5 #include "platform/scheduler/renderer/web_frame_scheduler_impl.h" |
6 | 6 |
7 #include "base/strings/stringprintf.h" | |
8 #include "base/trace_event/blame_context.h" | 7 #include "base/trace_event/blame_context.h" |
9 #include "platform/RuntimeEnabledFeatures.h" | 8 #include "platform/RuntimeEnabledFeatures.h" |
10 #include "platform/scheduler/base/real_time_domain.h" | 9 #include "platform/scheduler/base/real_time_domain.h" |
| 10 #include "platform/scheduler/base/trace_helper.h" |
11 #include "platform/scheduler/base/virtual_time_domain.h" | 11 #include "platform/scheduler/base/virtual_time_domain.h" |
12 #include "platform/scheduler/child/web_task_runner_impl.h" | 12 #include "platform/scheduler/child/web_task_runner_impl.h" |
13 #include "platform/scheduler/renderer/auto_advancing_virtual_time_domain.h" | 13 #include "platform/scheduler/renderer/auto_advancing_virtual_time_domain.h" |
14 #include "platform/scheduler/renderer/budget_pool.h" | 14 #include "platform/scheduler/renderer/budget_pool.h" |
15 #include "platform/scheduler/renderer/renderer_scheduler_impl.h" | 15 #include "platform/scheduler/renderer/renderer_scheduler_impl.h" |
16 #include "platform/scheduler/renderer/web_view_scheduler_impl.h" | 16 #include "platform/scheduler/renderer/web_view_scheduler_impl.h" |
17 #include "public/platform/BlameContext.h" | 17 #include "public/platform/BlameContext.h" |
18 #include "public/platform/WebString.h" | 18 #include "public/platform/WebString.h" |
19 | 19 |
20 namespace blink { | 20 namespace blink { |
21 namespace scheduler { | 21 namespace scheduler { |
22 namespace { | |
23 | |
24 std::string PointerToId(void* pointer) { | |
25 return base::StringPrintf( | |
26 "0x%" PRIx64, | |
27 static_cast<uint64_t>(reinterpret_cast<uintptr_t>(pointer))); | |
28 } | |
29 | |
30 } // namespace | |
31 | 22 |
32 WebFrameSchedulerImpl::ActiveConnectionHandleImpl::ActiveConnectionHandleImpl( | 23 WebFrameSchedulerImpl::ActiveConnectionHandleImpl::ActiveConnectionHandleImpl( |
33 WebFrameSchedulerImpl* frame_scheduler) | 24 WebFrameSchedulerImpl* frame_scheduler) |
34 : frame_scheduler_(frame_scheduler->AsWeakPtr()) { | 25 : frame_scheduler_(frame_scheduler->AsWeakPtr()) { |
35 frame_scheduler->DidOpenActiveConnection(); | 26 frame_scheduler->DidOpenActiveConnection(); |
36 } | 27 } |
37 | 28 |
38 WebFrameSchedulerImpl::ActiveConnectionHandleImpl:: | 29 WebFrameSchedulerImpl::ActiveConnectionHandleImpl:: |
39 ~ActiveConnectionHandleImpl() { | 30 ~ActiveConnectionHandleImpl() { |
40 if (frame_scheduler_) | 31 if (frame_scheduler_) |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 parent_web_view_scheduler_->DecrementBackgroundParserCount(); | 222 parent_web_view_scheduler_->DecrementBackgroundParserCount(); |
232 } | 223 } |
233 | 224 |
234 void WebFrameSchedulerImpl::AsValueInto( | 225 void WebFrameSchedulerImpl::AsValueInto( |
235 base::trace_event::TracedValue* state) const { | 226 base::trace_event::TracedValue* state) const { |
236 state->SetBoolean("frame_visible", frame_visible_); | 227 state->SetBoolean("frame_visible", frame_visible_); |
237 state->SetBoolean("page_throttled", page_throttled_); | 228 state->SetBoolean("page_throttled", page_throttled_); |
238 state->SetBoolean("cross_origin", cross_origin_); | 229 state->SetBoolean("cross_origin", cross_origin_); |
239 if (loading_task_queue_) { | 230 if (loading_task_queue_) { |
240 state->SetString("loading_task_queue", | 231 state->SetString("loading_task_queue", |
241 PointerToId(loading_task_queue_.get())); | 232 trace_helper::PointerToString(loading_task_queue_.get())); |
242 } | 233 } |
243 if (timer_task_queue_) | 234 if (timer_task_queue_) |
244 state->SetString("timer_task_queue", PointerToId(timer_task_queue_.get())); | 235 state->SetString("timer_task_queue", |
| 236 trace_helper::PointerToString(timer_task_queue_.get())); |
245 if (unthrottled_task_queue_) { | 237 if (unthrottled_task_queue_) { |
246 state->SetString("unthrottled_task_queue", | 238 state->SetString( |
247 PointerToId(unthrottled_task_queue_.get())); | 239 "unthrottled_task_queue", |
| 240 trace_helper::PointerToString(unthrottled_task_queue_.get())); |
248 } | 241 } |
249 if (suspendable_task_queue_) { | 242 if (suspendable_task_queue_) { |
250 state->SetString("suspendable_task_queue", | 243 state->SetString( |
251 PointerToId(suspendable_task_queue_.get())); | 244 "suspendable_task_queue", |
| 245 trace_helper::PointerToString(suspendable_task_queue_.get())); |
252 } | 246 } |
253 if (blame_context_) { | 247 if (blame_context_) { |
254 state->BeginDictionary("blame_context"); | 248 state->BeginDictionary("blame_context"); |
255 state->SetString( | 249 state->SetString("id_ref", |
256 "id_ref", PointerToId(reinterpret_cast<void*>(blame_context_->id()))); | 250 trace_helper::PointerToString( |
| 251 reinterpret_cast<void*>(blame_context_->id()))); |
257 state->SetString("scope", blame_context_->scope()); | 252 state->SetString("scope", blame_context_->scope()); |
258 state->EndDictionary(); | 253 state->EndDictionary(); |
259 } | 254 } |
260 } | 255 } |
261 | 256 |
262 void WebFrameSchedulerImpl::SetPageThrottled(bool page_throttled) { | 257 void WebFrameSchedulerImpl::SetPageThrottled(bool page_throttled) { |
263 DCHECK(parent_web_view_scheduler_); | 258 DCHECK(parent_web_view_scheduler_); |
264 if (page_throttled_ == page_throttled) | 259 if (page_throttled_ == page_throttled) |
265 return; | 260 return; |
266 bool was_throttled = ShouldThrottleTimers(); | 261 bool was_throttled = ShouldThrottleTimers(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 timer_task_queue_.get()); | 306 timer_task_queue_.get()); |
312 } | 307 } |
313 } | 308 } |
314 | 309 |
315 base::WeakPtr<WebFrameSchedulerImpl> WebFrameSchedulerImpl::AsWeakPtr() { | 310 base::WeakPtr<WebFrameSchedulerImpl> WebFrameSchedulerImpl::AsWeakPtr() { |
316 return weak_factory_.GetWeakPtr(); | 311 return weak_factory_.GetWeakPtr(); |
317 } | 312 } |
318 | 313 |
319 } // namespace scheduler | 314 } // namespace scheduler |
320 } // namespace blink | 315 } // namespace blink |
OLD | NEW |