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

Unified Diff: chrome/common/extensions/docs/server2/api_data_source.py

Issue 10834329: Extension docs server: many changes to bring down the latency of the server, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | « no previous file | chrome/common/extensions/docs/server2/api_list_data_source.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/docs/server2/api_data_source.py
diff --git a/chrome/common/extensions/docs/server2/api_data_source.py b/chrome/common/extensions/docs/server2/api_data_source.py
index f912e4e446cc8986cdba20e56549cc24407d9611..5234aa801f8149a150ad08a4e55a91ad0520c32a 100644
--- a/chrome/common/extensions/docs/server2/api_data_source.py
+++ b/chrome/common/extensions/docs/server2/api_data_source.py
@@ -5,6 +5,7 @@
import json
import logging
import os
+import time
from file_system import FileNotFoundError
from handlebar_dict_generator import HandlebarDictGenerator
@@ -37,9 +38,9 @@ class APIDataSource(object):
self._base_path = base_path
def Create(self, request):
- return APIDataSource(self._permissions_cache,
- self._json_cache,
- self._idl_cache,
+ return APIDataSource(self._permissions_cache.ScopeToRequest(),
+ self._json_cache.ScopeToRequest(),
+ self._idl_cache.ScopeToRequest(),
self._base_path,
self._samples_factory.Create(request))
@@ -96,6 +97,13 @@ class APIDataSource(object):
return self.get(key)
def get(self, key):
+ start_time = time.time()
+ try:
+ return self._do_get(key)
+ finally:
+ logging.info("ApiDataSource: %sms", (time.time() - start_time) * 1000)
+
+ def _do_get(self, key):
path, ext = os.path.splitext(key)
unix_name = model.UnixName(path)
json_path = unix_name + '.json'
« no previous file with comments | « no previous file | chrome/common/extensions/docs/server2/api_list_data_source.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698