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

Side by Side Diff: third_party/WebKit/Source/modules/notifications/Notification.cpp

Issue 1580883002: Oilpan: move AsyncMethodRunner to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename to RawPtrOrMemberTrait<> Created 4 years, 11 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 notification->suspendIfNeeded(); 109 notification->suspendIfNeeded();
110 110
111 return notification; 111 return notification;
112 } 112 }
113 113
114 Notification::Notification(ExecutionContext* context, const WebNotificationData& data) 114 Notification::Notification(ExecutionContext* context, const WebNotificationData& data)
115 : ActiveDOMObject(context) 115 : ActiveDOMObject(context)
116 , m_data(data) 116 , m_data(data)
117 , m_persistentId(kInvalidPersistentId) 117 , m_persistentId(kInvalidPersistentId)
118 , m_state(NotificationStateIdle) 118 , m_state(NotificationStateIdle)
119 , m_asyncRunner(this, &Notification::show) 119 , m_asyncRunner(AsyncMethodRunner<Notification>::create(this, &Notification: :show))
120 { 120 {
121 ASSERT(notificationManager()); 121 ASSERT(notificationManager());
122 } 122 }
123 123
124 Notification::~Notification() 124 Notification::~Notification()
125 { 125 {
126 } 126 }
127 127
128 void Notification::scheduleShow() 128 void Notification::scheduleShow()
129 { 129 {
130 ASSERT(m_state == NotificationStateIdle); 130 ASSERT(m_state == NotificationStateIdle);
131 ASSERT(!m_asyncRunner.isActive()); 131 ASSERT(!m_asyncRunner->isActive());
132 132
133 m_asyncRunner.runAsync(); 133 m_asyncRunner->runAsync();
134 } 134 }
135 135
136 void Notification::show() 136 void Notification::show()
137 { 137 {
138 ASSERT(m_state == NotificationStateIdle); 138 ASSERT(m_state == NotificationStateIdle);
139 if (Notification::checkPermission(executionContext()) != WebNotificationPerm issionAllowed) { 139 if (Notification::checkPermission(executionContext()) != WebNotificationPerm issionAllowed) {
140 dispatchErrorEvent(); 140 dispatchErrorEvent();
141 return; 141 return;
142 } 142 }
143 143
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 { 347 {
348 return EventTargetNames::Notification; 348 return EventTargetNames::Notification;
349 } 349 }
350 350
351 void Notification::stop() 351 void Notification::stop()
352 { 352 {
353 notificationManager()->notifyDelegateDestroyed(this); 353 notificationManager()->notifyDelegateDestroyed(this);
354 354
355 m_state = NotificationStateClosed; 355 m_state = NotificationStateClosed;
356 356
357 m_asyncRunner.stop(); 357 m_asyncRunner->stop();
358 } 358 }
359 359
360 bool Notification::hasPendingActivity() const 360 bool Notification::hasPendingActivity() const
361 { 361 {
362 return m_state == NotificationStateShowing || m_asyncRunner.isActive(); 362 return m_state == NotificationStateShowing || m_asyncRunner->isActive();
363 } 363 }
364 364
365 DEFINE_TRACE(Notification) 365 DEFINE_TRACE(Notification)
366 { 366 {
367 visitor->trace(m_asyncRunner);
367 RefCountedGarbageCollectedEventTargetWithInlineData<Notification>::trace(vis itor); 368 RefCountedGarbageCollectedEventTargetWithInlineData<Notification>::trace(vis itor);
368 ActiveDOMObject::trace(visitor); 369 ActiveDOMObject::trace(visitor);
369 } 370 }
370 371
371 } // namespace blink 372 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/notifications/Notification.h ('k') | third_party/WebKit/Source/platform/AsyncMethodRunner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698