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

Side by Side Diff: Source/modules/netinfo/NavigatorNetworkInformation.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: rebased 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/netinfo/NavigatorNetworkInformation.h" 6 #include "modules/netinfo/NavigatorNetworkInformation.h"
7 7
8 #include "core/frame/LocalDOMWindow.h" 8 #include "core/frame/LocalDOMWindow.h"
9 #include "core/frame/LocalFrame.h" 9 #include "core/frame/LocalFrame.h"
10 #include "core/frame/Navigator.h" 10 #include "core/frame/Navigator.h"
11 #include "modules/netinfo/NetworkInformation.h" 11 #include "modules/netinfo/NetworkInformation.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 NavigatorNetworkInformation::NavigatorNetworkInformation(Navigator& navigator) 15 NavigatorNetworkInformation::NavigatorNetworkInformation(Navigator& navigator)
16 : DOMWindowProperty(navigator.frame()) 16 : DOMWindowProperty(navigator.frame())
17 { 17 {
18 } 18 }
19 19
20 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(NavigatorNetworkInformation); 20 NavigatorNetworkInformation::~NavigatorNetworkInformation()
21 {
22 }
21 23
22 NavigatorNetworkInformation& NavigatorNetworkInformation::from(Navigator& naviga tor) 24 NavigatorNetworkInformation& NavigatorNetworkInformation::from(Navigator& naviga tor)
23 { 25 {
24 NavigatorNetworkInformation* supplement = toNavigatorNetworkInformation(navi gator); 26 NavigatorNetworkInformation* supplement = toNavigatorNetworkInformation(navi gator);
25 if (!supplement) { 27 if (!supplement) {
26 supplement = new NavigatorNetworkInformation(navigator); 28 supplement = new NavigatorNetworkInformation(navigator);
27 provideTo(navigator, supplementName(), adoptPtrWillBeNoop(supplement)); 29 provideTo(navigator, supplementName(), supplement);
28 } 30 }
29 return *supplement; 31 return *supplement;
30 } 32 }
31 33
32 NavigatorNetworkInformation* NavigatorNetworkInformation::toNavigatorNetworkInfo rmation(Navigator& navigator) 34 NavigatorNetworkInformation* NavigatorNetworkInformation::toNavigatorNetworkInfo rmation(Navigator& navigator)
33 { 35 {
34 return static_cast<NavigatorNetworkInformation*>(WillBeHeapSupplement<Naviga tor>::from(navigator, supplementName())); 36 return static_cast<NavigatorNetworkInformation*>(HeapSupplement<Navigator>:: from(navigator, supplementName()));
35 } 37 }
36 38
37 const char* NavigatorNetworkInformation::supplementName() 39 const char* NavigatorNetworkInformation::supplementName()
38 { 40 {
39 return "NavigatorNetworkInformation"; 41 return "NavigatorNetworkInformation";
40 } 42 }
41 43
42 NetworkInformation* NavigatorNetworkInformation::connection(Navigator& navigator ) 44 NetworkInformation* NavigatorNetworkInformation::connection(Navigator& navigator )
43 { 45 {
44 return NavigatorNetworkInformation::from(navigator).connection(); 46 return NavigatorNetworkInformation::from(navigator).connection();
45 } 47 }
46 48
47 NetworkInformation* NavigatorNetworkInformation::connection() 49 NetworkInformation* NavigatorNetworkInformation::connection()
48 { 50 {
49 if (!m_connection && frame()) { 51 if (!m_connection && frame()) {
50 ASSERT(frame()->domWindow()); 52 ASSERT(frame()->domWindow());
51 m_connection = NetworkInformation::create(frame()->domWindow()->executio nContext()); 53 m_connection = NetworkInformation::create(frame()->domWindow()->executio nContext());
52 } 54 }
53 return m_connection.get(); 55 return m_connection.get();
54 } 56 }
55 57
56 DEFINE_TRACE(NavigatorNetworkInformation) 58 DEFINE_TRACE(NavigatorNetworkInformation)
57 { 59 {
58 visitor->trace(m_connection); 60 visitor->trace(m_connection);
59 WillBeHeapSupplement<Navigator>::trace(visitor); 61 HeapSupplement<Navigator>::trace(visitor);
60 DOMWindowProperty::trace(visitor); 62 DOMWindowProperty::trace(visitor);
61 } 63 }
62 64
63 } // namespace blink 65 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/netinfo/NavigatorNetworkInformation.h ('k') | Source/modules/permissions/NavigatorPermissions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698