| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 appengine_wrappers import IsDevServer | 5 from appengine_wrappers import IsDevServer |
| 6 from branch_utility import BranchUtility | 6 from branch_utility import BranchUtility |
| 7 from compiled_file_system import CompiledFileSystem | 7 from compiled_file_system import CompiledFileSystem |
| 8 from empty_dir_file_system import EmptyDirFileSystem | 8 from empty_dir_file_system import EmptyDirFileSystem |
| 9 from github_file_system import GithubFileSystem | 9 from github_file_system import GithubFileSystem |
| 10 from host_file_system_provider import HostFileSystemProvider | 10 from host_file_system_provider import HostFileSystemProvider |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 @memoize | 34 @memoize |
| 35 def CreateServerInstance(self): | 35 def CreateServerInstance(self): |
| 36 object_store_creator = ObjectStoreCreator(start_empty=False) | 36 object_store_creator = ObjectStoreCreator(start_empty=False) |
| 37 branch_utility = self._delegate.CreateBranchUtility(object_store_creator) | 37 branch_utility = self._delegate.CreateBranchUtility(object_store_creator) |
| 38 host_file_system_provider = self._delegate.CreateHostFileSystemProvider( | 38 host_file_system_provider = self._delegate.CreateHostFileSystemProvider( |
| 39 object_store_creator, | 39 object_store_creator, |
| 40 offline=True) | 40 offline=True) |
| 41 app_samples_file_system = self._delegate.CreateAppSamplesFileSystem( | 41 app_samples_file_system = self._delegate.CreateAppSamplesFileSystem( |
| 42 object_store_creator) | 42 object_store_creator) |
| 43 compiled_host_fs_factory = CompiledFileSystem.Factory( | |
| 44 host_file_system_provider.GetTrunk(), | |
| 45 object_store_creator) | |
| 46 return ServerInstance(object_store_creator, | 43 return ServerInstance(object_store_creator, |
| 47 app_samples_file_system, | 44 app_samples_file_system, |
| 48 compiled_host_fs_factory, | 45 CompiledFileSystem.Factory(object_store_creator), |
| 49 branch_utility, | 46 branch_utility, |
| 50 host_file_system_provider) | 47 host_file_system_provider) |
| 51 | 48 |
| 52 class InstanceServlet(object): | 49 class InstanceServlet(object): |
| 53 '''Servlet for running on normal AppEngine instances. | 50 '''Servlet for running on normal AppEngine instances. |
| 54 Create this via GetConstructor() so that cache state can be shared amongst | 51 Create this via GetConstructor() so that cache state can be shared amongst |
| 55 them via the memoizing Delegate. | 52 them via the memoizing Delegate. |
| 56 ''' | 53 ''' |
| 57 class Delegate(object): | 54 class Delegate(object): |
| 58 '''Allow runtime dependencies to be overriden for testing. | 55 '''Allow runtime dependencies to be overriden for testing. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 70 GithubFileSystem.Create(object_store_creator)) | 67 GithubFileSystem.Create(object_store_creator)) |
| 71 | 68 |
| 72 @staticmethod | 69 @staticmethod |
| 73 def GetConstructor(delegate_for_test=None): | 70 def GetConstructor(delegate_for_test=None): |
| 74 render_servlet_delegate = OfflineRenderServletDelegate( | 71 render_servlet_delegate = OfflineRenderServletDelegate( |
| 75 delegate_for_test or InstanceServlet.Delegate()) | 72 delegate_for_test or InstanceServlet.Delegate()) |
| 76 return lambda request: RenderServlet(request, render_servlet_delegate) | 73 return lambda request: RenderServlet(request, render_servlet_delegate) |
| 77 | 74 |
| 78 # NOTE: if this were a real Servlet it would implement a Get() method, but | 75 # NOTE: if this were a real Servlet it would implement a Get() method, but |
| 79 # GetConstructor returns an appropriate lambda function (Request -> Servlet). | 76 # GetConstructor returns an appropriate lambda function (Request -> Servlet). |
| OLD | NEW |