Title: [140903] trunk/Source/WebKit2
Revision
140903
Author
akl...@apple.com
Date
2013-01-25 21:42:07 -0800 (Fri, 25 Jan 2013)

Log Message

[Mac] Defer loading the Web Inspector bundle until it's necessary.
<http://webkit.org/b/107999>
<rdar://problem/13091861>

Reviewed by Anders Carlsson.

Don't instantiate an NSBundle for the Web Inspector before it's needed.
1.51MB progression on Membuster3.

* WebProcess/WebPage/WebInspector.cpp:
(WebKit::WebInspector::WebInspector):
* WebProcess/WebPage/WebInspector.h:
(WebInspector):
* WebProcess/WebPage/mac/WebInspectorMac.mm:
(WebKit::WebInspector::setInspectorUsesWebKitUserInterface):
(WebKit::WebInspector::localizedStringsURL):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (140902 => 140903)


--- trunk/Source/WebKit2/ChangeLog	2013-01-26 05:23:36 UTC (rev 140902)
+++ trunk/Source/WebKit2/ChangeLog	2013-01-26 05:42:07 UTC (rev 140903)
@@ -1,3 +1,22 @@
+2013-01-25  Andreas Kling  <akl...@apple.com>
+
+        [Mac] Defer loading the Web Inspector bundle until it's necessary.
+        <http://webkit.org/b/107999>
+        <rdar://problem/13091861>
+
+        Reviewed by Anders Carlsson.
+
+        Don't instantiate an NSBundle for the Web Inspector before it's needed.
+        1.51MB progression on Membuster3.
+
+        * WebProcess/WebPage/WebInspector.cpp:
+        (WebKit::WebInspector::WebInspector):
+        * WebProcess/WebPage/WebInspector.h:
+        (WebInspector):
+        * WebProcess/WebPage/mac/WebInspectorMac.mm:
+        (WebKit::WebInspector::setInspectorUsesWebKitUserInterface):
+        (WebKit::WebInspector::localizedStringsURL):
+
 2013-01-25  Gyuyoung Kim  <gyuyoung....@samsung.com>
 
         [EFL][WK2] Fix build break after r140891.

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp (140902 => 140903)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp	2013-01-26 05:23:36 UTC (rev 140902)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp	2013-01-26 05:42:07 UTC (rev 140903)
@@ -51,6 +51,10 @@
     , m_inspectorPage(0)
     , m_frontendClient(0)
     , m_frontendChannel(frontendChannel)
+#if PLATFORM(MAC)
+    , m_hasLocalizedStringsURL(false)
+    , m_usesWebKitUserInterface(false)
+#endif
 #if ENABLE(INSPECTOR_SERVER)
     , m_remoteFrontendConnected(false)
 #endif

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.h (140902 => 140903)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.h	2013-01-26 05:23:36 UTC (rev 140902)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.h	2013-01-26 05:42:07 UTC (rev 140903)
@@ -124,7 +124,9 @@
     WebInspectorFrontendClient* m_frontendClient;
     WebCore::InspectorFrontendChannel* m_frontendChannel;
 #if PLATFORM(MAC)
-    String m_localizedStringsURL;
+    mutable String m_localizedStringsURL;
+    mutable bool m_hasLocalizedStringsURL;
+    bool m_usesWebKitUserInterface;
 #endif
 #if ENABLE(INSPECTOR_SERVER)
     bool m_remoteFrontendConnected;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/WebInspectorMac.mm (140902 => 140903)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/WebInspectorMac.mm	2013-01-26 05:23:36 UTC (rev 140902)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/WebInspectorMac.mm	2013-01-26 05:42:07 UTC (rev 140903)
@@ -50,16 +50,24 @@
 
 void WebInspector::setInspectorUsesWebKitUserInterface(bool flag)
 {
-    NSString *bundleIdentifier = inspectorReallyUsesWebKitUserInterface(flag) ? @"com.apple.WebCore" : @"com.apple.WebInspector";
-    NSString *path = [[NSBundle bundleWithIdentifier:bundleIdentifier] pathForResource:@"localizedStrings" ofType:@"js"];
-    if ([path length])
-        m_localizedStringsURL = [[NSURL fileURLWithPath:path] absoluteString];
-    else
-        m_localizedStringsURL = String();
+    if (m_usesWebKitUserInterface == flag)
+        return;
+
+    m_usesWebKitUserInterface = flag;
+    m_hasLocalizedStringsURL = false;
 }
 
 String WebInspector::localizedStringsURL() const
 {
+    if (!m_hasLocalizedStringsURL) {
+        NSString *bundleIdentifier = inspectorReallyUsesWebKitUserInterface(m_usesWebKitUserInterface) ? @"com.apple.WebCore" : @"com.apple.WebInspector";
+        NSString *path = [[NSBundle bundleWithIdentifier:bundleIdentifier] pathForResource:@"localizedStrings" ofType:@"js"];
+        if ([path length])
+            m_localizedStringsURL = [[NSURL fileURLWithPath:path] absoluteString];
+        else
+            m_localizedStringsURL = String();
+        m_hasLocalizedStringsURL = true;
+    }
     return m_localizedStringsURL;
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to