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

Side by Side Diff: chrome/common/extensions/docs/server2/api_data_source.py

Issue 438963003: Docserver: Add annotation to intro_tables.json to restrict content by platform (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Final nit Created 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/common/extensions/docs/server2/app.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from data_source import DataSource 5 from data_source import DataSource
6 from docs_server_utils import StringIdentity 6 from docs_server_utils import StringIdentity
7 from environment import IsPreviewServer 7 from environment import IsPreviewServer
8 from file_system import FileNotFoundError 8 from file_system import FileNotFoundError
9 from future import Future, All 9 from future import Future, All
10 from jsc_view import JSCView, GetEventByNameFromEvents 10 from jsc_view import JSCView, GetEventByNameFromEvents
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 def resolve(): 64 def resolve():
65 jsc_view = jsc_view_future.Get() 65 jsc_view = jsc_view_future.Get()
66 if jsc_view is None: 66 if jsc_view is None:
67 jsc_view = JSCView( 67 jsc_view = JSCView(
68 content_script_apis_future.Get(), 68 content_script_apis_future.Get(),
69 model_future.Get(), 69 model_future.Get(),
70 self._platform_bundle.GetAvailabilityFinder(platform), 70 self._platform_bundle.GetAvailabilityFinder(platform),
71 self._json_cache, 71 self._json_cache,
72 self._template_cache, 72 self._template_cache,
73 self._platform_bundle.GetFeaturesBundle(platform), 73 self._platform_bundle.GetFeaturesBundle(platform),
74 self._LoadEventByName(platform)).ToDict() 74 self._LoadEventByName(platform),
75 platform).ToDict()
75 self._view_cache.Set(object_store_key, jsc_view) 76 self._view_cache.Set(object_store_key, jsc_view)
76 return jsc_view 77 return jsc_view
77 return Future(callback=resolve) 78 return Future(callback=resolve)
78 79
79 def _GetImpl(self, platform, api_name): 80 def _GetImpl(self, platform, api_name):
80 jsc_view_future = self._GetSchemaView(platform, api_name) 81 jsc_view_future = self._GetSchemaView(platform, api_name)
81 def resolve(): 82 def resolve():
82 jsc_view = jsc_view_future.Get() 83 jsc_view = jsc_view_future.Get()
83 # Parsing samples on the preview server takes seconds and doesn't add 84 # Parsing samples on the preview server takes seconds and doesn't add
84 # anything. Don't do it. 85 # anything. Don't do it.
(...skipping 11 matching lines...) Expand all
96 getter = lambda: 0 97 getter = lambda: 0
97 getter.get = lambda api_name: self._GetImpl(platform, api_name).Get() 98 getter.get = lambda api_name: self._GetImpl(platform, api_name).Get()
98 return getter 99 return getter
99 100
100 def Cron(self): 101 def Cron(self):
101 futures = [] 102 futures = []
102 for platform in GetPlatforms(): 103 for platform in GetPlatforms():
103 futures += [self._GetImpl(platform, name) 104 futures += [self._GetImpl(platform, name)
104 for name in self._platform_bundle.GetAPIModels(platform).GetNames()] 105 for name in self._platform_bundle.GetAPIModels(platform).GetNames()]
105 return All(futures, except_pass=FileNotFoundError) 106 return All(futures, except_pass=FileNotFoundError)
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/docs/server2/app.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698