| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 17 matching lines...) Expand all Loading... |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "core/inspector/AsyncCallStackTracker.h" | 32 #include "core/inspector/AsyncCallStackTracker.h" |
| 33 | 33 |
| 34 #include "bindings/core/v8/V8Binding.h" | 34 #include "bindings/core/v8/V8Binding.h" |
| 35 #include "bindings/core/v8/V8RecursionScope.h" | 35 #include "bindings/core/v8/V8RecursionScope.h" |
| 36 #include "core/dom/ExecutionContext.h" | 36 #include "core/dom/ExecutionContext.h" |
| 37 #include "core/dom/ExecutionContextTask.h" | 37 #include "core/dom/ExecutionContextTask.h" |
| 38 #include "core/dom/Microtask.h" |
| 38 #include "core/events/Event.h" | 39 #include "core/events/Event.h" |
| 39 #include "core/events/EventTarget.h" | 40 #include "core/events/EventTarget.h" |
| 40 #include "core/xml/XMLHttpRequest.h" | 41 #include "core/xml/XMLHttpRequest.h" |
| 41 #include "core/xml/XMLHttpRequestUpload.h" | 42 #include "core/xml/XMLHttpRequestUpload.h" |
| 42 #include "wtf/text/StringBuilder.h" | 43 #include "wtf/text/StringBuilder.h" |
| 43 #include "wtf/text/StringHash.h" | 44 #include "wtf/text/StringHash.h" |
| 44 #include <v8.h> | 45 #include <v8.h> |
| 45 | 46 |
| 46 namespace { | 47 namespace { |
| 47 | 48 |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 return m_currentAsyncCallChain; // Propogate async call stack chain. | 411 return m_currentAsyncCallChain; // Propogate async call stack chain. |
| 411 } | 412 } |
| 412 RefPtrWillBeRawPtr<AsyncCallChain> chain = adoptRefWillBeNoop(m_currentAsync
CallChain ? new AsyncCallStackTracker::AsyncCallChain(*m_currentAsyncCallChain)
: new AsyncCallStackTracker::AsyncCallChain()); | 413 RefPtrWillBeRawPtr<AsyncCallChain> chain = adoptRefWillBeNoop(m_currentAsync
CallChain ? new AsyncCallStackTracker::AsyncCallChain(*m_currentAsyncCallChain)
: new AsyncCallStackTracker::AsyncCallChain()); |
| 413 ensureMaxAsyncCallChainDepth(chain.get(), m_maxAsyncCallStackDepth - 1); | 414 ensureMaxAsyncCallChainDepth(chain.get(), m_maxAsyncCallStackDepth - 1); |
| 414 chain->m_callStacks.prepend(adoptRefWillBeNoop(new AsyncCallStackTracker::As
yncCallStack(description, callFrames))); | 415 chain->m_callStacks.prepend(adoptRefWillBeNoop(new AsyncCallStackTracker::As
yncCallStack(description, callFrames))); |
| 415 return chain.release(); | 416 return chain.release(); |
| 416 } | 417 } |
| 417 | 418 |
| 418 void AsyncCallStackTracker::setCurrentAsyncCallChain(ExecutionContext* context,
PassRefPtrWillBeRawPtr<AsyncCallChain> chain) | 419 void AsyncCallStackTracker::setCurrentAsyncCallChain(ExecutionContext* context,
PassRefPtrWillBeRawPtr<AsyncCallChain> chain) |
| 419 { | 420 { |
| 420 if (chain && !V8RecursionScope::recursionLevel(toIsolate(context))) { | 421 v8::Isolate* isolate = toIsolate(context); |
| 422 int recursionLevel = V8RecursionScope::recursionLevel(isolate); |
| 423 if (chain && (!recursionLevel || (recursionLevel == 1 && Microtask::performi
ngCheckpoint(isolate)))) { |
| 421 // Current AsyncCallChain corresponds to the bottommost JS call frame. | 424 // Current AsyncCallChain corresponds to the bottommost JS call frame. |
| 422 m_currentAsyncCallChain = chain; | 425 m_currentAsyncCallChain = chain; |
| 423 m_nestedAsyncCallCount = 1; | 426 m_nestedAsyncCallCount = 1; |
| 424 } else { | 427 } else { |
| 425 if (m_currentAsyncCallChain) | 428 if (m_currentAsyncCallChain) |
| 426 ++m_nestedAsyncCallCount; | 429 ++m_nestedAsyncCallCount; |
| 427 } | 430 } |
| 428 } | 431 } |
| 429 | 432 |
| 430 void AsyncCallStackTracker::clearCurrentAsyncCallChain() | 433 void AsyncCallStackTracker::clearCurrentAsyncCallChain() |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 | 469 |
| 467 void AsyncCallStackTracker::trace(Visitor* visitor) | 470 void AsyncCallStackTracker::trace(Visitor* visitor) |
| 468 { | 471 { |
| 469 visitor->trace(m_currentAsyncCallChain); | 472 visitor->trace(m_currentAsyncCallChain); |
| 470 #if ENABLE(OILPAN) | 473 #if ENABLE(OILPAN) |
| 471 visitor->trace(m_executionContextDataMap); | 474 visitor->trace(m_executionContextDataMap); |
| 472 #endif | 475 #endif |
| 473 } | 476 } |
| 474 | 477 |
| 475 } // namespace blink | 478 } // namespace blink |
| OLD | NEW |