OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 #include "core/workers/WorkerGlobalScope.h" | 46 #include "core/workers/WorkerGlobalScope.h" |
47 #include "platform/instrumentation/tracing/TraceEvent.h" | 47 #include "platform/instrumentation/tracing/TraceEvent.h" |
48 #include "platform/loader/fetch/FetchInitiatorInfo.h" | 48 #include "platform/loader/fetch/FetchInitiatorInfo.h" |
49 | 49 |
50 namespace blink { | 50 namespace blink { |
51 namespace probe { | 51 namespace probe { |
52 | 52 |
53 AsyncTask::AsyncTask(ExecutionContext* context, | 53 AsyncTask::AsyncTask(ExecutionContext* context, |
54 void* task, | 54 void* task, |
55 const char* step, | 55 const char* step, |
56 bool enabled) | 56 bool enabled, |
| 57 bool optional) |
57 : debugger_(enabled ? ThreadDebugger::From(ToIsolate(context)) : nullptr), | 58 : debugger_(enabled ? ThreadDebugger::From(ToIsolate(context)) : nullptr), |
58 task_(task), | 59 task_(task), |
59 recurring_(step) { | 60 recurring_(step), |
| 61 started_(false) { |
60 if (recurring_) { | 62 if (recurring_) { |
61 TRACE_EVENT_FLOW_STEP0("devtools.timeline.async", "AsyncTask", | 63 TRACE_EVENT_FLOW_STEP0("devtools.timeline.async", "AsyncTask", |
62 TRACE_ID_LOCAL(reinterpret_cast<uintptr_t>(task)), | 64 TRACE_ID_LOCAL(reinterpret_cast<uintptr_t>(task)), |
63 step ? step : ""); | 65 step ? step : ""); |
64 } else { | 66 } else { |
65 TRACE_EVENT_FLOW_END0("devtools.timeline.async", "AsyncTask", | 67 TRACE_EVENT_FLOW_END0("devtools.timeline.async", "AsyncTask", |
66 TRACE_ID_LOCAL(reinterpret_cast<uintptr_t>(task))); | 68 TRACE_ID_LOCAL(reinterpret_cast<uintptr_t>(task))); |
67 } | 69 } |
68 if (debugger_) | 70 if (debugger_) { |
69 debugger_->AsyncTaskStarted(task_); | 71 started_ = debugger_->AsyncTaskStarted(task_, optional); |
| 72 } |
70 } | 73 } |
71 | 74 |
72 AsyncTask::~AsyncTask() { | 75 AsyncTask::~AsyncTask() { |
73 if (debugger_) { | 76 if (debugger_) { |
74 debugger_->AsyncTaskFinished(task_); | 77 if (started_) |
| 78 debugger_->AsyncTaskFinished(task_); |
75 if (!recurring_) | 79 if (!recurring_) |
76 debugger_->AsyncTaskCanceled(task_); | 80 debugger_->AsyncTaskCanceled(task_); |
77 } | 81 } |
78 } | 82 } |
79 | 83 |
80 void AsyncTaskScheduled(ExecutionContext* context, | 84 void AsyncTaskScheduled(ExecutionContext* context, |
81 const String& name, | 85 const String& name, |
82 void* task) { | 86 void* task) { |
83 TRACE_EVENT_FLOW_BEGIN1("devtools.timeline.async", "AsyncTask", | 87 TRACE_EVENT_FLOW_BEGIN1("devtools.timeline.async", "AsyncTask", |
84 TRACE_ID_LOCAL(reinterpret_cast<uintptr_t>(task)), | 88 TRACE_ID_LOCAL(reinterpret_cast<uintptr_t>(task)), |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 void ContinueWithPolicyIgnore(LocalFrame* frame, | 136 void ContinueWithPolicyIgnore(LocalFrame* frame, |
133 DocumentLoader* loader, | 137 DocumentLoader* loader, |
134 unsigned long identifier, | 138 unsigned long identifier, |
135 const ResourceResponse& r, | 139 const ResourceResponse& r, |
136 Resource* resource) { | 140 Resource* resource) { |
137 DidReceiveResourceResponseButCanceled(frame, loader, identifier, r, resource); | 141 DidReceiveResourceResponseButCanceled(frame, loader, identifier, r, resource); |
138 } | 142 } |
139 | 143 |
140 } // namespace probe | 144 } // namespace probe |
141 } // namespace blink | 145 } // namespace blink |
OLD | NEW |