Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.compositor.bottombar.contextualsearch; | 5 package org.chromium.chrome.browser.compositor.bottombar.contextualsearch; |
| 6 | 6 |
| 7 import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel.PanelState; | 7 import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel.PanelState; |
| 8 import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel.StateChange Reason; | 8 import org.chromium.chrome.browser.compositor.bottombar.OverlayPanel.StateChange Reason; |
| 9 import org.chromium.chrome.browser.contextualsearch.ContextualSearchUma; | 9 import org.chromium.chrome.browser.contextualsearch.ContextualSearchUma; |
| 10 | 10 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 181 assert mSearchViewStartTimeNs != 0; | 181 assert mSearchViewStartTimeNs != 0; |
| 182 long durationMs = (System.nanoTime() - mSearchViewStartTimeNs) / 100 0000; | 182 long durationMs = (System.nanoTime() - mSearchViewStartTimeNs) / 100 0000; |
| 183 logSearchPanelLoadDuration(wasPrefetch, durationMs); | 183 logSearchPanelLoadDuration(wasPrefetch, durationMs); |
| 184 } | 184 } |
| 185 | 185 |
| 186 // Not yet opened, wait till an open to log. | 186 // Not yet opened, wait till an open to log. |
| 187 mIsSearchPanelFullyPreloaded = true; | 187 mIsSearchPanelFullyPreloaded = true; |
| 188 } | 188 } |
| 189 | 189 |
| 190 /** | 190 /** |
| 191 * Called when a search term has been resolved. | |
| 192 * Currently this just logs time between initiating the search and resolving the search term | |
| 193 * into the uma metrics. | |
| 194 */ | |
| 195 public void onSearchTermResolved() { | |
| 196 long durationMs = (System.nanoTime() - mSearchViewStartTimeNs) / 1000000 ; | |
|
Theresa
2016/02/29 19:42:44
mSearchViewStartTimeNs is set in onSeachPanelFirst
Donn Denman
2016/03/01 21:18:07
Wow, that was a big mistake. Thanks for catching
| |
| 197 ContextualSearchUma.logSearchTermResolutionDuration(durationMs); | |
| 198 } | |
| 199 | |
| 200 /** | |
| 201 * Called when navigation to prefetched search results first become viewable in the panel. | |
| 202 * Currently this just logs time-till-navigated into the uma metrics. | |
|
Theresa
2016/02/29 19:42:44
I think the wording on this docstring and "time-ti
Donn Denman
2016/03/01 21:18:07
Done.
| |
| 203 */ | |
| 204 public void onPrefetchedSearchNavigated(boolean didResolve) { | |
| 205 long durationMs = (System.nanoTime() - mSearchViewStartTimeNs) / 1000000 ; | |
| 206 ContextualSearchUma.logPrefetchedSearchNavigatedDuration(durationMs, did Resolve); | |
| 207 } | |
| 208 | |
| 209 /** | |
| 191 * Records timing information when the search panel has been viewed for the first time. | 210 * Records timing information when the search panel has been viewed for the first time. |
| 192 */ | 211 */ |
| 193 private void onSearchPanelFirstView() { | 212 private void onSearchPanelFirstView() { |
| 194 if (mIsSearchPanelFullyPreloaded) { | 213 if (mIsSearchPanelFullyPreloaded) { |
| 195 // Already fully pre-loaded, record a wait of 0 milliseconds. | 214 // Already fully pre-loaded, record a wait of 0 milliseconds. |
| 196 logSearchPanelLoadDuration(true, 0); | 215 logSearchPanelLoadDuration(true, 0); |
| 197 } else { | 216 } else { |
| 198 // Start a loading timer. | 217 // Start a loading timer. |
| 199 mSearchViewStartTimeNs = System.nanoTime(); | 218 mSearchViewStartTimeNs = System.nanoTime(); |
| 200 } | 219 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 236 /** | 255 /** |
| 237 * Logs the duration the user waited for the search panel to fully load, onc e it was opened. | 256 * Logs the duration the user waited for the search panel to fully load, onc e it was opened. |
| 238 * @param wasPrefetch Whether the load included prefetch. | 257 * @param wasPrefetch Whether the load included prefetch. |
| 239 * @param durationMs The duration to log. | 258 * @param durationMs The duration to log. |
| 240 */ | 259 */ |
| 241 private void logSearchPanelLoadDuration(boolean wasPrefetch, long durationMs ) { | 260 private void logSearchPanelLoadDuration(boolean wasPrefetch, long durationMs ) { |
| 242 ContextualSearchUma.logSearchPanelLoadDuration(wasPrefetch, durationMs); | 261 ContextualSearchUma.logSearchPanelLoadDuration(wasPrefetch, durationMs); |
| 243 } | 262 } |
| 244 } | 263 } |
| 245 | 264 |
| OLD | NEW |