Title: [105842] trunk/Tools
Revision
105842
Author
[email protected]
Date
2012-01-24 18:13:51 -0800 (Tue, 24 Jan 2012)

Log Message

Initializing the browser property of the Bugzilla class takes too long
https://bugs.webkit.org/show_bug.cgi?id=76960

Reviewed by Adam Barth.

Lazily initialize it. This saves ~150ms on a no-op run-webkit-tests call
on my Mac Pro.

* Scripts/webkitpy/common/net/bugzilla/bugzilla.py:
(Bugzilla.__init__):
(Bugzilla._get_browser):
(Bugzilla):
(Bugzilla._set_browser):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (105841 => 105842)


--- trunk/Tools/ChangeLog	2012-01-25 02:02:50 UTC (rev 105841)
+++ trunk/Tools/ChangeLog	2012-01-25 02:13:51 UTC (rev 105842)
@@ -1,3 +1,19 @@
+2012-01-24  Ojan Vafai  <[email protected]>
+
+        Initializing the browser property of the Bugzilla class takes too long
+        https://bugs.webkit.org/show_bug.cgi?id=76960
+
+        Reviewed by Adam Barth.
+
+        Lazily initialize it. This saves ~150ms on a no-op run-webkit-tests call
+        on my Mac Pro.
+
+        * Scripts/webkitpy/common/net/bugzilla/bugzilla.py:
+        (Bugzilla.__init__):
+        (Bugzilla._get_browser):
+        (Bugzilla):
+        (Bugzilla._set_browser):
+
 2012-01-24  Mark Rowe  <[email protected]>
 
         Death to _javascript_Glue.

Modified: trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py (105841 => 105842)


--- trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py	2012-01-25 02:02:50 UTC (rev 105841)
+++ trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bugzilla.py	2012-01-25 02:13:51 UTC (rev 105842)
@@ -265,12 +265,21 @@
         self.committers = committers
         self.cached_quips = []
         self.edit_user_parser = EditUsersParser()
+        self._browser = None
 
-        from webkitpy.thirdparty.autoinstalled.mechanize import Browser
-        self.browser = Browser()
-        # Ignore bugs.webkit.org/robots.txt until we fix it to allow this script.
-        self.browser.set_handle_robots(False)
+    def _get_browser(self):
+        if not self._browser:
+            from webkitpy.thirdparty.autoinstalled.mechanize import Browser
+            self._browser = Browser()
+            # Ignore bugs.webkit.org/robots.txt until we fix it to allow this script.
+            self._browser.set_handle_robots(False)
+        return self._browser
 
+    def _set_browser(self, value):
+        self._browser = value
+
+    browser = property(_get_browser, _set_browser)
+
     def fetch_user(self, user_id):
         self.authenticate()
         edit_user_page = self.browser.open(self.edit_user_url_for_id(user_id))
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to