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

Unified Diff: chrome/browser/ui/cocoa/tabs/tab_window_controller.mm

Issue 2773973002: Add Startup.BrowserView.FirstPaint / .CompositingEnded histograms. (Closed)
Patch Set: WasNonBrowserUIDisplayed --> WasMainWindowStartupInterrupted, combine the tests, report trace with … Created 3 years, 8 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
Index: chrome/browser/ui/cocoa/tabs/tab_window_controller.mm
diff --git a/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm
index 716cb70c975cf3dc0740bb3958365f211f1b17d3..b81b80f40565f32ff0be9e093de162652b86bcf0 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm
+++ b/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm
@@ -6,6 +6,8 @@
#include "base/logging.h"
#import "base/mac/sdk_forward_declarations.h"
+#include "base/memory/ptr_util.h"
+#include "chrome/browser/ui/browser_view_histogram_helper.h"
#import "chrome/browser/ui/cocoa/browser_window_layout.h"
#import "chrome/browser/ui/cocoa/fast_resize_view.h"
#import "chrome/browser/ui/cocoa/framed_browser_window.h"
@@ -64,13 +66,23 @@
@end
// Subview of the window's contentView, contains everything but the tab strip.
-@interface ChromeContentView : NSView
+@interface ChromeContentView : NSView {
+ @private
+ std::unique_ptr<BrowserViewHistogramHelper> histogram_helper_;
tapted 2017/04/07 00:49:34 histogramHelper_ (since this is declared between
themblsha 2017/04/10 17:28:18 I'm using unique_ptr in browser_view.h so I can fo
+}
@end
@implementation ChromeContentView
// NSView overrides.
+- (instancetype)initWithFrame:(NSRect)frameRect {
+ if ((self = [super initWithFrame:frameRect])) {
+ histogram_helper_ = base::MakeUnique<BrowserViewHistogramHelper>();
+ }
+ return self;
+}
+
// Since Auto Layout and frame-based layout behave differently in small but
// important ways (e.g. Auto Layout can restrict window resizing, frame-based
// layout doesn't log a warning when a view's autoresizing mask can't be
@@ -79,6 +91,13 @@
return YES;
}
+- (void)drawRect:(NSRect)dirtyRect {
+ // -drawRect: is called from -drawLayer:inContext:, which is called before all
+ // ChromeContentView's got a chance to paint. But there seems to be no
+ // non-hacky way of getting that notification.
tapted 2017/04/07 00:49:34 Does void BrowserWindowCocoa::Show() already recor
themblsha 2017/04/10 17:28:18 Thanks for the tip! Moved the code there. The Bro
+ histogram_helper_->OnDidPaintChildren(nullptr);
+}
+
@end
@implementation TabWindowController

Powered by Google App Engine
This is Rietveld 408576698