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

Unified Diff: third_party/WebKit/Source/modules/indexeddb/IDBRequest.h

Issue 2890023003: [IndexedDB] Adding async tracing for renderer calls. (Closed)
Patch Set: fixed tests Created 3 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 side-by-side diff with in-line comments
Download patch
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..de5141f6a5b1524964e6d077d65611bb1aaa556a 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,28 @@ class MODULES_EXPORT IDBRequest : public EventTargetWithInlineData,
USING_GARBAGE_COLLECTED_MIXIN(IDBRequest);
public:
- static IDBRequest* Create(ScriptState*, IDBAny* source, IDBTransaction*);
+ // Records async tracing, starting oncontruction and ending on destruction.
pwnall 2017/05/18 22:14:32 onconstruction -> missing space?
dmurph 2017/05/18 23:51:15 Done.
+ // UMA timing metrics are recorded on RecordUMAMetrics.
+ class ScopedMetricsTracker {
+ public:
+ ScopedMetricsTracker(const char* uma_name, const char* tracing_name, void*);
+ ~ScopedMetricsTracker();
+
+ void RecordUMAMetrics() const;
+
+ private:
+ const char* uma_name_ = nullptr;
+ const char* tracing_name_ = nullptr;
+ void* id_;
+ WTF::TimeTicks start_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedMetricsTracker);
+ };
+
+ static IDBRequest* Create(ScriptState*,
+ IDBAny* source,
+ IDBTransaction*,
+ std::unique_ptr<ScopedMetricsTracker>);
~IDBRequest() override;
DECLARE_VIRTUAL_TRACE();
@@ -153,8 +176,16 @@ class MODULES_EXPORT IDBRequest : public EventTargetWithInlineData,
transit_blob_handles_ = std::move(blob_handles);
}
+ void AssignNewMetrics(std::unique_ptr<ScopedMetricsTracker> metrics) {
+ DCHECK(!metrics_);
+ metrics_ = std::move(metrics);
+ }
+
protected:
- IDBRequest(ScriptState*, IDBAny* source, IDBTransaction*);
+ IDBRequest(ScriptState*,
+ IDBAny* source,
+ IDBTransaction*,
+ std::unique_ptr<ScopedMetricsTracker>);
void EnqueueEvent(Event*);
void DequeueEvent(Event*);
virtual bool ShouldEnqueueEvent() const;
@@ -180,12 +211,21 @@ class MODULES_EXPORT IDBRequest : public EventTargetWithInlineData,
void AckReceivedBlobs(const IDBValue*);
void AckReceivedBlobs(const Vector<RefPtr<IDBValue>>&);
+ void MaybeRecordMetrics() {
pwnall 2017/05/18 22:14:32 metrics_ only seems to be null in testing. 1) Can
dmurph 2017/05/18 23:51:15 Done.
+ if (metrics_) {
+ metrics_->RecordUMAMetrics();
+ metrics_.reset();
+ }
+ }
+
void ClearPutOperationBlobs() { transit_blob_handles_.clear(); }
Member<IDBAny> source_;
Member<IDBAny> result_;
Member<DOMException> error_;
+ std::unique_ptr<ScopedMetricsTracker> metrics_;
+
bool has_pending_activity_ = true;
HeapVector<Member<Event>> enqueued_events_;

Powered by Google App Engine
This is Rietveld 408576698