Title: [149334] trunk/Source/WebCore
- Revision
- 149334
- Author
- benja...@webkit.org
- Date
- 2013-04-29 16:59:38 -0700 (Mon, 29 Apr 2013)
Log Message
Do not allocate Static Strings for Notification::permissionString
https://bugs.webkit.org/show_bug.cgi?id=115316
Reviewed by Geoffrey Garen.
The code is not nearly hot enough to justify keeping this memory around.
* Modules/notifications/Notification.cpp:
(WebCore::Notification::permission):
(WebCore::Notification::permissionString):
* Modules/notifications/Notification.h:
(Notification):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (149333 => 149334)
--- trunk/Source/WebCore/ChangeLog 2013-04-29 23:58:20 UTC (rev 149333)
+++ trunk/Source/WebCore/ChangeLog 2013-04-29 23:59:38 UTC (rev 149334)
@@ -1,3 +1,18 @@
+2013-04-29 Benjamin Poulain <benja...@webkit.org>
+
+ Do not allocate Static Strings for Notification::permissionString
+ https://bugs.webkit.org/show_bug.cgi?id=115316
+
+ Reviewed by Geoffrey Garen.
+
+ The code is not nearly hot enough to justify keeping this memory around.
+
+ * Modules/notifications/Notification.cpp:
+ (WebCore::Notification::permission):
+ (WebCore::Notification::permissionString):
+ * Modules/notifications/Notification.h:
+ (Notification):
+
2013-04-29 Anders Carlsson <ander...@apple.com>
Remove StorageTracker::originsLoaded
Modified: trunk/Source/WebCore/Modules/notifications/Notification.cpp (149333 => 149334)
--- trunk/Source/WebCore/Modules/notifications/Notification.cpp 2013-04-29 23:58:20 UTC (rev 149333)
+++ trunk/Source/WebCore/Modules/notifications/Notification.cpp 2013-04-29 23:59:38 UTC (rev 149334)
@@ -226,29 +226,25 @@
#if ENABLE(NOTIFICATIONS)
-const String& Notification::permission(ScriptExecutionContext* context)
+const String Notification::permission(ScriptExecutionContext* context)
{
ASSERT(toDocument(context)->page());
return permissionString(NotificationController::from(toDocument(context)->page())->client()->checkPermission(context));
}
-const String& Notification::permissionString(NotificationClient::Permission permission)
+const String Notification::permissionString(NotificationClient::Permission permission)
{
- DEFINE_STATIC_LOCAL(const String, allowedPermission, (ASCIILiteral("granted")));
- DEFINE_STATIC_LOCAL(const String, deniedPermission, (ASCIILiteral("denied")));
- DEFINE_STATIC_LOCAL(const String, defaultPermission, (ASCIILiteral("default")));
-
switch (permission) {
case NotificationClient::PermissionAllowed:
- return allowedPermission;
+ return ASCIILiteral("granted");
case NotificationClient::PermissionDenied:
- return deniedPermission;
+ return ASCIILiteral("denied");
case NotificationClient::PermissionNotAllowed:
- return defaultPermission;
+ return ASCIILiteral("default");
}
ASSERT_NOT_REACHED();
- return deniedPermission;
+ return String();
}
void Notification::requestPermission(ScriptExecutionContext* context, PassRefPtr<NotificationPermissionCallback> callback)
Modified: trunk/Source/WebCore/Modules/notifications/Notification.h (149333 => 149334)
--- trunk/Source/WebCore/Modules/notifications/Notification.h 2013-04-29 23:58:20 UTC (rev 149333)
+++ trunk/Source/WebCore/Modules/notifications/Notification.h 2013-04-29 23:59:38 UTC (rev 149334)
@@ -136,8 +136,8 @@
void finalize();
#if ENABLE(NOTIFICATIONS)
- static const String& permission(ScriptExecutionContext*);
- static const String& permissionString(NotificationClient::Permission);
+ static const String permission(ScriptExecutionContext*);
+ static const String permissionString(NotificationClient::Permission);
static void requestPermission(ScriptExecutionContext*, PassRefPtr<NotificationPermissionCallback> = 0);
#endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes