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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 #include "core/workers/WorkerGlobalScope.h" | 45 #include "core/workers/WorkerGlobalScope.h" |
46 #include "platform/instrumentation/tracing/TraceEvent.h" | 46 #include "platform/instrumentation/tracing/TraceEvent.h" |
47 #include "platform/loader/fetch/FetchInitiatorInfo.h" | 47 #include "platform/loader/fetch/FetchInitiatorInfo.h" |
48 | 48 |
49 namespace blink { | 49 namespace blink { |
50 namespace probe { | 50 namespace probe { |
51 | 51 |
52 AsyncTask::AsyncTask(ExecutionContext* context, | 52 AsyncTask::AsyncTask(ExecutionContext* context, |
53 void* task, | 53 void* task, |
54 const char* step, | 54 const char* step, |
55 bool enabled) | 55 bool enabled, |
56 bool optional) | |
56 : debugger_(enabled ? ThreadDebugger::From(ToIsolate(context)) : nullptr), | 57 : debugger_(enabled ? ThreadDebugger::From(ToIsolate(context)) : nullptr), |
57 task_(task), | 58 task_(task), |
58 recurring_(step) { | 59 recurring_(step) { |
59 if (recurring_) { | 60 if (recurring_) { |
60 TRACE_EVENT_FLOW_STEP0("devtools.timeline.async", "AsyncTask", | 61 TRACE_EVENT_FLOW_STEP0("devtools.timeline.async", "AsyncTask", |
61 TRACE_ID_LOCAL(reinterpret_cast<uintptr_t>(task)), | 62 TRACE_ID_LOCAL(reinterpret_cast<uintptr_t>(task)), |
62 step ? step : ""); | 63 step ? step : ""); |
63 } else { | 64 } else { |
64 TRACE_EVENT_FLOW_END0("devtools.timeline.async", "AsyncTask", | 65 TRACE_EVENT_FLOW_END0("devtools.timeline.async", "AsyncTask", |
65 TRACE_ID_LOCAL(reinterpret_cast<uintptr_t>(task))); | 66 TRACE_ID_LOCAL(reinterpret_cast<uintptr_t>(task))); |
66 } | 67 } |
67 if (debugger_) | 68 if (debugger_) { |
69 if (optional && debugger_->IsRunningAsyncTask()) { | |
dgozman
2017/05/10 18:36:30
Instead of calling this, pass optional to AsyncTas
kozy
2017/05/10 21:24:01
Done.
| |
70 debugger_ = nullptr; | |
71 return; | |
72 } | |
68 debugger_->AsyncTaskStarted(task_); | 73 debugger_->AsyncTaskStarted(task_); |
74 } | |
69 } | 75 } |
70 | 76 |
71 AsyncTask::~AsyncTask() { | 77 AsyncTask::~AsyncTask() { |
72 if (debugger_) { | 78 if (debugger_) { |
73 debugger_->AsyncTaskFinished(task_); | 79 debugger_->AsyncTaskFinished(task_); |
74 if (!recurring_) | 80 if (!recurring_) |
75 debugger_->AsyncTaskCanceled(task_); | 81 debugger_->AsyncTaskCanceled(task_); |
76 } | 82 } |
77 } | 83 } |
78 | 84 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
131 void ContinueWithPolicyIgnore(LocalFrame* frame, | 137 void ContinueWithPolicyIgnore(LocalFrame* frame, |
132 DocumentLoader* loader, | 138 DocumentLoader* loader, |
133 unsigned long identifier, | 139 unsigned long identifier, |
134 const ResourceResponse& r, | 140 const ResourceResponse& r, |
135 Resource* resource) { | 141 Resource* resource) { |
136 DidReceiveResourceResponseButCanceled(frame, loader, identifier, r, resource); | 142 DidReceiveResourceResponseButCanceled(frame, loader, identifier, r, resource); |
137 } | 143 } |
138 | 144 |
139 } // namespace probe | 145 } // namespace probe |
140 } // namespace blink | 146 } // namespace blink |
OLD | NEW |