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

Side by Side Diff: Source/core/inspector/PromiseTracker.cpp

Issue 293963003: Remove ScriptObject (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 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 18 matching lines...) Expand all
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 32
33 #include "bindings/v8/ScriptCallStackFactory.h" 33 #include "bindings/v8/ScriptCallStackFactory.h"
34 #include "core/inspector/PromiseTracker.h" 34 #include "core/inspector/PromiseTracker.h"
35 #include "wtf/CurrentTime.h" 35 #include "wtf/CurrentTime.h"
36 36
37 namespace WebCore { 37 namespace WebCore {
38 38
39 PromiseTracker::PromiseData::PromiseData(const ScriptObject& promise, const Scri ptObject& parentPromise, const ScriptValue& result, V8PromiseCustom::PromiseStat e state, double timestamp) 39 PromiseTracker::PromiseData::PromiseData(const ScriptValue& promise, const Scrip tValue& parentPromise, const ScriptValue& result, V8PromiseCustom::PromiseState state, double timestamp)
40 : m_promise(promise) 40 : m_promise(promise)
41 , m_parentPromise(parentPromise) 41 , m_parentPromise(parentPromise)
42 , m_result(result) 42 , m_result(result)
43 , m_state(state) 43 , m_state(state)
44 , m_timeOnCreate(timestamp) 44 , m_timeOnCreate(timestamp)
45 , m_timeOnSettle(-1) 45 , m_timeOnSettle(-1)
46 , m_callStackOnCreate(createScriptCallStack(ScriptCallStack::maxCallStackSiz eToCapture, true)) 46 , m_callStackOnCreate(createScriptCallStack(ScriptCallStack::maxCallStackSiz eToCapture, true))
47 { 47 {
48 } 48 }
49 49
(...skipping 12 matching lines...) Expand all
62 { 62 {
63 m_isEnabled = false; 63 m_isEnabled = false;
64 clear(); 64 clear();
65 } 65 }
66 66
67 void PromiseTracker::clear() 67 void PromiseTracker::clear()
68 { 68 {
69 m_promiseDataMap.clear(); 69 m_promiseDataMap.clear();
70 } 70 }
71 71
72 void PromiseTracker::didCreatePromise(const ScriptObject& promise) 72 void PromiseTracker::didCreatePromise(const ScriptValue& promise)
73 { 73 {
74 ASSERT(isEnabled()); 74 ASSERT(isEnabled());
75 75
76 double timestamp = currentTimeMS(); 76 double timestamp = currentTimeMS();
77 m_promiseDataMap.set(promise, adoptRef(new PromiseData(promise, ScriptObject (), ScriptValue(), V8PromiseCustom::Pending, timestamp))); 77 m_promiseDataMap.set(promise, adoptRef(new PromiseData(promise, ScriptValue( ), ScriptValue(), V8PromiseCustom::Pending, timestamp)));
78 } 78 }
79 79
80 void PromiseTracker::didUpdatePromiseParent(const ScriptObject& promise, const S criptObject& parentPromise) 80 void PromiseTracker::didUpdatePromiseParent(const ScriptValue& promise, const Sc riptValue& parentPromise)
81 { 81 {
82 ASSERT(isEnabled()); 82 ASSERT(isEnabled());
83 83
84 RefPtr<PromiseData> data = m_promiseDataMap.get(promise); 84 RefPtr<PromiseData> data = m_promiseDataMap.get(promise);
85 ASSERT(data != NULL && data->m_promise == promise); 85 ASSERT(data != NULL && data->m_promise == promise);
86 data->m_parentPromise = parentPromise; 86 data->m_parentPromise = parentPromise;
87 } 87 }
88 88
89 void PromiseTracker::didUpdatePromiseState(const ScriptObject& promise, V8Promis eCustom::PromiseState state, const ScriptValue& result) 89 void PromiseTracker::didUpdatePromiseState(const ScriptValue& promise, V8Promise Custom::PromiseState state, const ScriptValue& result)
90 { 90 {
91 ASSERT(isEnabled()); 91 ASSERT(isEnabled());
92 92
93 double timestamp = currentTimeMS(); 93 double timestamp = currentTimeMS();
94 RefPtr<PromiseData> data = m_promiseDataMap.get(promise); 94 RefPtr<PromiseData> data = m_promiseDataMap.get(promise);
95 ASSERT(data != NULL && data->m_promise == promise); 95 ASSERT(data != NULL && data->m_promise == promise);
96 data->m_state = state; 96 data->m_state = state;
97 data->m_result = result; 97 data->m_result = result;
98 if (state == V8PromiseCustom::Fulfilled || state == V8PromiseCustom::Rejecte d) 98 if (state == V8PromiseCustom::Fulfilled || state == V8PromiseCustom::Rejecte d)
99 data->didSettlePromise(timestamp); 99 data->didSettlePromise(timestamp);
100 } 100 }
101 101
102 } // namespace WebCore 102 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698