Commit 3fcbfceb authored by panicker's avatar panicker Committed by Commit bot

Add use counter for chrome.loadTimes

BUG=621512

Review-Url: https://codereview.chromium.org/2222573003
Cr-Commit-Position: refs/heads/master@{#410427}
parent 52bd4f77
...@@ -109,7 +109,10 @@ class LoadTimesExtensionWrapper : public v8::Extension { ...@@ -109,7 +109,10 @@ class LoadTimesExtensionWrapper : public v8::Extension {
static void LoadtimesGetter( static void LoadtimesGetter(
v8::Local<v8::Name> name, v8::Local<v8::Name> name,
const v8::PropertyCallbackInfo<v8::Value>& info) { const v8::PropertyCallbackInfo<v8::Value>& info) {
// TODO(panicker): Add Usage counter. if (WebLocalFrame* frame = WebLocalFrame::frameForCurrentContext()) {
frame->usageCountChromeLoadTimes(blink::WebString::fromUTF8(
*v8::String::Utf8Value(name)));
}
info.GetReturnValue().Set(info.Data()); info.GetReturnValue().Set(info.Data());
} }
......
...@@ -1259,6 +1259,21 @@ public: ...@@ -1259,6 +1259,21 @@ public:
SVGSMILAdditiveAnimation = 1484, SVGSMILAdditiveAnimation = 1484,
SendBeaconWithNonSimpleContentType = 1485, SendBeaconWithNonSimpleContentType = 1485,
ChromeLoadTimesRequestTime = 1486,
ChromeLoadTimesStartLoadTime = 1487,
ChromeLoadTimesCommitLoadTime = 1488,
ChromeLoadTimesFinishDocumentLoadTime = 1489,
ChromeLoadTimesFinishLoadTime = 1490,
ChromeLoadTimesFirstPaintTime = 1491,
ChromeLoadTimesFirstPaintAfterLoadTime = 1492,
ChromeLoadTimesNavigationType = 1493,
ChromeLoadTimesWasFetchedViaSpdy = 1494,
ChromeLoadTimesWasNpnNegotiated = 1495,
ChromeLoadTimesNpnNegotiatedProtocol = 1496,
ChromeLoadTimesWasAlternateProtocolAvailable = 1497,
ChromeLoadTimesConnectionInfo = 1498,
ChromeLoadTimesUnknown = 1499,
// Add new features immediately above this line. Don't change assigned // Add new features immediately above this line. Don't change assigned
// numbers of any item, and don't reuse removed slots. // numbers of any item, and don't reuse removed slots.
// Also, run update_use_counter_feature_enum.py in chromium/src/tools/metrics/histograms/ // Also, run update_use_counter_feature_enum.py in chromium/src/tools/metrics/histograms/
......
...@@ -2188,4 +2188,37 @@ void WebLocalFrameImpl::clearActiveFindMatch() ...@@ -2188,4 +2188,37 @@ void WebLocalFrameImpl::clearActiveFindMatch()
ensureTextFinder().clearActiveFindMatch(); ensureTextFinder().clearActiveFindMatch();
} }
void WebLocalFrameImpl::usageCountChromeLoadTimes(const WebString& metric)
{
UseCounter::Feature feature = UseCounter::ChromeLoadTimesUnknown;
if (metric == "requestTime") {
feature = UseCounter::ChromeLoadTimesRequestTime;
} else if (metric == "startLoadTime") {
feature = UseCounter::ChromeLoadTimesStartLoadTime;
} else if (metric == "commitLoadTime") {
feature = UseCounter::ChromeLoadTimesCommitLoadTime;
} else if (metric == "finishDocumentLoadTime") {
feature = UseCounter::ChromeLoadTimesFinishDocumentLoadTime;
} else if (metric == "finishLoadTime") {
feature = UseCounter::ChromeLoadTimesFinishLoadTime;
} else if (metric == "firstPaintTime") {
feature = UseCounter::ChromeLoadTimesFirstPaintTime;
} else if (metric == "firstPaintAfterLoadTime") {
feature = UseCounter::ChromeLoadTimesFirstPaintAfterLoadTime;
} else if (metric == "navigationType") {
feature = UseCounter::ChromeLoadTimesNavigationType;
} else if (metric == "wasFetchedViaSpdy") {
feature = UseCounter::ChromeLoadTimesWasFetchedViaSpdy;
} else if (metric == "wasNpnNegotiated") {
feature = UseCounter::ChromeLoadTimesWasNpnNegotiated;
} else if (metric == "npnNegotiatedProtocol") {
feature = UseCounter::ChromeLoadTimesNpnNegotiatedProtocol;
} else if (metric == "wasAlternateProtocolAvailable") {
feature = UseCounter::ChromeLoadTimesWasAlternateProtocolAvailable;
} else if (metric == "connectionInfo") {
feature = UseCounter::ChromeLoadTimesConnectionInfo;
}
UseCounter::count(frame(), feature);
}
} // namespace blink } // namespace blink
...@@ -241,6 +241,7 @@ public: ...@@ -241,6 +241,7 @@ public:
void copyImageAt(const WebPoint&) override; void copyImageAt(const WebPoint&) override;
void saveImageAt(const WebPoint&) override; void saveImageAt(const WebPoint&) override;
void clearActiveFindMatch() override; void clearActiveFindMatch() override;
void usageCountChromeLoadTimes(const WebString& metric) override;
// WebFrameImplBase methods: // WebFrameImplBase methods:
void initializeCoreFrame(FrameHost*, FrameOwner*, const AtomicString& name, const AtomicString& uniqueName) override; void initializeCoreFrame(FrameHost*, FrameOwner*, const AtomicString& name, const AtomicString& uniqueName) override;
......
...@@ -405,6 +405,10 @@ public: ...@@ -405,6 +405,10 @@ public:
// coordinates. // coordinates.
virtual void saveImageAt(const WebPoint&) = 0; virtual void saveImageAt(const WebPoint&) = 0;
// TEMP: Usage count for chrome.loadtimes deprecation.
// This will be removed following the deprecation.
virtual void usageCountChromeLoadTimes(const WebString& metric) = 0;
protected: protected:
explicit WebLocalFrame(WebTreeScopeType scope) : WebFrame(scope) { } explicit WebLocalFrame(WebTreeScopeType scope) : WebFrame(scope) { }
......
...@@ -78073,6 +78073,20 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. ...@@ -78073,6 +78073,20 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
<int value="1483" label="StarInTimingAllowOrigin"/> <int value="1483" label="StarInTimingAllowOrigin"/>
<int value="1484" label="SVGSMILAdditiveAnimation"/> <int value="1484" label="SVGSMILAdditiveAnimation"/>
<int value="1485" label="SendBeaconWithNonSimpleContentType"/> <int value="1485" label="SendBeaconWithNonSimpleContentType"/>
<int value="1486" label="ChromeLoadTimesRequestTime"/>
<int value="1487" label="ChromeLoadTimesStartLoadTime"/>
<int value="1488" label="ChromeLoadTimesCommitLoadTime"/>
<int value="1489" label="ChromeLoadTimesFinishDocumentLoadTime"/>
<int value="1490" label="ChromeLoadTimesFinishLoadTime"/>
<int value="1491" label="ChromeLoadTimesFirstPaintTime"/>
<int value="1492" label="ChromeLoadTimesFirstPaintAfterLoadTime"/>
<int value="1493" label="ChromeLoadTimesNavigationType"/>
<int value="1494" label="ChromeLoadTimesWasFetchedViaSpdy"/>
<int value="1495" label="ChromeLoadTimesWasNpnNegotiated"/>
<int value="1496" label="ChromeLoadTimesNpnNegotiatedProtocol"/>
<int value="1497" label="ChromeLoadTimesWasAlternateProtocolAvailable"/>
<int value="1498" label="ChromeLoadTimesConnectionInfo"/>
<int value="1499" label="ChromeLoadTimesUnknown"/>
</enum> </enum>
<enum name="FetchRequestMode" type="int"> <enum name="FetchRequestMode" type="int">
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment