Chromium Code Reviews| Index: Source/core/inspector/PromiseOfficer.h |
| diff --git a/Source/core/inspector/PromiseOfficer.h b/Source/core/inspector/PromiseOfficer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4f426da3dbb98f55be32f8c97077bb24b8e863b5 |
| --- /dev/null |
| +++ b/Source/core/inspector/PromiseOfficer.h |
| @@ -0,0 +1,91 @@ |
| +/* |
| + * Copyright (C) 2014 Google Inc. All rights reserved. |
| + * |
| + * Redistribution and use in source and binary forms, with or without |
| + * modification, are permitted provided that the following conditions are |
| + * met: |
| + * |
| + * * Redistributions of source code must retain the above copyright |
| + * notice, this list of conditions and the following disclaimer. |
| + * * Redistributions in binary form must reproduce the above |
| + * copyright notice, this list of conditions and the following disclaimer |
| + * in the documentation and/or other materials provided with the |
| + * distribution. |
| + * * Neither the name of Google Inc. nor the names of its |
| + * contributors may be used to endorse or promote products derived from |
| + * this software without specific prior written permission. |
| + * |
| + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| + */ |
| + |
| +#ifndef PromiseOfficer_h |
| +#define PromiseOfficer_h |
| + |
| +#include <v8.h> |
| +#include "bindings/v8/custom/V8PromiseCustom.h" |
| +#include "bindings/v8/ScopedPersistent.h" |
| +#include "core/inspector/ScriptCallStack.h" |
| +#include "wtf/HashMap.h" |
| +#include "wtf/Noncopyable.h" |
| +#include "wtf/RefPtr.h" |
| +#include "wtf/Vector.h" |
| + |
| +namespace WebCore { |
| + |
| +class ExecutionContext; |
| + |
| +class PromiseOfficer { |
| + WTF_MAKE_NONCOPYABLE(PromiseOfficer); |
| +public: |
| + PromiseOfficer() : m_isEnabled(false) { } |
| + |
| + bool isEnabled() const { return m_isEnabled; } |
| + void enable(); |
| + void disable(); |
| + |
| + void clear(); |
| + |
| + void didCreatePromise(ExecutionContext* context, v8::Handle<v8::Object> promise); |
| + void didUpdatePromiseParent(v8::Handle<v8::Object> promise, v8::Handle<v8::Object> parentPromise); |
| + void didUpdatePromiseState(v8::Handle<v8::Object> promise, V8PromiseCustom::PromiseState, v8::Handle<v8::Value> result); |
| + |
| +private: |
| + struct PromiseData : public RefCounted<PromiseData> { |
|
aandrey
2014/03/04 09:26:28
now struct -> class, but leave all members public
Alexandra Mikhaylova
2014/03/05 13:10:39
Done.
|
| + PromiseData(v8::Handle<v8::Object> promise, v8::Handle<v8::Object> parentPromise, v8::Handle<v8::Value> result, V8PromiseCustom::PromiseState state, double timestamp, v8::Isolate* isolate); |
| + |
| + void didSettlePromise(double timestamp); |
| + |
| + v8::Isolate* isolate; |
|
aandrey
2014/03/04 09:26:28
m_isolate
Alexandra Mikhaylova
2014/03/05 13:10:39
Done.
|
| + |
| + ScopedPersistent<v8::Object> promise; |
|
aandrey
2014/03/04 09:26:28
m_promise
same below
Alexandra Mikhaylova
2014/03/05 13:10:39
Done.
|
| + ScopedPersistent<v8::Object> parentPromise; |
| + ScopedPersistent<v8::Value> result; |
| + V8PromiseCustom::PromiseState state; |
| + |
| + // Time in milliseconds. |
| + double timeOnCreate; |
| + double timeOnSettle; |
| + |
| + RefPtr<ScriptCallStack> callStackOnCreate; |
| + RefPtr<ScriptCallStack> callStackOnSettle; |
| + }; |
| + |
| + bool m_isEnabled; |
| + typedef Vector<RefPtr<PromiseData> > PromiseDataVector; |
| + typedef HashMap<int, PromiseDataVector> PromiseDataMap; |
| + PromiseDataMap m_promiseDataMap; |
| +}; |
| + |
| +} // namespace WebCore |
| + |
| +#endif // !defined(PromiseOfficer_h) |