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

Side by Side Diff: Source/modules/notifications/WorkerGlobalScopeNotifications.cpp

Issue 178663004: Oilpan: move WorkerGlobalScope to oilpan's heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased Created 6 years, 9 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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved. 3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 18 matching lines...) Expand all
29 #include "modules/notifications/WorkerGlobalScopeNotifications.h" 29 #include "modules/notifications/WorkerGlobalScopeNotifications.h"
30 30
31 #if ENABLE(LEGACY_NOTIFICATIONS) 31 #if ENABLE(LEGACY_NOTIFICATIONS)
32 32
33 #include "core/workers/WorkerGlobalScope.h" 33 #include "core/workers/WorkerGlobalScope.h"
34 #include "core/workers/WorkerThread.h" 34 #include "core/workers/WorkerThread.h"
35 #include "modules/notifications/NotificationCenter.h" 35 #include "modules/notifications/NotificationCenter.h"
36 36
37 namespace WebCore { 37 namespace WebCore {
38 38
39 WorkerGlobalScopeNotifications::WorkerGlobalScopeNotifications(WorkerGlobalScope & context) 39 WorkerGlobalScopeNotifications::WorkerGlobalScopeNotifications(WorkerGlobalScope * context)
40 : m_context(context) 40 : m_context(context)
41 { 41 {
42 } 42 }
43 43
44 WorkerGlobalScopeNotifications::~WorkerGlobalScopeNotifications() 44 WorkerGlobalScopeNotifications::~WorkerGlobalScopeNotifications()
45 { 45 {
46 } 46 }
47 47
48 const char* WorkerGlobalScopeNotifications::supplementName() 48 const char* WorkerGlobalScopeNotifications::supplementName()
49 { 49 {
50 return "WorkerGlobalScopeNotifications"; 50 return "WorkerGlobalScopeNotifications";
51 } 51 }
52 52
53 WorkerGlobalScopeNotifications& WorkerGlobalScopeNotifications::from(WorkerGloba lScope& context) 53 WorkerGlobalScopeNotifications& WorkerGlobalScopeNotifications::from(WorkerGloba lScope& context)
54 { 54 {
55 WorkerGlobalScopeNotifications* supplement = static_cast<WorkerGlobalScopeNo tifications*>(WorkerSupplement::from(context, supplementName())); 55 WorkerGlobalScopeNotifications* supplement = static_cast<WorkerGlobalScopeNo tifications*>(WillBeHeapSupplement<WorkerGlobalScope>::from(context, supplementN ame()));
56 if (!supplement) { 56 if (!supplement) {
57 supplement = new WorkerGlobalScopeNotifications(context); 57 supplement = new WorkerGlobalScopeNotifications(&context);
58 WorkerSupplement::provideTo(context, supplementName(), adoptPtr(suppleme nt)); 58 provideTo(context, supplementName(), adoptPtrWillBeNoop(supplement));
59 } 59 }
60 return *supplement; 60 return *supplement;
61 } 61 }
62 62
63 NotificationCenter* WorkerGlobalScopeNotifications::webkitNotifications(WorkerGl obalScope& context) 63 NotificationCenter* WorkerGlobalScopeNotifications::webkitNotifications(WorkerGl obalScope& context)
64 { 64 {
65 return WorkerGlobalScopeNotifications::from(context).webkitNotifications(); 65 return WorkerGlobalScopeNotifications::from(context).webkitNotifications();
66 } 66 }
67 67
68 NotificationCenter* WorkerGlobalScopeNotifications::webkitNotifications() 68 NotificationCenter* WorkerGlobalScopeNotifications::webkitNotifications()
69 { 69 {
70 if (!m_notificationCenter) 70 if (!m_notificationCenter)
71 m_notificationCenter = NotificationCenter::create(&m_context, m_context. thread()->getNotificationClient()); 71 m_notificationCenter = NotificationCenter::create(m_context, m_context-> thread()->getNotificationClient());
72 return m_notificationCenter.get(); 72 return m_notificationCenter.get();
73 } 73 }
74 74
75 void WorkerGlobalScopeNotifications::trace(Visitor* visitor)
76 {
77 visitor->trace(m_context);
78 visitor->trace(m_notificationCenter);
79 }
80
75 } // namespace WebCore 81 } // namespace WebCore
76 82
77 #endif // ENABLE(LEGACY_NOTIFICATIONS) 83 #endif // ENABLE(LEGACY_NOTIFICATIONS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698