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

Side by Side Diff: shell/context.cc

Issue 1088533003: Adding URLResponse Disk Cache to mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Follow review Created 5 years, 7 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 | « shell/child_process_host_unittest.cc ('k') | shell/in_process_native_runner.h » ('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 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 #include "shell/context.h" 5 #include "shell/context.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/base_switches.h" 9 #include "base/base_switches.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 13 matching lines...) Expand all
24 #include "mojo/common/trace_controller_impl.h" 24 #include "mojo/common/trace_controller_impl.h"
25 #include "mojo/common/tracing_impl.h" 25 #include "mojo/common/tracing_impl.h"
26 #include "mojo/edk/embedder/embedder.h" 26 #include "mojo/edk/embedder/embedder.h"
27 #include "mojo/edk/embedder/simple_platform_support.h" 27 #include "mojo/edk/embedder/simple_platform_support.h"
28 #include "mojo/public/cpp/application/application_connection.h" 28 #include "mojo/public/cpp/application/application_connection.h"
29 #include "mojo/public/cpp/application/application_delegate.h" 29 #include "mojo/public/cpp/application/application_delegate.h"
30 #include "mojo/public/cpp/application/application_impl.h" 30 #include "mojo/public/cpp/application/application_impl.h"
31 #include "services/tracing/tracing.mojom.h" 31 #include "services/tracing/tracing.mojom.h"
32 #include "shell/application_manager/application_loader.h" 32 #include "shell/application_manager/application_loader.h"
33 #include "shell/application_manager/application_manager.h" 33 #include "shell/application_manager/application_manager.h"
34 #include "shell/background_application_loader.h"
34 #include "shell/command_line_util.h" 35 #include "shell/command_line_util.h"
35 #include "shell/filename_util.h" 36 #include "shell/filename_util.h"
36 #include "shell/in_process_native_runner.h" 37 #include "shell/in_process_native_runner.h"
37 #include "shell/out_of_process_native_runner.h" 38 #include "shell/out_of_process_native_runner.h"
38 #include "shell/switches.h" 39 #include "shell/switches.h"
39 #include "shell/tracer.h" 40 #include "shell/tracer.h"
41 #include "shell/url_response_disk_cache_loader.h"
40 #include "url/gurl.h" 42 #include "url/gurl.h"
41 43
42 using mojo::ServiceProvider; 44 using mojo::ServiceProvider;
43 using mojo::ServiceProviderPtr; 45 using mojo::ServiceProviderPtr;
44 46
45 namespace shell { 47 namespace shell {
46 namespace { 48 namespace {
47 49
48 // Used to ensure we only init once. 50 // Used to ensure we only init once.
49 class Setup { 51 class Setup {
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 bool Context::InitWithPaths(const base::FilePath& shell_child_path) { 253 bool Context::InitWithPaths(const base::FilePath& shell_child_path) {
252 TRACE_EVENT0("mojo_shell", "Context::InitWithPaths"); 254 TRACE_EVENT0("mojo_shell", "Context::InitWithPaths");
253 const base::CommandLine& command_line = 255 const base::CommandLine& command_line =
254 *base::CommandLine::ForCurrentProcess(); 256 *base::CommandLine::ForCurrentProcess();
255 257
256 if (command_line.HasSwitch(switches::kWaitForDebugger)) 258 if (command_line.HasSwitch(switches::kWaitForDebugger))
257 base::debug::WaitForDebugger(60, true); 259 base::debug::WaitForDebugger(60, true);
258 260
259 mojo_shell_child_path_ = shell_child_path; 261 mojo_shell_child_path_ = shell_child_path;
260 262
263 application_manager()->SetLoaderForURL(
264 make_scoped_ptr(new BackgroundApplicationLoader(
265 make_scoped_ptr(new URLResponseDiskCacheLoader()),
266 "url_response_disk_cache", base::MessageLoop::TYPE_DEFAULT)),
267 GURL("mojo:url_response_disk_cache"));
268
261 EnsureEmbedderIsInitialized(); 269 EnsureEmbedderIsInitialized();
262 task_runners_.reset( 270 task_runners_.reset(
263 new TaskRunners(base::MessageLoop::current()->message_loop_proxy())); 271 new TaskRunners(base::MessageLoop::current()->message_loop_proxy()));
264 272
265 // TODO(vtl): Probably these failures should be checked before |Init()|, and 273 // TODO(vtl): Probably these failures should be checked before |Init()|, and
266 // this function simply shouldn't fail. 274 // this function simply shouldn't fail.
267 if (!shell_file_root_.is_valid()) 275 if (!shell_file_root_.is_valid())
268 return false; 276 return false;
269 if (!ConfigureURLMappings(command_line, this)) 277 if (!ConfigureURLMappings(command_line, this))
270 return false; 278 return false;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 app_urls_.erase(url); 353 app_urls_.erase(url);
346 if (app_urls_.empty() && base::MessageLoop::current()->is_running()) { 354 if (app_urls_.empty() && base::MessageLoop::current()->is_running()) {
347 DCHECK_EQ(base::MessageLoop::current()->task_runner(), 355 DCHECK_EQ(base::MessageLoop::current()->task_runner(),
348 task_runners_->shell_runner()); 356 task_runners_->shell_runner());
349 base::MessageLoop::current()->Quit(); 357 base::MessageLoop::current()->Quit();
350 } 358 }
351 } 359 }
352 } 360 }
353 361
354 } // namespace shell 362 } // namespace shell
OLDNEW
« no previous file with comments | « shell/child_process_host_unittest.cc ('k') | shell/in_process_native_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698