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

Side by Side Diff: Source/core/frame/FrameView.h

Issue 603193005: Move the Widget hierarchy to the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase upto and resolve r182737 conflict. Created 6 years, 2 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
OLDNEW
1 /* 1 /*
2 Copyright (C) 1997 Martin Jones (mjones@kde.org) 2 Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 (C) 1998 Waldo Bastian (bastian@kde.org) 3 (C) 1998 Waldo Bastian (bastian@kde.org)
4 (C) 1998, 1999 Torben Weis (weis@kde.org) 4 (C) 1998, 1999 Torben Weis (weis@kde.org)
5 (C) 1999 Lars Knoll (knoll@kde.org) 5 (C) 1999 Lars Knoll (knoll@kde.org)
6 (C) 1999 Antti Koivisto (koivisto@kde.org) 6 (C) 1999 Antti Koivisto (koivisto@kde.org)
7 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 7 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
8 8
9 This library is free software; you can redistribute it and/or 9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Library General Public 10 modify it under the terms of the GNU Library General Public
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 struct CompositedSelectionBound; 56 struct CompositedSelectionBound;
57 57
58 typedef unsigned long long DOMTimeStamp; 58 typedef unsigned long long DOMTimeStamp;
59 59
60 // FIXME: Oilpan: move Widget (and thereby FrameView) to the heap. 60 // FIXME: Oilpan: move Widget (and thereby FrameView) to the heap.
61 class FrameView FINAL : public ScrollView { 61 class FrameView FINAL : public ScrollView {
62 public: 62 public:
63 friend class RenderView; 63 friend class RenderView;
64 friend class Internals; 64 friend class Internals;
65 65
66 static PassRefPtr<FrameView> create(LocalFrame*); 66 static PassRefPtrWillBeRawPtr<FrameView> create(LocalFrame*);
67 static PassRefPtr<FrameView> create(LocalFrame*, const IntSize& initialSize) ; 67 static PassRefPtrWillBeRawPtr<FrameView> create(LocalFrame*, const IntSize& initialSize);
68 68
69 virtual ~FrameView(); 69 virtual ~FrameView();
70 70
71 virtual HostWindow* hostWindow() const OVERRIDE; 71 virtual HostWindow* hostWindow() const OVERRIDE;
72 72
73 virtual void invalidateRect(const IntRect&) OVERRIDE; 73 virtual void invalidateRect(const IntRect&) OVERRIDE;
74 virtual void setFrameRect(const IntRect&) OVERRIDE; 74 virtual void setFrameRect(const IntRect&) OVERRIDE;
75 75
76 LocalFrame& frame() const 76 LocalFrame& frame() const
77 { 77 {
78 ASSERT(m_frame); 78 ASSERT(m_frame);
79 return *m_frame; 79 return *m_frame;
80 } 80 }
81 81
82 Page* page() const; 82 Page* page() const;
83 83
84 RenderView* renderView() const; 84 RenderView* renderView() const;
85 85
86 virtual void setCanHaveScrollbars(bool) OVERRIDE; 86 virtual void setCanHaveScrollbars(bool) OVERRIDE;
87 87
88 virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation) OVERRIDE ; 88 virtual PassRefPtrWillBeRawPtr<Scrollbar> createScrollbar(ScrollbarOrientati on) OVERRIDE;
89 89
90 virtual void setContentsSize(const IntSize&) OVERRIDE; 90 virtual void setContentsSize(const IntSize&) OVERRIDE;
91 IntPoint clampOffsetAtScale(const IntPoint& offset, float scale) const; 91 IntPoint clampOffsetAtScale(const IntPoint& offset, float scale) const;
92 92
93 void layout(bool allowSubtree = true); 93 void layout(bool allowSubtree = true);
94 bool didFirstLayout() const; 94 bool didFirstLayout() const;
95 void scheduleRelayout(); 95 void scheduleRelayout();
96 void scheduleRelayoutOfSubtree(RenderObject*); 96 void scheduleRelayoutOfSubtree(RenderObject*);
97 bool layoutPending() const; 97 bool layoutPending() const;
98 bool isInPerformLayout() const; 98 bool isInPerformLayout() const;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 218
219 void updateLayoutAndStyleForPainting(); 219 void updateLayoutAndStyleForPainting();
220 void updateLayoutAndStyleIfNeededRecursive(); 220 void updateLayoutAndStyleIfNeededRecursive();
221 221
222 void invalidateTreeIfNeededRecursive(); 222 void invalidateTreeIfNeededRecursive();
223 223
224 void incrementVisuallyNonEmptyCharacterCount(unsigned); 224 void incrementVisuallyNonEmptyCharacterCount(unsigned);
225 void incrementVisuallyNonEmptyPixelCount(const IntSize&); 225 void incrementVisuallyNonEmptyPixelCount(const IntSize&);
226 void setIsVisuallyNonEmpty() { m_isVisuallyNonEmpty = true; } 226 void setIsVisuallyNonEmpty() { m_isVisuallyNonEmpty = true; }
227 void enableAutoSizeMode(const IntSize& minSize, const IntSize& maxSize); 227 void enableAutoSizeMode(const IntSize& minSize, const IntSize& maxSize);
228 void disableAutoSizeMode() { m_autoSizeInfo.clear(); } 228 void disableAutoSizeMode() { disposeAutoSizeInfo(); }
229 229
230 void forceLayout(bool allowSubtree = false); 230 void forceLayout(bool allowSubtree = false);
231 void forceLayoutForPagination(const FloatSize& pageSize, const FloatSize& or iginalPageSize, float maximumShrinkFactor); 231 void forceLayoutForPagination(const FloatSize& pageSize, const FloatSize& or iginalPageSize, float maximumShrinkFactor);
232 232
233 bool scrollToFragment(const KURL&); 233 bool scrollToFragment(const KURL&);
234 bool scrollToAnchor(const String&); 234 bool scrollToAnchor(const String&);
235 void maintainScrollPositionAtAnchor(Node*); 235 void maintainScrollPositionAtAnchor(Node*);
236 void scrollElementToRect(Element*, const IntRect&); 236 void scrollElementToRect(Element*, const IntRect&);
237 void scrollContentsIfNeededRecursive(); 237 void scrollContentsIfNeededRecursive();
238 238
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 virtual void getTickmarks(Vector<IntRect>&) const OVERRIDE; 325 virtual void getTickmarks(Vector<IntRect>&) const OVERRIDE;
326 virtual void scrollTo(const IntSize&) OVERRIDE; 326 virtual void scrollTo(const IntSize&) OVERRIDE;
327 virtual IntRect scrollableAreaBoundingBox() const OVERRIDE; 327 virtual IntRect scrollableAreaBoundingBox() const OVERRIDE;
328 virtual bool scrollAnimatorEnabled() const OVERRIDE; 328 virtual bool scrollAnimatorEnabled() const OVERRIDE;
329 virtual bool usesCompositedScrolling() const OVERRIDE; 329 virtual bool usesCompositedScrolling() const OVERRIDE;
330 virtual GraphicsLayer* layerForScrolling() const OVERRIDE; 330 virtual GraphicsLayer* layerForScrolling() const OVERRIDE;
331 virtual GraphicsLayer* layerForHorizontalScrollbar() const OVERRIDE; 331 virtual GraphicsLayer* layerForHorizontalScrollbar() const OVERRIDE;
332 virtual GraphicsLayer* layerForVerticalScrollbar() const OVERRIDE; 332 virtual GraphicsLayer* layerForVerticalScrollbar() const OVERRIDE;
333 virtual GraphicsLayer* layerForScrollCorner() const OVERRIDE; 333 virtual GraphicsLayer* layerForScrollCorner() const OVERRIDE;
334 334
335 virtual void trace(Visitor*) OVERRIDE;
336 void dispose();
337
335 protected: 338 protected:
336 virtual bool scrollContentsFastPath(const IntSize& scrollDelta) OVERRIDE; 339 virtual bool scrollContentsFastPath(const IntSize& scrollDelta) OVERRIDE;
337 virtual void scrollContentsSlowPath(const IntRect& updateRect) OVERRIDE; 340 virtual void scrollContentsSlowPath(const IntRect& updateRect) OVERRIDE;
338 341
339 virtual bool isVerticalDocument() const OVERRIDE; 342 virtual bool isVerticalDocument() const OVERRIDE;
340 virtual bool isFlippedDocument() const OVERRIDE; 343 virtual bool isFlippedDocument() const OVERRIDE;
341 344
342 // Prevents creation of scrollbars. Used to prevent drawing two sets of 345 // Prevents creation of scrollbars. Used to prevent drawing two sets of
343 // overlay scrollbars in the case of the pinch viewport. 346 // overlay scrollbars in the case of the pinch viewport.
344 virtual bool scrollbarsDisabled() const OVERRIDE; 347 virtual bool scrollbarsDisabled() const OVERRIDE;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 413
411 virtual void updateScrollCorner() OVERRIDE; 414 virtual void updateScrollCorner() OVERRIDE;
412 415
413 FrameView* parentFrameView() const; 416 FrameView* parentFrameView() const;
414 417
415 AXObjectCache* axObjectCache() const; 418 AXObjectCache* axObjectCache() const;
416 void removeFromAXObjectCache(); 419 void removeFromAXObjectCache();
417 420
418 void setLayoutSizeInternal(const IntSize&); 421 void setLayoutSizeInternal(const IntSize&);
419 422
423 void disposeAutoSizeInfo();
424
420 bool paintInvalidationIsAllowed() const 425 bool paintInvalidationIsAllowed() const
421 { 426 {
422 return !isInPerformLayout() || canInvalidatePaintDuringPerformLayout(); 427 return !isInPerformLayout() || canInvalidatePaintDuringPerformLayout();
423 } 428 }
424 429
425 static double s_currentFrameTimeStamp; // used for detecting decoded resourc e thrash in the cache 430 static double s_currentFrameTimeStamp; // used for detecting decoded resourc e thrash in the cache
426 static bool s_inPaintContents; 431 static bool s_inPaintContents;
427 432
428 LayoutSize m_size; 433 LayoutSize m_size;
429 434
430 typedef WillBeHeapHashSet<RefPtrWillBeMember<RenderEmbeddedObject> > Embedde dObjectSet; 435 typedef WillBeHeapHashSet<RefPtrWillBeMember<RenderEmbeddedObject> > Embedde dObjectSet;
431 WillBePersistentHeapHashSet<RefPtrWillBeMember<RenderEmbeddedObject> > m_wid getUpdateSet; 436 WillBeHeapHashSet<RefPtrWillBeMember<RenderEmbeddedObject> > m_widgetUpdateS et;
432 437
433 // FIXME: These are just "children" of the FrameView and should be RefPtr<Wi dget> instead. 438 // FIXME: These are just "children" of the FrameView and should be RefPtr<Wi dget> instead.
434 WillBePersistentHeapHashSet<RefPtrWillBeMember<RenderWidget> > m_widgets; 439 WillBeHeapHashSet<RefPtrWillBeMember<RenderWidget> > m_widgets;
435 440
436 // Oilpan: the use of a persistent back reference 'emulates' the 441 // The RefPtr cycle between LocalFrame and FrameView is broken
437 // RefPtr-cycle that is kept between the two objects non-Oilpan. 442 // when a LocalFrame is detached by FrameLoader::detachFromParent(),
438 // 443 // it then clears its FrameView's m_frame reference by calling
439 // That cycle is broken when a LocalFrame is detached by 444 // setView(nullptr).
440 // FrameLoader::detachFromParent(), it then clears its 445 RefPtrWillBeMember<LocalFrame> m_frame;
441 // FrameView's m_frame reference by calling setView(nullptr).
442 RefPtrWillBePersistent<LocalFrame> m_frame;
443 446
444 bool m_doFullPaintInvalidation; 447 bool m_doFullPaintInvalidation;
445 448
446 bool m_canHaveScrollbars; 449 bool m_canHaveScrollbars;
447 unsigned m_slowRepaintObjectCount; 450 unsigned m_slowRepaintObjectCount;
448 451
449 bool m_hasPendingLayout; 452 bool m_hasPendingLayout;
450 RenderObject* m_layoutSubtreeRoot; 453 RenderObject* m_layoutSubtreeRoot;
451 454
452 bool m_layoutSchedulingEnabled; 455 bool m_layoutSchedulingEnabled;
(...skipping 22 matching lines...) Expand all
475 478
476 bool m_wasScrolledByUser; 479 bool m_wasScrolledByUser;
477 bool m_inProgrammaticScroll; 480 bool m_inProgrammaticScroll;
478 bool m_safeToPropagateScrollToParent; 481 bool m_safeToPropagateScrollToParent;
479 482
480 double m_lastPaintTime; 483 double m_lastPaintTime;
481 484
482 bool m_isTrackingPaintInvalidations; // Used for testing. 485 bool m_isTrackingPaintInvalidations; // Used for testing.
483 Vector<IntRect> m_trackedPaintInvalidationRects; 486 Vector<IntRect> m_trackedPaintInvalidationRects;
484 487
485 RefPtrWillBePersistent<Node> m_nodeToDraw; 488 RefPtrWillBeMember<Node> m_nodeToDraw;
486 PaintBehavior m_paintBehavior; 489 PaintBehavior m_paintBehavior;
487 bool m_isPainting; 490 bool m_isPainting;
488 491
489 unsigned m_visuallyNonEmptyCharacterCount; 492 unsigned m_visuallyNonEmptyCharacterCount;
490 unsigned m_visuallyNonEmptyPixelCount; 493 unsigned m_visuallyNonEmptyPixelCount;
491 bool m_isVisuallyNonEmpty; 494 bool m_isVisuallyNonEmpty;
492 bool m_firstVisuallyNonEmptyLayoutCallbackPending; 495 bool m_firstVisuallyNonEmptyLayoutCallbackPending;
493 496
494 RefPtrWillBePersistent<Node> m_maintainScrollPositionAnchor; 497 RefPtrWillBeMember<Node> m_maintainScrollPositionAnchor;
495 498
496 // Renderer to hold our custom scroll corner. 499 // Renderer to hold our custom scroll corner.
497 RawPtrWillBePersistent<RenderScrollbarPart> m_scrollCorner; 500 RawPtrWillBeMember<RenderScrollbarPart> m_scrollCorner;
498 501
499 OwnPtr<ScrollableAreaSet> m_scrollableAreas; 502 OwnPtr<ScrollableAreaSet> m_scrollableAreas;
500 OwnPtr<ResizerAreaSet> m_resizerAreas; 503 OwnPtr<ResizerAreaSet> m_resizerAreas;
501 OwnPtr<ViewportConstrainedObjectSet> m_viewportConstrainedObjects; 504 OwnPtr<ViewportConstrainedObjectSet> m_viewportConstrainedObjects;
502 OwnPtr<FrameViewAutoSizeInfo> m_autoSizeInfo; 505 OwnPtrWillBeMember<FrameViewAutoSizeInfo> m_autoSizeInfo;
503 506
504 float m_visibleContentScaleFactor; 507 float m_visibleContentScaleFactor;
505 IntSize m_inputEventsOffsetForEmulation; 508 IntSize m_inputEventsOffsetForEmulation;
506 float m_inputEventsScaleFactorForEmulation; 509 float m_inputEventsScaleFactorForEmulation;
507 510
508 IntSize m_layoutSize; 511 IntSize m_layoutSize;
509 bool m_layoutSizeFixedToFrameSize; 512 bool m_layoutSizeFixedToFrameSize;
510 513
511 Timer<FrameView> m_didScrollTimer; 514 Timer<FrameView> m_didScrollTimer;
512 515
(...skipping 22 matching lines...) Expand all
535 m_visuallyNonEmptyPixelCount += size.width() * size.height(); 538 m_visuallyNonEmptyPixelCount += size.width() * size.height();
536 // Use a threshold value to prevent very small amounts of visible content fr om triggering didFirstVisuallyNonEmptyLayout 539 // Use a threshold value to prevent very small amounts of visible content fr om triggering didFirstVisuallyNonEmptyLayout
537 static const unsigned visualPixelThreshold = 32 * 32; 540 static const unsigned visualPixelThreshold = 32 * 32;
538 if (m_visuallyNonEmptyPixelCount > visualPixelThreshold) 541 if (m_visuallyNonEmptyPixelCount > visualPixelThreshold)
539 setIsVisuallyNonEmpty(); 542 setIsVisuallyNonEmpty();
540 } 543 }
541 544
542 DEFINE_TYPE_CASTS(FrameView, Widget, widget, widget->isFrameView(), widget.isFra meView()); 545 DEFINE_TYPE_CASTS(FrameView, Widget, widget, widget->isFrameView(), widget.isFra meView());
543 546
544 class AllowPaintInvalidationScope { 547 class AllowPaintInvalidationScope {
548 STACK_ALLOCATED();
545 public: 549 public:
546 explicit AllowPaintInvalidationScope(FrameView* view) 550 explicit AllowPaintInvalidationScope(FrameView* view)
547 : m_view(view) 551 : m_view(view)
548 , m_originalValue(view ? view->canInvalidatePaintDuringPerformLayout() : false) 552 , m_originalValue(view ? view->canInvalidatePaintDuringPerformLayout() : false)
549 { 553 {
550 if (!m_view) 554 if (!m_view)
551 return; 555 return;
552 556
553 m_view->setCanInvalidatePaintDuringPerformLayout(true); 557 m_view->setCanInvalidatePaintDuringPerformLayout(true);
554 } 558 }
555 559
556 ~AllowPaintInvalidationScope() 560 ~AllowPaintInvalidationScope()
557 { 561 {
558 if (!m_view) 562 if (!m_view)
559 return; 563 return;
560 564
561 m_view->setCanInvalidatePaintDuringPerformLayout(m_originalValue); 565 m_view->setCanInvalidatePaintDuringPerformLayout(m_originalValue);
562 } 566 }
567
563 private: 568 private:
564 FrameView* m_view; 569 RawPtrWillBeMember<FrameView> m_view;
565 bool m_originalValue; 570 bool m_originalValue;
566 }; 571 };
567 572
568 } // namespace blink 573 } // namespace blink
569 574
570 #endif // FrameView_h 575 #endif // FrameView_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698