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

Side by Side Diff: third_party/WebKit/Source/modules/webusb/NavigatorUSB.cpp

Issue 1846913009: HeapSupplements are now just Supplements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "modules/webusb/NavigatorUSB.h" 5 #include "modules/webusb/NavigatorUSB.h"
6 6
7 #include "core/frame/Navigator.h" 7 #include "core/frame/Navigator.h"
8 #include "modules/webusb/USB.h" 8 #include "modules/webusb/USB.h"
9 9
10 namespace blink { 10 namespace blink {
11 11
12 NavigatorUSB& NavigatorUSB::from(Navigator& navigator) 12 NavigatorUSB& NavigatorUSB::from(Navigator& navigator)
13 { 13 {
14 NavigatorUSB* supplement = static_cast<NavigatorUSB*>(HeapSupplement<Navigat or>::from(navigator, supplementName())); 14 NavigatorUSB* supplement = static_cast<NavigatorUSB*>(Supplement<Navigator>: :from(navigator, supplementName()));
15 if (!supplement) { 15 if (!supplement) {
16 supplement = new NavigatorUSB(navigator); 16 supplement = new NavigatorUSB(navigator);
17 provideTo(navigator, supplementName(), supplement); 17 provideTo(navigator, supplementName(), supplement);
18 } 18 }
19 return *supplement; 19 return *supplement;
20 } 20 }
21 21
22 USB* NavigatorUSB::usb(Navigator& navigator) 22 USB* NavigatorUSB::usb(Navigator& navigator)
23 { 23 {
24 return NavigatorUSB::from(navigator).usb(); 24 return NavigatorUSB::from(navigator).usb();
25 } 25 }
26 26
27 USB* NavigatorUSB::usb() 27 USB* NavigatorUSB::usb()
28 { 28 {
29 return m_usb; 29 return m_usb;
30 } 30 }
31 31
32 DEFINE_TRACE(NavigatorUSB) 32 DEFINE_TRACE(NavigatorUSB)
33 { 33 {
34 visitor->trace(m_usb); 34 visitor->trace(m_usb);
35 HeapSupplement<Navigator>::trace(visitor); 35 Supplement<Navigator>::trace(visitor);
36 } 36 }
37 37
38 NavigatorUSB::NavigatorUSB(Navigator& navigator) 38 NavigatorUSB::NavigatorUSB(Navigator& navigator)
39 { 39 {
40 if (navigator.frame()) 40 if (navigator.frame())
41 m_usb = USB::create(*navigator.frame()); 41 m_usb = USB::create(*navigator.frame());
42 } 42 }
43 43
44 const char* NavigatorUSB::supplementName() 44 const char* NavigatorUSB::supplementName()
45 { 45 {
46 return "NavigatorUSB"; 46 return "NavigatorUSB";
47 } 47 }
48 48
49 } // namespace blink 49 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webusb/NavigatorUSB.h ('k') | third_party/WebKit/Source/modules/webusb/USBController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698