| Index: third_party/WebKit/Source/platform/blob/BlobRegistry.cpp
|
| diff --git a/third_party/WebKit/Source/platform/blob/BlobRegistry.cpp b/third_party/WebKit/Source/platform/blob/BlobRegistry.cpp
|
| index 24a8f2ed2342dd196263468cf2ba9538a659e649..eb179fccb5dfe0c6956adca2242f6a7ac21d213f 100644
|
| --- a/third_party/WebKit/Source/platform/blob/BlobRegistry.cpp
|
| +++ b/third_party/WebKit/Source/platform/blob/BlobRegistry.cpp
|
| @@ -30,7 +30,9 @@
|
|
|
| #include "platform/blob/BlobRegistry.h"
|
|
|
| +#include <memory>
|
| #include "platform/CrossThreadFunctional.h"
|
| +#include "platform/Histogram.h"
|
| #include "platform/WebTaskRunner.h"
|
| #include "platform/blob/BlobData.h"
|
| #include "platform/blob/BlobURL.h"
|
| @@ -42,13 +44,13 @@
|
| #include "public/platform/WebString.h"
|
| #include "public/platform/WebTraceLocation.h"
|
| #include "wtf/Assertions.h"
|
| +#include "wtf/CurrentTime.h"
|
| #include "wtf/HashMap.h"
|
| #include "wtf/RefPtr.h"
|
| #include "wtf/ThreadSpecific.h"
|
| #include "wtf/Threading.h"
|
| #include "wtf/text/StringHash.h"
|
| #include "wtf/text/WTFString.h"
|
| -#include <memory>
|
|
|
| namespace blink {
|
|
|
| @@ -114,20 +116,38 @@ void BlobRegistry::revokePublicBlobURL(const KURL& url) {
|
| getBlobRegistry()->revokePublicBlobURL(url);
|
| }
|
|
|
| -static void registerStreamURLTask(const KURL& url, const String& type) {
|
| +static void registerStreamURLTask(const KURL& url,
|
| + const String& type,
|
| + double postTaskTime) {
|
| + int value =
|
| + static_cast<int>((monotonicallyIncreasingTime() - postTaskTime) * 1000);
|
| + DEFINE_STATIC_LOCAL(CustomCountHistogram, hist,
|
| + ("SWF.E1.Stream.RegisterStreamURLTask", 0, 10000000, 50));
|
| + if (postTaskTime != 0)
|
| + hist.count(value);
|
| if (WebBlobRegistry* registry = getBlobRegistry())
|
| registry->registerStreamURL(url, type);
|
| }
|
|
|
| void BlobRegistry::registerStreamURL(const KURL& url, const String& type) {
|
| if (isMainThread())
|
| - registerStreamURLTask(url, type);
|
| + registerStreamURLTask(url, type, 0);
|
| else
|
| Platform::current()->mainThread()->getWebTaskRunner()->postTask(
|
| - BLINK_FROM_HERE, crossThreadBind(®isterStreamURLTask, url, type));
|
| + BLINK_FROM_HERE, crossThreadBind(®isterStreamURLTask, url, type,
|
| + monotonicallyIncreasingTime()));
|
| }
|
|
|
| -static void registerStreamURLFromTask(const KURL& url, const KURL& srcURL) {
|
| +static void registerStreamURLFromTask(const KURL& url,
|
| + const KURL& srcURL,
|
| + double postTaskTime) {
|
| + int value =
|
| + static_cast<int>((monotonicallyIncreasingTime() - postTaskTime) * 1000);
|
| + DEFINE_STATIC_LOCAL(
|
| + CustomCountHistogram, hist,
|
| + ("SWF.E1.Stream.registerStreamURLFromTask", 0, 10000000, 50));
|
| + if (postTaskTime != 0)
|
| + hist.count(value);
|
| if (WebBlobRegistry* registry = getBlobRegistry())
|
| registry->registerStreamURL(url, srcURL);
|
| }
|
| @@ -138,15 +158,24 @@ void BlobRegistry::registerStreamURL(SecurityOrigin* origin,
|
| saveToOriginMap(origin, url);
|
|
|
| if (isMainThread())
|
| - registerStreamURLFromTask(url, srcURL);
|
| + registerStreamURLFromTask(url, srcURL, 0);
|
| else
|
| Platform::current()->mainThread()->getWebTaskRunner()->postTask(
|
| BLINK_FROM_HERE,
|
| - crossThreadBind(®isterStreamURLFromTask, url, srcURL));
|
| + crossThreadBind(®isterStreamURLFromTask, url, srcURL,
|
| + monotonicallyIncreasingTime()));
|
| }
|
|
|
| static void addDataToStreamTask(const KURL& url,
|
| - PassRefPtr<RawData> streamData) {
|
| + PassRefPtr<RawData> streamData,
|
| + double postTaskTime) {
|
| + int value =
|
| + static_cast<int>((monotonicallyIncreasingTime() - postTaskTime) * 1000);
|
| + DEFINE_STATIC_LOCAL(CustomCountHistogram, hist,
|
| + ("SWF.E2.Stream.AddDataToStreamTask", 0, 10000000, 50));
|
| + if (postTaskTime != 0)
|
| + hist.count(value);
|
| +
|
| if (WebBlobRegistry* registry = getBlobRegistry())
|
| registry->addDataToStream(url, streamData->data(), streamData->length());
|
| }
|
| @@ -154,53 +183,83 @@ static void addDataToStreamTask(const KURL& url,
|
| void BlobRegistry::addDataToStream(const KURL& url,
|
| PassRefPtr<RawData> streamData) {
|
| if (isMainThread())
|
| - addDataToStreamTask(url, std::move(streamData));
|
| + addDataToStreamTask(url, std::move(streamData), 0);
|
| else
|
| Platform::current()->mainThread()->getWebTaskRunner()->postTask(
|
| BLINK_FROM_HERE,
|
| - crossThreadBind(&addDataToStreamTask, url, std::move(streamData)));
|
| + crossThreadBind(&addDataToStreamTask, url, std::move(streamData),
|
| + monotonicallyIncreasingTime()));
|
| }
|
|
|
| -static void flushStreamTask(const KURL& url) {
|
| +static void flushStreamTask(const KURL& url, double postTaskTime) {
|
| + int value =
|
| + static_cast<int>((monotonicallyIncreasingTime() - postTaskTime) * 1000);
|
| + DEFINE_STATIC_LOCAL(CustomCountHistogram, hist,
|
| + ("SWF.E3.Stream.FlushStreamTask", 0, 10000000, 50));
|
| + if (postTaskTime != 0)
|
| + hist.count(value);
|
| +
|
| if (WebBlobRegistry* registry = getBlobRegistry())
|
| registry->flushStream(url);
|
| }
|
|
|
| void BlobRegistry::flushStream(const KURL& url) {
|
| if (isMainThread())
|
| - flushStreamTask(url);
|
| + flushStreamTask(url, 0);
|
| else
|
| Platform::current()->mainThread()->getWebTaskRunner()->postTask(
|
| - BLINK_FROM_HERE, crossThreadBind(&flushStreamTask, url));
|
| + BLINK_FROM_HERE,
|
| + crossThreadBind(&flushStreamTask, url, monotonicallyIncreasingTime()));
|
| }
|
|
|
| -static void finalizeStreamTask(const KURL& url) {
|
| +static void finalizeStreamTask(const KURL& url, double postTaskTime) {
|
| + int value =
|
| + static_cast<int>((monotonicallyIncreasingTime() - postTaskTime) * 1000);
|
| + DEFINE_STATIC_LOCAL(CustomCountHistogram, hist,
|
| + ("SWF.E4.Stream.FinalizeStreamTask", 0, 10000000, 50));
|
| + if (postTaskTime != 0)
|
| + hist.count(value);
|
| if (WebBlobRegistry* registry = getBlobRegistry())
|
| registry->finalizeStream(url);
|
| }
|
|
|
| void BlobRegistry::finalizeStream(const KURL& url) {
|
| if (isMainThread())
|
| - finalizeStreamTask(url);
|
| + finalizeStreamTask(url, 0);
|
| else
|
| Platform::current()->mainThread()->getWebTaskRunner()->postTask(
|
| - BLINK_FROM_HERE, crossThreadBind(&finalizeStreamTask, url));
|
| + BLINK_FROM_HERE, crossThreadBind(&finalizeStreamTask, url,
|
| + monotonicallyIncreasingTime()));
|
| }
|
|
|
| -static void abortStreamTask(const KURL& url) {
|
| +static void abortStreamTask(const KURL& url, double postTaskTime) {
|
| + int value =
|
| + static_cast<int>((monotonicallyIncreasingTime() - postTaskTime) * 1000);
|
| + DEFINE_STATIC_LOCAL(CustomCountHistogram, hist,
|
| + ("SWF.E5.Stream.AbortStreamTask", 0, 10000000, 50));
|
| + if (postTaskTime != 0)
|
| + hist.count(value);
|
| if (WebBlobRegistry* registry = getBlobRegistry())
|
| registry->abortStream(url);
|
| }
|
|
|
| void BlobRegistry::abortStream(const KURL& url) {
|
| if (isMainThread())
|
| - abortStreamTask(url);
|
| + abortStreamTask(url, 0);
|
| else
|
| Platform::current()->mainThread()->getWebTaskRunner()->postTask(
|
| - BLINK_FROM_HERE, crossThreadBind(&abortStreamTask, url));
|
| + BLINK_FROM_HERE,
|
| + crossThreadBind(&abortStreamTask, url, monotonicallyIncreasingTime()));
|
| }
|
|
|
| -static void unregisterStreamURLTask(const KURL& url) {
|
| +static void unregisterStreamURLTask(const KURL& url, double postTaskTime) {
|
| + int value =
|
| + static_cast<int>((monotonicallyIncreasingTime() - postTaskTime) * 1000);
|
| + DEFINE_STATIC_LOCAL(
|
| + CustomCountHistogram, hist,
|
| + ("SWF.E6.Stream.UnregisterStreamURLTask", 0, 10000000, 50));
|
| + if (postTaskTime != 0)
|
| + hist.count(value);
|
| if (WebBlobRegistry* registry = getBlobRegistry())
|
| registry->unregisterStreamURL(url);
|
| }
|
| @@ -209,10 +268,11 @@ void BlobRegistry::unregisterStreamURL(const KURL& url) {
|
| removeFromOriginMap(url);
|
|
|
| if (isMainThread())
|
| - unregisterStreamURLTask(url);
|
| + unregisterStreamURLTask(url, 0);
|
| else
|
| Platform::current()->mainThread()->getWebTaskRunner()->postTask(
|
| - BLINK_FROM_HERE, crossThreadBind(&unregisterStreamURLTask, url));
|
| + BLINK_FROM_HERE, crossThreadBind(&unregisterStreamURLTask, url,
|
| + monotonicallyIncreasingTime()));
|
| }
|
|
|
| BlobOriginMap::BlobOriginMap() {
|
|
|