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

Side by Side Diff: services/dart/content_handler_main.cc

Issue 1276073004: Offline By Default (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Add missing explicits. Created 5 years, 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "base/threading/platform_thread.h" 10 #include "base/threading/platform_thread.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 strict_content_handler_(this, true), 63 strict_content_handler_(this, true),
64 content_handler_factory_(&content_handler_), 64 content_handler_factory_(&content_handler_),
65 strict_content_handler_factory_(&strict_content_handler_), 65 strict_content_handler_factory_(&strict_content_handler_),
66 service_connector_(nullptr) {} 66 service_connector_(nullptr) {}
67 67
68 ~DartContentHandlerApp() override {} 68 ~DartContentHandlerApp() override {}
69 69
70 void ExtractApplication(base::FilePath* application_dir, 70 void ExtractApplication(base::FilePath* application_dir,
71 mojo::URLResponsePtr response, 71 mojo::URLResponsePtr response,
72 const base::Closure& callback) { 72 const base::Closure& callback) {
73 url_response_disk_cache_->GetExtractedContent( 73 url_response_disk_cache_->UpdateAndGetExtracted(
74 response.Pass(), 74 response.Pass(),
75 [application_dir, callback](mojo::Array<uint8_t> application_dir_path, 75 [application_dir, callback](mojo::Array<uint8_t> application_dir_path,
76 mojo::Array<uint8_t> cache_path) { 76 mojo::Array<uint8_t> cache_path) {
77 if (application_dir_path.is_null()) { 77 if (application_dir_path.is_null()) {
78 *application_dir = base::FilePath(); 78 *application_dir = base::FilePath();
79 } else { 79 } else {
80 *application_dir = base::FilePath(std::string( 80 *application_dir = base::FilePath(std::string(
81 reinterpret_cast<char*>(&application_dir_path.front()), 81 reinterpret_cast<char*>(&application_dir_path.front()),
82 application_dir_path.size())); 82 application_dir_path.size()));
83 } 83 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 189
190 } // namespace dart 190 } // namespace dart
191 191
192 MojoResult MojoMain(MojoHandle application_request) { 192 MojoResult MojoMain(MojoHandle application_request) {
193 mojo::ApplicationRunnerChromium runner(new dart::DartContentHandlerApp); 193 mojo::ApplicationRunnerChromium runner(new dart::DartContentHandlerApp);
194 MojoResult r = runner.Run(application_request); 194 MojoResult r = runner.Run(application_request);
195 // TODO(johnmccutchan): Remove this once the Dart VM shuts down threads. 195 // TODO(johnmccutchan): Remove this once the Dart VM shuts down threads.
196 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100)); 196 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(100));
197 return r; 197 return r;
198 } 198 }
OLDNEW
« no previous file with comments | « services/android/java_handler.cc ('k') | services/dart/dart_apptests/lib/src/connect_to_loader_apptests.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698