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

Unified Diff: extensions/renderer/send_request_natives.cc

Issue 2088663002: [Extensions] Add perf metrics for StartRequest()/HandleResponse() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « extensions/renderer/request_sender.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/send_request_natives.cc
diff --git a/extensions/renderer/send_request_natives.cc b/extensions/renderer/send_request_natives.cc
index 2f9d2f5c08a74a0363c40e56221b1438abdcda3e..c27b533278ac3427f7db8bc17ca51d9bc8d67542 100644
--- a/extensions/renderer/send_request_natives.cc
+++ b/extensions/renderer/send_request_natives.cc
@@ -7,6 +7,8 @@
#include <stdint.h>
#include "base/json/json_reader.h"
+#include "base/metrics/histogram_macros.h"
+#include "base/timer/elapsed_timer.h"
#include "content/public/child/v8_value_converter.h"
#include "extensions/renderer/request_sender.h"
#include "extensions/renderer/script_context.h"
@@ -30,6 +32,7 @@ SendRequestNatives::SendRequestNatives(RequestSender* request_sender,
// callback will be dispatched to EventBindings::HandleResponse.
void SendRequestNatives::StartRequest(
const v8::FunctionCallbackInfo<v8::Value>& args) {
+ base::ElapsedTimer timer;
CHECK_EQ(5, args.Length());
std::string name = *v8::String::Utf8Value(args[0]);
bool has_callback = args[2]->BooleanValue();
@@ -55,13 +58,18 @@ void SendRequestNatives::StartRequest(
return;
}
- request_sender_->StartRequest(
- context(),
- name,
- request_id,
- has_callback,
- for_io_thread,
- static_cast<base::ListValue*>(value_args.get()));
+ if (request_sender_->StartRequest(
+ context(),
+ name,
+ request_id,
+ has_callback,
+ for_io_thread,
+ static_cast<base::ListValue*>(value_args.get()))) {
+ // TODO(devlin): Would it be useful to partition this data based on
+ // extension function once we have a suitable baseline? crbug.com/608561.
+ UMA_HISTOGRAM_TIMES("Extensions.Functions.StartRequestElapsedTime",
+ timer.Elapsed());
+ }
}
void SendRequestNatives::GetGlobal(
« no previous file with comments | « extensions/renderer/request_sender.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698