Chromium Code Reviews| Index: ios/chrome/browser/ui/browser_view_controller.mm |
| diff --git a/ios/chrome/browser/ui/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view_controller.mm |
| index 1271cea016bb063baa8cc2dd4162d3f0fff7faca..a3d5756082c305ef847245154fee83e90610ba7d 100644 |
| --- a/ios/chrome/browser/ui/browser_view_controller.mm |
| +++ b/ios/chrome/browser/ui/browser_view_controller.mm |
| @@ -572,6 +572,10 @@ NSString* const kNativeControllerTemporaryKey = @"NativeControllerTemporaryKey"; |
| // the user from interacting with the browser view. |
| @property(nonatomic, strong) |
| ActivityOverlayCoordinator* activityOverlayCoordinator; |
| +// A block to be run when the |tabWasAdded:| method completes the animation |
| +// for the presentation of a new tab. Can be used to record performance metrics. |
| +@property(nonatomic, strong, nullable) |
| + ProceduralBlock tabWasAddedCompletionBlock; |
| // The user agent type used to load the currently visible page. User agent type |
| // is NONE if there is no visible page or visible page is a native page. |
| @@ -932,6 +936,7 @@ class BrowserBookmarkModelBridge : public bookmarks::BookmarkModelObserver { |
| @synthesize hideStatusBar = _hideStatusBar; |
| @synthesize activityOverlayCoordinator = _activityOverlayCoordinator; |
| @synthesize presenting = _presenting; |
| +@synthesize tabWasAddedCompletionBlock = _tabWasAddedCompletionBlock; |
| #pragma mark - Object lifecycle |
| @@ -1198,6 +1203,21 @@ class BrowserBookmarkModelBridge : public bookmarks::BookmarkModelObserver { |
| } |
| - (void)newTab:(id)sender { |
| + // Observe the timing of the new tab creation, both MainController |
| + // and BrowserViewController call into this method on the correct BVC to |
| + // create new tabs making it preferable to doing this in |
| + // |chromeExecuteCommand:|. |
| + NSTimeInterval startTime = [NSDate timeIntervalSinceReferenceDate]; |
| + __weak __typeof(self) weakSelf = self; |
|
rohitrao (ping after 24h)
2017/05/22 12:55:05
Could we capture the value of isOffTheRecord inste
PL
2017/05/23 22:37:55
Absolutely! Done!
|
| + self.tabWasAddedCompletionBlock = ^{ |
| + UMA_HISTOGRAM_TIMES( |
| + weakSelf.isOffTheRecord |
| + ? "Toolbar.Menu.NewIncognitoTabPresentationDuration" |
| + : "Toolbar.Menu.NewTabPresentationDuration", |
|
Ilya Sherman
2017/05/22 20:45:45
Names passed to UMA_HISTOGRAM macros must be runti
PL
2017/05/23 22:37:55
Ah thanks! I've broken these out into two separate
|
| + base::TimeDelta::FromSecondsD([NSDate timeIntervalSinceReferenceDate] - |
| + startTime)); |
| + }; |
| + |
| [self setLastTapPoint:sender]; |
| DCHECK(self.visible || self.dismissingModal); |
| Tab* currentTab = [_model currentTab]; |
| @@ -1625,6 +1645,11 @@ class BrowserBookmarkModelBridge : public bookmarks::BookmarkModelObserver { |
| [self tabSelected:currentTab]; |
| } |
| startVoiceSearchIfNecessaryBlock(); |
| + |
| + if (self.tabWasAddedCompletionBlock) { |
| + self.tabWasAddedCompletionBlock(); |
| + self.tabWasAddedCompletionBlock = nil; |
| + } |
| }); |
| } else { |
| // -updateSnapshotWithOverlay will force a screen redraw, so take the |