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

Unified Diff: Source/core/loader/ThreadableLoaderClientWrapper.h

Issue 1184403003: Offer Resource Timing in workers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: comment fix Created 5 years, 6 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: Source/core/loader/ThreadableLoaderClientWrapper.h
diff --git a/Source/core/loader/ThreadableLoaderClientWrapper.h b/Source/core/loader/ThreadableLoaderClientWrapper.h
index eb3782ecf5b5461f61fd53893bd60fe735a5dd3c..5a57ffb5713c58d56a679ed2195247c0ebb58807 100644
--- a/Source/core/loader/ThreadableLoaderClientWrapper.h
+++ b/Source/core/loader/ThreadableLoaderClientWrapper.h
@@ -41,6 +41,11 @@ namespace blink {
class ThreadableLoaderClientWrapper : public ThreadSafeRefCounted<ThreadableLoaderClientWrapper> {
public:
+ class ResourceTimingClient {
+ public:
+ virtual void didReceiveResourceTiming(const ResourceTimingInfo&) = 0;
+ };
+
static PassRefPtr<ThreadableLoaderClientWrapper> create(ThreadableLoaderClient* client)
{
return adoptRef(new ThreadableLoaderClientWrapper(client));
@@ -50,6 +55,7 @@ public:
{
m_done = true;
m_client = 0;
+ clearResourceTimingClient();
}
bool done() const
@@ -57,6 +63,16 @@ public:
return m_done;
}
+ void setResourceTimingClient(ResourceTimingClient* client)
+ {
+ m_resourceTimingClient = client;
+ }
+
+ void clearResourceTimingClient()
+ {
+ m_resourceTimingClient = nullptr;
+ }
+
void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent)
{
if (m_client)
@@ -124,14 +140,22 @@ public:
m_client->didDownloadData(dataLength);
}
+ void didReceiveResourceTiming(const ResourceTimingInfo& info)
+ {
+ if (m_resourceTimingClient)
+ m_resourceTimingClient->didReceiveResourceTiming(info);
+ }
+
protected:
explicit ThreadableLoaderClientWrapper(ThreadableLoaderClient* client)
: m_client(client)
+ , m_resourceTimingClient(nullptr)
, m_done(false)
{
}
ThreadableLoaderClient* m_client;
+ ResourceTimingClient* m_resourceTimingClient;
bool m_done;
};

Powered by Google App Engine
This is Rietveld 408576698