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

Unified Diff: chrome/common/extensions/docs/server2/samples_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
Index: chrome/common/extensions/docs/server2/samples_data_source.py
diff --git a/chrome/common/extensions/docs/server2/samples_data_source.py b/chrome/common/extensions/docs/server2/samples_data_source.py
index c712651e8a96453ec3ff98685e1fd2b40554d20b..4cc1b2fe2cbbdd417b2240f12c35ba1a97de895d 100644
--- a/chrome/common/extensions/docs/server2/samples_data_source.py
+++ b/chrome/common/extensions/docs/server2/samples_data_source.py
@@ -5,6 +5,7 @@
import json
import logging
import re
+import time
import third_party.json_schema_compiler.json_comment_eater as json_comment_eater
import third_party.json_schema_compiler.model as model
@@ -39,8 +40,8 @@ class SamplesDataSource(object):
def Create(self, request):
"""Returns a new SamplesDataSource bound to |request|.
"""
- return SamplesDataSource(self._extensions_cache,
- self._apps_cache,
+ return SamplesDataSource(self._extensions_cache.ScopeToRequest(),
+ self._apps_cache.ScopeToRequest(),
self._samples_path,
request)
@@ -203,6 +204,13 @@ class SamplesDataSource(object):
return self.get(key)
def get(self, key):
+ start_time = time.time()
+ try:
+ return self._do_get(key)
+ finally:
+ logging.info("SamplesDataSource: %sms", (time.time() - start_time) * 1000)
+
+ def _do_get(self, key):
return {
'apps': lambda: self._CreateSamplesDict('apps'),
'extensions': lambda: self._CreateSamplesDict('extensions')

Powered by Google App Engine
This is Rietveld 408576698