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

Side by Side Diff: Source/modules/presentation/NavigatorPresentation.cpp

Issue 1101263003: Oilpan: have Navigator and its supplements be on the heap by default. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Make NavigatorBeacon a frame observer instead Created 5 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 unified diff | Download patch | Annotate | Revision Log
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 #include "config.h" 5 #include "config.h"
6 #include "modules/presentation/NavigatorPresentation.h" 6 #include "modules/presentation/NavigatorPresentation.h"
7 7
8 #include "core/frame/Navigator.h" 8 #include "core/frame/Navigator.h"
9 #include "modules/presentation/Presentation.h" 9 #include "modules/presentation/Presentation.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 NavigatorPresentation::NavigatorPresentation() 13 NavigatorPresentation::NavigatorPresentation()
14 { 14 {
15 } 15 }
16 16
17 NavigatorPresentation::~NavigatorPresentation()
18 {
19 }
20
21 // static 17 // static
22 const char* NavigatorPresentation::supplementName() 18 const char* NavigatorPresentation::supplementName()
23 { 19 {
24 return "NavigatorPresentation"; 20 return "NavigatorPresentation";
25 } 21 }
26 22
27 // static 23 // static
28 NavigatorPresentation& NavigatorPresentation::from(Navigator& navigator) 24 NavigatorPresentation& NavigatorPresentation::from(Navigator& navigator)
29 { 25 {
30 NavigatorPresentation* supplement = static_cast<NavigatorPresentation*>(Will BeHeapSupplement<Navigator>::from(navigator, supplementName())); 26 NavigatorPresentation* supplement = static_cast<NavigatorPresentation*>(Heap Supplement<Navigator>::from(navigator, supplementName()));
31 if (!supplement) { 27 if (!supplement) {
32 supplement = new NavigatorPresentation(); 28 supplement = new NavigatorPresentation();
33 provideTo(navigator, supplementName(), adoptPtrWillBeNoop(supplement)); 29 provideTo(navigator, supplementName(), supplement);
34 } 30 }
35 return *supplement; 31 return *supplement;
36 } 32 }
37 33
38 // static 34 // static
39 Presentation* NavigatorPresentation::presentation(Navigator& navigator) 35 Presentation* NavigatorPresentation::presentation(Navigator& navigator)
40 { 36 {
41 NavigatorPresentation& self = NavigatorPresentation::from(navigator); 37 NavigatorPresentation& self = NavigatorPresentation::from(navigator);
42 if (!self.m_presentation) { 38 if (!self.m_presentation) {
43 if (!navigator.frame()) 39 if (!navigator.frame())
44 return nullptr; 40 return nullptr;
45 self.m_presentation = Presentation::create(navigator.frame()); 41 self.m_presentation = Presentation::create(navigator.frame());
46 } 42 }
47 return self.m_presentation.get(); 43 return self.m_presentation;
48 } 44 }
49 45
50 DEFINE_TRACE(NavigatorPresentation) 46 DEFINE_TRACE(NavigatorPresentation)
51 { 47 {
52 visitor->trace(m_presentation); 48 visitor->trace(m_presentation);
53 WillBeHeapSupplement<Navigator>::trace(visitor); 49 HeapSupplement<Navigator>::trace(visitor);
54 } 50 }
55 51
56 } // namespace blink 52 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698