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

Unified Diff: Source/modules/notifications/Notification.cpp

Issue 268353004: NotificationController::clientFrom() should return a reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/notifications/Notification.h ('k') | Source/modules/notifications/NotificationController.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/notifications/Notification.cpp
diff --git a/Source/modules/notifications/Notification.cpp b/Source/modules/notifications/Notification.cpp
index 5114d8a625d39fef2f6226b9b7ae49de7b2052e3..e5bcc1cfbcd5e05bfe9462b262ae511944500d4d 100644
--- a/Source/modules/notifications/Notification.cpp
+++ b/Source/modules/notifications/Notification.cpp
@@ -43,7 +43,7 @@ namespace WebCore {
Notification* Notification::create(ExecutionContext* context, const String& title, const Dictionary& options)
{
- NotificationClient* client = NotificationController::clientFrom(toDocument(context)->frame());
+ NotificationClient& client = NotificationController::clientFrom(toDocument(context)->frame());
Notification* notification = adoptRefCountedGarbageCollected(new Notification(title, context, client));
String argument;
@@ -65,7 +65,7 @@ Notification* Notification::create(ExecutionContext* context, const String& titl
return notification;
}
-Notification::Notification(const String& title, ExecutionContext* context, NotificationClient* client)
+Notification::Notification(const String& title, ExecutionContext* context, NotificationClient& client)
: ActiveDOMObject(context)
, m_title(title)
, m_dir("auto")
@@ -73,7 +73,6 @@ Notification::Notification(const String& title, ExecutionContext* context, Notif
, m_client(client)
, m_asyncRunner(adoptPtr(new AsyncMethodRunner<Notification>(this, &Notification::show)))
{
- ASSERT(m_client);
ScriptWrappable::init(this);
m_asyncRunner->runAsync();
@@ -89,12 +88,12 @@ void Notification::show()
if (!toDocument(executionContext())->page())
return;
- if (NotificationController::from(toDocument(executionContext())->frame())->client()->checkPermission(executionContext()) != NotificationClient::PermissionAllowed) {
+ if (NotificationController::from(toDocument(executionContext())->frame())->client().checkPermission(executionContext()) != NotificationClient::PermissionAllowed) {
Peter Beverloo 2014/05/08 12:59:34 You can use m_client.checkPermission(executionCont
gyuyoung-inactive 2014/05/08 15:50:27 Done.
dispatchErrorEvent();
return;
}
- if (m_client->show(this))
+ if (m_client.show(this))
m_state = Showing;
}
@@ -104,7 +103,7 @@ void Notification::close()
case Idle:
break;
case Showing:
- m_client->close(this);
+ m_client.close(this);
break;
case Closed:
break;
@@ -164,13 +163,13 @@ const String& Notification::permission(ExecutionContext* context)
ASSERT(toDocument(context)->page());
UseCounter::count(context, UseCounter::NotificationPermission);
- return permissionString(NotificationController::from(toDocument(context)->frame())->client()->checkPermission(context));
+ return permissionString(NotificationController::from(toDocument(context)->frame())->client().checkPermission(context));
Peter Beverloo 2014/05/08 12:59:34 NotificationController::clientFrom()?
gyuyoung-inactive 2014/05/08 15:50:27 Done.
}
void Notification::requestPermission(ExecutionContext* context, PassOwnPtr<NotificationPermissionCallback> callback)
{
ASSERT(toDocument(context)->page());
- NotificationController::from(toDocument(context)->frame())->client()->requestPermission(context, callback);
+ NotificationController::from(toDocument(context)->frame())->client().requestPermission(context, callback);
Peter Beverloo 2014/05/08 12:59:34 NotificationController::clientFrom()?
gyuyoung-inactive 2014/05/08 15:50:27 Done.
}
bool Notification::dispatchEvent(PassRefPtrWillBeRawPtr<Event> event)
@@ -187,13 +186,11 @@ const AtomicString& Notification::interfaceName() const
void Notification::stop()
{
- if (m_client)
- m_client->notificationObjectDestroyed(this);
+ m_client.notificationObjectDestroyed(this);
if (m_asyncRunner)
m_asyncRunner->stop();
- m_client = 0;
haraken 2014/05/08 05:12:04 I don't understand why you can remove this. I agre
Peter Beverloo 2014/05/08 12:59:34 Are you worried about the case where LocalFrame ge
gyuyoung-inactive 2014/05/08 15:50:27 Though I'm not 100% sure, it looks you guys worry
gyuyoung-inactive 2014/05/09 02:28:49 Peter and Kentaro, any comment ?
m_state = Closed;
}
« no previous file with comments | « Source/modules/notifications/Notification.h ('k') | Source/modules/notifications/NotificationController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698