Chromium Code Reviews| Index: third_party/WebKit/Source/modules/indexeddb/IDBRequest.h |
| diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBRequest.h b/third_party/WebKit/Source/modules/indexeddb/IDBRequest.h |
| index 9f271b74ea499cc7318d796a7b5fdf5c67f007cd..11e61e25c45a35f924f99db2218ea81a5e5fadbd 100644 |
| --- a/third_party/WebKit/Source/modules/indexeddb/IDBRequest.h |
| +++ b/third_party/WebKit/Source/modules/indexeddb/IDBRequest.h |
| @@ -31,6 +31,7 @@ |
| #include <memory> |
| +#include "base/macros.h" |
| #include "bindings/core/v8/ScriptValue.h" |
| #include "core/dom/DOMStringList.h" |
| #include "core/dom/SuspendableObject.h" |
| @@ -46,6 +47,7 @@ |
| #include "platform/blob/BlobData.h" |
| #include "platform/heap/Handle.h" |
| #include "platform/wtf/HashMap.h" |
| +#include "platform/wtf/Time.h" |
| #include "public/platform/WebBlobInfo.h" |
| #include "public/platform/modules/indexeddb/WebIDBCursor.h" |
| #include "public/platform/modules/indexeddb/WebIDBTypes.h" |
| @@ -65,7 +67,30 @@ class MODULES_EXPORT IDBRequest : public EventTargetWithInlineData, |
| USING_GARBAGE_COLLECTED_MIXIN(IDBRequest); |
| public: |
| - static IDBRequest* Create(ScriptState*, IDBAny* source, IDBTransaction*); |
| + // Records async tracing, starting on contruction and ending on destruction or |
| + // a to |RecordAndReset()|. |
|
pwnall
2017/05/25 23:04:25
a call to?
dmurph
2017/05/31 19:26:25
Done.
|
| + class AsyncTraceState { |
| + public: |
| + AsyncTraceState(); |
| + AsyncTraceState(const char* tracing_name, void*); |
| + ~AsyncTraceState(); |
| + AsyncTraceState(AsyncTraceState&&); |
| + IDBRequest::AsyncTraceState& operator=(IDBRequest::AsyncTraceState&&); |
| + |
| + bool is_valid() const { return tracing_name_; } |
| + void RecordAndReset(); |
| + |
| + private: |
| + const char* tracing_name_ = nullptr; |
| + void* id_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(AsyncTraceState); |
| + }; |
| + |
| + static IDBRequest* Create(ScriptState*, |
| + IDBAny* source, |
| + IDBTransaction*, |
| + AsyncTraceState); |
| ~IDBRequest() override; |
| DECLARE_VIRTUAL_TRACE(); |
| @@ -153,8 +178,13 @@ class MODULES_EXPORT IDBRequest : public EventTargetWithInlineData, |
| transit_blob_handles_ = std::move(blob_handles); |
| } |
| + void AssignNewMetrics(AsyncTraceState metrics) { |
| + DCHECK(!metrics_.is_valid()); |
| + metrics_ = std::move(metrics); |
| + } |
| + |
| protected: |
| - IDBRequest(ScriptState*, IDBAny* source, IDBTransaction*); |
| + IDBRequest(ScriptState*, IDBAny* source, IDBTransaction*, AsyncTraceState); |
| void EnqueueEvent(Event*); |
| void DequeueEvent(Event*); |
| virtual bool ShouldEnqueueEvent() const; |
| @@ -186,6 +216,8 @@ class MODULES_EXPORT IDBRequest : public EventTargetWithInlineData, |
| Member<IDBAny> result_; |
| Member<DOMException> error_; |
| + AsyncTraceState metrics_; |
| + |
| bool has_pending_activity_ = true; |
| HeapVector<Member<Event>> enqueued_events_; |