diff options
author | rdevlin.cronin <rdevlin.cronin@chromium.org> | 2016-02-17 12:48:29 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-17 20:49:31 +0000 |
commit | 731d1b482499dbea3752ae464f5cc612103c27b1 (patch) | |
tree | 77cb122076c014535f0a66461a8515ef8036afa3 /extensions/browser | |
parent | 9146a0bb0109a907c7d61ee3b19642c57bbcbf87 (diff) | |
download | chromium_src-731d1b482499dbea3752ae464f5cc612103c27b1.zip chromium_src-731d1b482499dbea3752ae464f5cc612103c27b1.tar.gz chromium_src-731d1b482499dbea3752ae464f5cc612103c27b1.tar.bz2 |
[Extensions] Add UMA for whether the ExtensionApiFrameIdMap cache is hit
The ExtensionApiFrameIdMap is used to determine information about a frame on the
IO thread, and can make a jump to the UI thread in cases when information is not
cached. This jump can be expensive, and determining how often it happens can
influence future decisions about whether to use it or not. Add UMA to get some
knowledge.
BUG=None
Review URL: https://codereview.chromium.org/1697753002
Cr-Commit-Position: refs/heads/master@{#375975}
Diffstat (limited to 'extensions/browser')
-rw-r--r-- | extensions/browser/extension_api_frame_id_map.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/extensions/browser/extension_api_frame_id_map.cc b/extensions/browser/extension_api_frame_id_map.cc index b7ae5ea..5ce80d2 100644 --- a/extensions/browser/extension_api_frame_id_map.cc +++ b/extensions/browser/extension_api_frame_id_map.cc @@ -6,6 +6,7 @@ #include <tuple> +#include "base/metrics/histogram_macros.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/navigation_handle.h" #include "content/public/browser/render_frame_host.h" @@ -261,14 +262,18 @@ bool ExtensionApiFrameIdMap::GetCachedFrameDataOnIO(int render_process_id, base::AutoLock lock(frame_data_map_lock_); FrameDataMap::const_iterator frame_id_iter = frame_data_map_.find( RenderFrameIdKey(render_process_id, frame_routing_id)); + bool found = false; if (frame_id_iter != frame_data_map_.end()) { // This is very likely to happen because CacheFrameId() is called as soon // as the frame is created. *frame_data_out = frame_id_iter->second; - return true; + found = true; } - return false; + // TODO(devlin): Depending on how the data looks, this may be removable after + // a few cycles. Check back in M52 to see if it's still needed. + UMA_HISTOGRAM_BOOLEAN("Extensions.ExtensionFrameMapCacheHit", found); + return found; } void ExtensionApiFrameIdMap::CacheFrameData(content::RenderFrameHost* rfh) { |