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

Side by Side Diff: ui/views/cocoa/bridged_native_widget.h

Issue 2863883002: Tracing for NSMenu timelines
Patch Set: big CL with more trace points Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « ui/base/cocoa/menu_controller_unittest.mm ('k') | ui/views/cocoa/bridged_native_widget.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_ 5 #ifndef UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_
6 #define UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_ 6 #define UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include <functional>
10 #include <memory> 11 #include <memory>
11 #include <vector> 12 #include <vector>
12 13
13 #import "base/mac/scoped_nsobject.h" 14 #import "base/mac/scoped_nsobject.h"
14 #include "base/macros.h" 15 #include "base/macros.h"
15 #import "ui/accelerated_widget_mac/accelerated_widget_mac.h" 16 #import "ui/accelerated_widget_mac/accelerated_widget_mac.h"
16 #include "ui/base/ime/input_method_delegate.h" 17 #include "ui/base/ime/input_method_delegate.h"
17 #include "ui/compositor/layer_owner.h" 18 #include "ui/compositor/layer_owner.h"
18 #import "ui/views/cocoa/bridged_native_widget_owner.h" 19 #import "ui/views/cocoa/bridged_native_widget_owner.h"
19 #import "ui/views/cocoa/cocoa_mouse_capture_delegate.h" 20 #import "ui/views/cocoa/cocoa_mouse_capture_delegate.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 178
178 // Creates a ui::Compositor which becomes responsible for drawing the window. 179 // Creates a ui::Compositor which becomes responsible for drawing the window.
179 void CreateLayer(ui::LayerType layer_type, bool translucent); 180 void CreateLayer(ui::LayerType layer_type, bool translucent);
180 181
181 // Updates |associated_views_| on NativeViewHost::Attach()/Detach(). 182 // Updates |associated_views_| on NativeViewHost::Attach()/Detach().
182 void SetAssociationForView(const views::View* view, NSView* native_view); 183 void SetAssociationForView(const views::View* view, NSView* native_view);
183 void ClearAssociationForView(const views::View* view); 184 void ClearAssociationForView(const views::View* view);
184 // Sorts child NSViews according to NativeViewHosts order in views hierarchy. 185 // Sorts child NSViews according to NativeViewHosts order in views hierarchy.
185 void ReorderChildViews(); 186 void ReorderChildViews();
186 187
188 // Schedules a draw then blocks the UI thread until the UI Compositor swaps in
189 // a new frame or a timeout occurs.
190 void PumpCompositor();
191
187 NativeWidgetMac* native_widget_mac() { return native_widget_mac_; } 192 NativeWidgetMac* native_widget_mac() { return native_widget_mac_; }
188 BridgedContentView* ns_view() { return bridged_view_; } 193 BridgedContentView* ns_view() { return bridged_view_; }
189 NSWindow* ns_window() { return window_; } 194 NSWindow* ns_window() { return window_; }
190 195
191 TooltipManager* tooltip_manager() { return tooltip_manager_.get(); } 196 TooltipManager* tooltip_manager() { return tooltip_manager_.get(); }
192 197
193 DragDropClientMac* drag_drop_client() { return drag_drop_client_.get(); } 198 DragDropClientMac* drag_drop_client() { return drag_drop_client_.get(); }
194 199
195 // The parent widget specified in Widget::InitParams::parent. If non-null, the 200 // The parent widget specified in Widget::InitParams::parent. If non-null, the
196 // parent will close children before the parent closes, and children will be 201 // parent will close children before the parent closes, and children will be
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 233
229 // Installs the NSView for hosting the composited layer. It is later provided 234 // Installs the NSView for hosting the composited layer. It is later provided
230 // to |compositor_widget_| via AcceleratedWidgetGetNSView(). 235 // to |compositor_widget_| via AcceleratedWidgetGetNSView().
231 void AddCompositorSuperview(); 236 void AddCompositorSuperview();
232 237
233 // Size the layer to match the client area bounds, taking into account display 238 // Size the layer to match the client area bounds, taking into account display
234 // scale factor. 239 // scale factor.
235 void UpdateLayerProperties(); 240 void UpdateLayerProperties();
236 241
237 // Immediately return if there is a composited frame matching |size_in_dip|. 242 // Immediately return if there is a composited frame matching |size_in_dip|.
238 // Otherwise, asks ui::WindowResizeHelperMac to run tasks until a matching 243 // Otherwise, calls WaitForFrame() to obtain one.
239 // frame is ready, or a timeout occurs.
240 void MaybeWaitForFrame(const gfx::Size& size_in_dip); 244 void MaybeWaitForFrame(const gfx::Size& size_in_dip);
241 245
246 // Asks ui::WindowResizeHelperMac to run tasks until |predicate| returns true
247 // or |timeout_ms| passes.
248 void WaitForFrame(int timeout_ms, std::function<bool()> predicate);
249
242 // Show the window using -[NSApp beginSheet:..], modal for the parent window. 250 // Show the window using -[NSApp beginSheet:..], modal for the parent window.
243 void ShowAsModalSheet(); 251 void ShowAsModalSheet();
244 252
245 // Sets mouseDownCanMoveWindow on |bridged_view_| and triggers the NSWindow to 253 // Sets mouseDownCanMoveWindow on |bridged_view_| and triggers the NSWindow to
246 // update its draggable region. 254 // update its draggable region.
247 void SetDraggable(bool draggable); 255 void SetDraggable(bool draggable);
248 256
249 // Overridden from CocoaMouseCaptureDelegate: 257 // Overridden from CocoaMouseCaptureDelegate:
250 void PostCapturedEvent(NSEvent* event) override; 258 void PostCapturedEvent(NSEvent* event) override;
251 void OnMouseCaptureLost() override; 259 void OnMouseCaptureLost() override;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 328
321 // If true, the window has been made visible or changed shape and the window 329 // If true, the window has been made visible or changed shape and the window
322 // shadow needs to be invalidated when a frame is received for the new shape. 330 // shadow needs to be invalidated when a frame is received for the new shape.
323 bool invalidate_shadow_on_frame_swap_ = false; 331 bool invalidate_shadow_on_frame_swap_ = false;
324 332
325 // Whether the window's visibility is suppressed currently. For opaque non- 333 // Whether the window's visibility is suppressed currently. For opaque non-
326 // modal windows, the window's alpha value is set to 0, till the frame from 334 // modal windows, the window's alpha value is set to 0, till the frame from
327 // the compositor arrives to avoid "blinking". 335 // the compositor arrives to avoid "blinking".
328 bool initial_visibility_suppressed_ = false; 336 bool initial_visibility_suppressed_ = false;
329 337
338 // Set to true whenever a frame is swapped. Used to wait for a frame.
339 bool frame_swapped_ = false;
340
330 AssociatedViews associated_views_; 341 AssociatedViews associated_views_;
331 342
332 DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidget); 343 DISALLOW_COPY_AND_ASSIGN(BridgedNativeWidget);
333 }; 344 };
334 345
335 } // namespace views 346 } // namespace views
336 347
337 #endif // UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_ 348 #endif // UI_VIEWS_COCOA_BRIDGED_NATIVE_WIDGET_H_
OLDNEW
« no previous file with comments | « ui/base/cocoa/menu_controller_unittest.mm ('k') | ui/views/cocoa/bridged_native_widget.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698