diff options
-rw-r--r-- | components/filesystem/file_system_impl.cc | 108 | ||||
-rw-r--r-- | components/filesystem/file_system_impl.h | 21 | ||||
-rw-r--r-- | mandoline/services/core_services/core_services_application_delegate.cc | 2 | ||||
-rw-r--r-- | mojo/runner/BUILD.gn | 2 | ||||
-rw-r--r-- | mojo/runner/child_process_host.cc | 1 | ||||
-rw-r--r-- | mojo/runner/context.h | 2 | ||||
-rw-r--r-- | mojo/runner/scoped_user_data_dir.cc | 40 | ||||
-rw-r--r-- | mojo/runner/scoped_user_data_dir.h | 28 | ||||
-rw-r--r-- | mojo/runner/switches.cc | 8 | ||||
-rw-r--r-- | mojo/runner/switches.h | 2 | ||||
-rw-r--r-- | mojo/services/network/BUILD.gn | 1 | ||||
-rw-r--r-- | mojo/services/network/DEPS | 3 | ||||
-rw-r--r-- | mojo/services/network/network_context.cc | 30 | ||||
-rw-r--r-- | mojo/services/network/network_context.h | 9 | ||||
-rw-r--r-- | mojo/services/network/network_service_delegate.cc | 100 | ||||
-rw-r--r-- | mojo/services/network/network_service_delegate.h | 14 | ||||
-rw-r--r-- | mojo/tools/mopy/gtest.py | 9 | ||||
-rw-r--r-- | sql/mojo/mojo_vfs.cc | 18 | ||||
-rw-r--r-- | sql/mojo/vfs_unittest.cc | 13 |
19 files changed, 22 insertions, 389 deletions
diff --git a/components/filesystem/file_system_impl.cc b/components/filesystem/file_system_impl.cc index 69d6330..cfd4cac 100644 --- a/components/filesystem/file_system_impl.cc +++ b/components/filesystem/file_system_impl.cc @@ -4,42 +4,16 @@ #include "components/filesystem/file_system_impl.h" -#include "base/command_line.h" #include "base/files/file_path.h" -#include "base/files/file_util.h" #include "base/files/scoped_file.h" #include "base/files/scoped_temp_dir.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "components/filesystem/directory_impl.h" #include "mojo/application/public/cpp/application_connection.h" -#include "url/gurl.h" - -#if defined(OS_WIN) -#include "base/base_paths_win.h" -#include "base/path_service.h" -#include "base/strings/utf_string_conversions.h" -#elif defined(OS_ANDROID) -#include "base/base_paths_android.h" -#include "base/path_service.h" -#elif defined(OS_LINUX) -#include "base/environment.h" -#include "base/nix/xdg_util.h" -#elif defined(OS_MACOSX) -#include "base/base_paths_mac.h" -#include "base/path_service.h" -#endif namespace filesystem { -namespace { - -const char kEscapeChar = ','; - -const char kUserDataDir[] = "user-data-dir"; - -} // namespace filesystem - FileSystemImpl::FileSystemImpl(mojo::ApplicationConnection* connection, mojo::InterfaceRequest<FileSystem> request) : remote_application_url_(connection->GetRemoteApplicationURL()), @@ -60,23 +34,8 @@ void FileSystemImpl::OpenFileSystem(const mojo::String& file_system, CHECK(temp_dir->CreateUniqueTempDir()); path = temp_dir->path(); } else if (file_system.get() == std::string("origin")) { - base::FilePath base_profile_dir = GetSystemProfileDir(); - - // Sanitize the url for disk access. - // - // TODO(erg): While it's currently impossible, we need to deal with http:// - // URLs that have a path. (Or make the decision that these file systems are - // path bound, not origin bound.) - std::string sanitized_origin; - BuildSanitizedOrigin(remote_application_url_, &sanitized_origin); - -#if defined(OS_WIN) - path = base_profile_dir.Append(base::UTF8ToWide(sanitized_origin)); -#else - path = base_profile_dir.Append(sanitized_origin); -#endif - if (!base::PathExists(path)) - base::CreateDirectory(path); + // TODO(erg): We should serve a persistent directory based on the + // subdirectory |remote_application_url_| of a profile directory. } if (!path.empty()) { @@ -87,67 +46,4 @@ void FileSystemImpl::OpenFileSystem(const mojo::String& file_system, } } -base::FilePath FileSystemImpl::GetSystemProfileDir() const { - base::FilePath path; - - base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - if (command_line->HasSwitch(kUserDataDir)) { - path = command_line->GetSwitchValuePath(kUserDataDir); - } else { -#if defined(OS_WIN) - CHECK(PathService::Get(base::DIR_LOCAL_APP_DATA, &path)); - path = path.Append(FILE_PATH_LITERAL("mandoline")); -#elif defined(OS_LINUX) - scoped_ptr<base::Environment> env(base::Environment::Create()); - base::FilePath config_dir( - base::nix::GetXDGDirectory(env.get(), - base::nix::kXdgConfigHomeEnvVar, - base::nix::kDotConfigDir)); - path = config_dir.Append("mandoline"); -#elif defined(OS_MACOSX) - CHECK(PathService::Get(base::DIR_APP_DATA, &path)); - path = path.Append("Mandoline Shell"); -#elif defined(OS_ANDROID) - CHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &path)); - path = path.Append(FILE_PATH_LITERAL("mandoline")); -#else - NOTIMPLEMENTED(); -#endif - } - - if (!base::PathExists(path)) - base::CreateDirectory(path); - - return path; -} - -void FileSystemImpl::BuildSanitizedOrigin( - const std::string& origin, - std::string* sanitized_origin) { - // We take the origin string, and encode it in a way safe for filesystem - // access. This is vaguely based on //net/tools/dump_cache/ - // url_to_filename_encoder.h; that file strips out schemes, and does weird - // things with subdirectories. We do follow the basic algorithm used there, - // including using ',' as our escape character. - for (size_t i = 0; i < origin.length(); ++i) { - unsigned char ch = origin[i]; - char encoded[3]; - int encoded_len; - if ((ch == '_') || (ch == '.') || (ch == '=') || (ch == '+') || - (ch == '-') || (('0' <= ch) && (ch <= '9')) || - (('A' <= ch) && (ch <= 'Z')) || (('a' <= ch) && (ch <= 'z'))) { - encoded[0] = ch; - encoded_len = 1; - } else { - encoded[0] = kEscapeChar; - encoded[1] = ch / 16; - encoded[1] += (encoded[1] >= 10) ? 'A' - 10 : '0'; - encoded[2] = ch % 16; - encoded[2] += (encoded[2] >= 10) ? 'A' - 10 : '0'; - encoded_len = 3; - } - sanitized_origin->append(encoded, encoded_len); - } -} - } // namespace filesystem diff --git a/components/filesystem/file_system_impl.h b/components/filesystem/file_system_impl.h index d3b5171..90ea77d 100644 --- a/components/filesystem/file_system_impl.h +++ b/components/filesystem/file_system_impl.h @@ -10,10 +10,6 @@ #include "mojo/public/cpp/bindings/interface_request.h" #include "mojo/public/cpp/bindings/strong_binding.h" -namespace base { -class FilePath; -} - namespace mojo { class ApplicationConnection; } @@ -27,25 +23,14 @@ class FileSystemImpl : public FileSystem { ~FileSystemImpl() override; // |Files| implementation: - - // Current valid values for |file_system| are "temp" for a temporary - // filesystem and "origin" for a persistent filesystem bound to the origin of - // the URL of the caller. + // We provide a "private" temporary file system as the default. In Debug + // builds, we also provide access to a common file system named "debug" + // (stored under ~/MojoDebug). void OpenFileSystem(const mojo::String& file_system, mojo::InterfaceRequest<Directory> directory, const OpenFileSystemCallback& callback) override; private: - // Gets the system specific toplevel profile directory. - base::FilePath GetSystemProfileDir() const; - - // Takes the origin string from |remote_application_url_|. - std::string GetOriginFromRemoteApplicationURL() const; - - // Sanitizes |origin| so it is an acceptable filesystem name. - void BuildSanitizedOrigin(const std::string& origin, - std::string* sanitized_origin); - const std::string remote_application_url_; mojo::StrongBinding<FileSystem> binding_; diff --git a/mandoline/services/core_services/core_services_application_delegate.cc b/mandoline/services/core_services/core_services_application_delegate.cc index e343060..fb7194c 100644 --- a/mandoline/services/core_services/core_services_application_delegate.cc +++ b/mandoline/services/core_services/core_services_application_delegate.cc @@ -125,7 +125,7 @@ void CoreServicesApplicationDelegate::StartApplication( delegate.reset(new mandoline::BrowserManager); else if (url == "mojo://clipboard/") delegate.reset(new clipboard::ClipboardApplicationDelegate); - else if (url == "mojo://filesystem/") + else if (url == "mojo://filesystem_service/") delegate.reset(new filesystem::FileSystemApp); else if (url == "mojo://network_service/") delegate.reset(new NetworkServiceDelegate); diff --git a/mojo/runner/BUILD.gn b/mojo/runner/BUILD.gn index 0cd0407..9f1136e 100644 --- a/mojo/runner/BUILD.gn +++ b/mojo/runner/BUILD.gn @@ -109,8 +109,6 @@ source_set("lib") { "init.h", "out_of_process_native_runner.cc", "out_of_process_native_runner.h", - "scoped_user_data_dir.cc", - "scoped_user_data_dir.h", "task_runners.cc", "task_runners.h", "url_resolver.cc", diff --git a/mojo/runner/child_process_host.cc b/mojo/runner/child_process_host.cc index c5c3621..c0fd2e3 100644 --- a/mojo/runner/child_process_host.cc +++ b/mojo/runner/child_process_host.cc @@ -98,7 +98,6 @@ void ChildProcessHost::DidStart(bool success) { bool ChildProcessHost::DoLaunch() { static const char* kForwardSwitches[] = { - switches::kUserDataDir, switches::kOverrideUseGLWithOSMesaForTests, switches::kTraceToConsole, switches::kV, diff --git a/mojo/runner/context.h b/mojo/runner/context.h index cf2d89d..78cd163 100644 --- a/mojo/runner/context.h +++ b/mojo/runner/context.h @@ -9,7 +9,6 @@ #include "base/macros.h" #include "mojo/edk/embedder/process_delegate.h" -#include "mojo/runner/scoped_user_data_dir.h" #include "mojo/runner/task_runners.h" #include "mojo/runner/url_resolver.h" #include "mojo/shell/application_manager.h" @@ -80,7 +79,6 @@ class Context : public shell::ApplicationManager::Delegate, void OnApplicationEnd(const GURL& url); - ScopedUserDataDir scoped_user_data_dir; std::set<GURL> app_urls_; scoped_ptr<TaskRunners> task_runners_; shell::ApplicationManager application_manager_; diff --git a/mojo/runner/scoped_user_data_dir.cc b/mojo/runner/scoped_user_data_dir.cc deleted file mode 100644 index 8709475..0000000 --- a/mojo/runner/scoped_user_data_dir.cc +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "mojo/runner/scoped_user_data_dir.h" - -#include "base/command_line.h" -#include "base/logging.h" -#include "mojo/runner/switches.h" - -namespace mojo { -namespace runner { - -ScopedUserDataDir::ScopedUserDataDir() { - base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - if (!command_line->HasSwitch(switches::kUseTemporaryUserDataDir)) - return; - - if (command_line->HasSwitch(switches::kUserDataDir)) { - // User should not specify a --user-data-dir manually when using - // --use-temporary-user-data-dir. The point of the flag is to let the - // mojo runner process manage the lifetime of the user data dir. - LOG(ERROR) << "Ignoring request to --use-temporary-user-data-dir because " - << "--user-data-dir was also specified."; - return; - } - - if (!temp_dir_.CreateUniqueTempDir()) { - LOG(ERROR) << "Failed to create a temporary user data dir."; - return; - } - - command_line->AppendSwitchPath(switches::kUserDataDir, temp_dir_.path()); -} - -ScopedUserDataDir::~ScopedUserDataDir() { -} - -} // namespace runner -} // namespace mojo diff --git a/mojo/runner/scoped_user_data_dir.h b/mojo/runner/scoped_user_data_dir.h deleted file mode 100644 index 01d8418..0000000 --- a/mojo/runner/scoped_user_data_dir.h +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef MOJO_RUNNER_SCOPED_USER_DATA_DIR_H_ -#define MOJO_RUNNER_SCOPED_USER_DATA_DIR_H_ - -#include "base/files/scoped_temp_dir.h" - -namespace mojo { -namespace runner { - -// A scoped class which owns a ScopedTempDir if --use-temporary-user-data-dir -// is set. If it is, also modifies the command line so that --user-data-dir -// points to the temporary dir. -class ScopedUserDataDir { - public: - ScopedUserDataDir(); - ~ScopedUserDataDir(); - - private: - base::ScopedTempDir temp_dir_; -}; - -} // namespace runner -} // namespace mojo - -#endif // MOJO_RUNNER_SCOPED_USER_DATA_DIR_H_ diff --git a/mojo/runner/switches.cc b/mojo/runner/switches.cc index f4290f6..1ed957e 100644 --- a/mojo/runner/switches.cc +++ b/mojo/runner/switches.cc @@ -50,12 +50,4 @@ const char kTraceStartup[] = "trace-startup"; // the first maps 'a' to 'b' and the second 'c' to 'd'. const char kURLMappings[] = "url-mappings"; -// When this is set, we create a temporary user data dir for the process, and -// add a flag so kUserDataDir points to it. -const char kUseTemporaryUserDataDir[] = "use-temporary-user-data-dir"; - -// Specifies the user data directory. This is the one directory which stores -// all persistent data. -const char kUserDataDir[] = "user-data-dir"; - } // namespace switches diff --git a/mojo/runner/switches.h b/mojo/runner/switches.h index 232c38a..a95a4b2 100644 --- a/mojo/runner/switches.h +++ b/mojo/runner/switches.h @@ -22,8 +22,6 @@ extern const char kMapOrigin[]; extern const char kOrigin[]; extern const char kTraceStartup[]; extern const char kURLMappings[]; -extern const char kUseTemporaryUserDataDir[]; -extern const char kUserDataDir[]; } // namespace switches diff --git a/mojo/services/network/BUILD.gn b/mojo/services/network/BUILD.gn index cbe0df6..2296d44 100644 --- a/mojo/services/network/BUILD.gn +++ b/mojo/services/network/BUILD.gn @@ -90,7 +90,6 @@ source_set("lib") { "//mojo/services/network/public/cpp", "//mojo/services/network/public/interfaces", "//net", - "//net:extras", "//net:http_server", "//url", "//sql/mojo", diff --git a/mojo/services/network/DEPS b/mojo/services/network/DEPS index 64f12dc..1b9f35f 100644 --- a/mojo/services/network/DEPS +++ b/mojo/services/network/DEPS @@ -1,10 +1,7 @@ include_rules = [ "+base", - "+components/filesystem/public/interfaces", "+mojo/application", "+mojo/common", "+mojo/services", - "+mojo/util", "+net", - "+sql", ] diff --git a/mojo/services/network/network_context.cc b/mojo/services/network/network_context.cc index b3ff3aa..32248ea 100644 --- a/mojo/services/network/network_context.cc +++ b/mojo/services/network/network_context.cc @@ -13,12 +13,9 @@ #include "base/path_service.h" #include "mojo/common/user_agent.h" #include "mojo/services/network/url_loader_impl.h" -#include "net/cookies/cookie_monster.h" -#include "net/extras/sqlite/sqlite_persistent_cookie_store.h" #include "net/log/net_log_util.h" #include "net/log/write_to_file_net_log_observer.h" #include "net/proxy/proxy_service.h" -#include "net/ssl/channel_id_service.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_builder.h" @@ -27,7 +24,7 @@ namespace mojo { namespace { // Logs network information to the specified file. const char kLogNetLog[] = "log-net-log"; -} // namespace +} class NetworkContext::MojoNetLog : public net::NetLog { public: @@ -75,10 +72,8 @@ NetworkContext::NetworkContext( url_request_context_->set_net_log(net_log_.get()); } -NetworkContext::NetworkContext( - const base::FilePath& base_path, - const scoped_refptr<base::SequencedTaskRunner>& background_task_runner) - : NetworkContext(MakeURLRequestContext(base_path, background_task_runner)) { +NetworkContext::NetworkContext(const base::FilePath& base_path) + : NetworkContext(MakeURLRequestContext(base_path)) { } NetworkContext::~NetworkContext() { @@ -112,8 +107,7 @@ size_t NetworkContext::GetURLLoaderCountForTesting() { // static scoped_ptr<net::URLRequestContext> NetworkContext::MakeURLRequestContext( - const base::FilePath& base_path, - const scoped_refptr<base::SequencedTaskRunner>& background_task_runner) { + const base::FilePath& base_path) { net::URLRequestContextBuilder builder; builder.set_accept_language("en-us,en"); builder.set_user_agent(mojo::common::GetUserAgent()); @@ -136,22 +130,6 @@ scoped_ptr<net::URLRequestContext> NetworkContext::MakeURLRequestContext( builder.EnableHttpCache(cache_params); builder.set_file_enabled(true); - if (background_task_runner) { - // TODO(erg): This only gets run on non-android system. Currently, any - // attempts from the network_service trying to access the filesystem break - // the apptests on android. (And only the apptests on android. Mandoline - // shell works fine on android, as does apptests on desktop.) - net::SQLitePersistentCookieStore* sqlite_store = - new net::SQLitePersistentCookieStore( - base::FilePath(FILE_PATH_LITERAL("Cookies")), - base::MessageLoop::current()->task_runner(), - background_task_runner, - false, // TODO(erg): Make RESTORED_SESSION_COOKIES configurable. - nullptr); - builder.SetCookieAndChannelIdStores( - new net::CookieMonster(sqlite_store, nullptr) , nullptr); - } - return make_scoped_ptr(builder.Build()); } diff --git a/mojo/services/network/network_context.h b/mojo/services/network/network_context.h index 17c7aa2..96e8d68 100644 --- a/mojo/services/network/network_context.h +++ b/mojo/services/network/network_context.h @@ -8,9 +8,7 @@ #include <set> #include "base/macros.h" -#include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" -#include "base/sequenced_task_runner.h" namespace base { class FilePath; @@ -28,9 +26,7 @@ class NetworkContext { public: explicit NetworkContext( scoped_ptr<net::URLRequestContext> url_request_context); - NetworkContext( - const base::FilePath& base_path, - const scoped_refptr<base::SequencedTaskRunner>& background_task_runner); + explicit NetworkContext(const base::FilePath& base_path); ~NetworkContext(); net::URLRequestContext* url_request_context() { @@ -47,8 +43,7 @@ class NetworkContext { size_t GetURLLoaderCountForTesting(); static scoped_ptr<net::URLRequestContext> MakeURLRequestContext( - const base::FilePath& base_path, - const scoped_refptr<base::SequencedTaskRunner>& background_task_runner); + const base::FilePath& base_path); class MojoNetLog; scoped_ptr<class MojoNetLog> net_log_; diff --git a/mojo/services/network/network_service_delegate.cc b/mojo/services/network/network_service_delegate.cc index 296e2a2..b3b1c8e 100644 --- a/mojo/services/network/network_service_delegate.cc +++ b/mojo/services/network/network_service_delegate.cc @@ -6,109 +6,23 @@ #include "base/at_exit.h" #include "base/base_paths.h" -#include "base/bind.h" -#include "base/command_line.h" #include "base/files/file_path.h" #include "base/message_loop/message_loop.h" #include "base/path_service.h" #include "mojo/application/public/cpp/application_connection.h" -#include "mojo/common/message_pump_mojo.h" #include "mojo/services/network/network_service_impl.h" #include "mojo/services/network/url_loader_factory_impl.h" -#include "mojo/util/capture_util.h" -#include "sql/mojo/mojo_vfs.h" -namespace { +NetworkServiceDelegate::NetworkServiceDelegate() : app_(nullptr) {} -const char kSQLThreadName[] = "SQL_IO_Thread"; -const char kUserDataDir[] = "user-data-dir"; - -// SQL blocks on the filesystem service, so perform all SQL functions on a -// separate thread. -class SQLThread : public base::Thread { - public: - SQLThread(filesystem::DirectoryPtr directory) - : base::Thread(kSQLThreadName), - directory_info_(directory.PassInterface().Pass()) { - base::Thread::Options options; - options.message_pump_factory = - base::Bind(&mojo::common::MessagePumpMojo::Create); - StartWithOptions(options); - } - ~SQLThread() override { Stop(); } - - void Init() override { - filesystem::DirectoryPtr directory; - directory.Bind(directory_info_.Pass()); - vfs_.reset(new sql::ScopedMojoFilesystemVFS(directory.Pass())); - } - - void CleanUp() override { - vfs_.reset(); - } - - private: - // Our VFS which wraps sqlite so that we can reuse the current sqlite code. - scoped_ptr<sql::ScopedMojoFilesystemVFS> vfs_; - - // This member is used to safely pass data from one thread to another. It is - // set in the constructor and is consumed in Init(). - mojo::InterfacePtrInfo<filesystem::Directory> directory_info_; - - DISALLOW_COPY_AND_ASSIGN(SQLThread); -}; - -} // namespace - -NetworkServiceDelegate::NetworkServiceDelegate() - : app_(nullptr) { -} - -NetworkServiceDelegate::~NetworkServiceDelegate() { -} +NetworkServiceDelegate::~NetworkServiceDelegate() {} void NetworkServiceDelegate::Initialize(mojo::ApplicationImpl* app) { app_ = app; - -#if !defined(OS_ANDROID) - // TODO(erg): The following doesn't work when running the android - // apptests. It works in the mandoline shell (on desktop and on android), and - // in the apptests on desktop. However, on android, whenever we make the call - // to OpenFileSystem, the entire mojo system hangs to the point where writes - // to stderr that previously would have printed to our console aren't. The - // apptests are also fairly resistant to being run under gdb on android. - mojo::URLRequestPtr request(mojo::URLRequest::New()); - request->url = mojo::String::From("mojo:filesystem"); - app_->ConnectToService(request.Pass(), &files_); - - filesystem::FileError error = filesystem::FILE_ERROR_FAILED; - filesystem::DirectoryPtr directory; - files_->OpenFileSystem("origin", GetProxy(&directory), mojo::Capture(&error)); - files_.WaitForIncomingResponse(); - - io_worker_thread_.reset(new SQLThread(directory.Pass())); -#endif - - // TODO(erg): Find everything else that writes to the filesystem and - // transition it to proxying mojo:filesystem. We shouldn't have any path - // calculation code here, but sadly need it until the transition is done. In - // the mean time, manually handle the user-data-dir switch (which gets set in - // tests) so that tests are writing to a temp dir. base::FilePath base_path; - const base::CommandLine* command_line = - base::CommandLine::ForCurrentProcess(); - if (command_line->HasSwitch(kUserDataDir)) { - base_path = command_line->GetSwitchValuePath(kUserDataDir); - } else { - CHECK(PathService::Get(base::DIR_TEMP, &base_path)); - base_path = base_path.Append(FILE_PATH_LITERAL("network_service")); - } - - scoped_refptr<base::SequencedTaskRunner> worker_thread; -#if !defined(OS_ANDROID) - worker_thread = io_worker_thread_->task_runner(); -#endif - context_.reset(new mojo::NetworkContext(base_path, worker_thread)); + CHECK(PathService::Get(base::DIR_TEMP, &base_path)); + base_path = base_path.Append(FILE_PATH_LITERAL("network_service")); + context_.reset(new mojo::NetworkContext(base_path)); } bool NetworkServiceDelegate::ConfigureIncomingConnection( @@ -124,10 +38,6 @@ void NetworkServiceDelegate::Quit() { // destruction and it is the last moment we know for sure that it is // running. context_.reset(); - - // Destroy the io worker thread here so that we can commit any pending - // cookies here. - io_worker_thread_.reset(); } void NetworkServiceDelegate::Create( diff --git a/mojo/services/network/network_service_delegate.h b/mojo/services/network/network_service_delegate.h index 3580648..2c1718f 100644 --- a/mojo/services/network/network_service_delegate.h +++ b/mojo/services/network/network_service_delegate.h @@ -5,8 +5,6 @@ #ifndef MOJO_SERVICES_NETWORK_NETWORK_SERVICE_DELEGATE_H_ #define MOJO_SERVICES_NETWORK_NETWORK_SERVICE_DELEGATE_H_ -#include "base/threading/thread.h" -#include "components/filesystem/public/interfaces/file_system.mojom.h" #include "mojo/application/public/cpp/application_delegate.h" #include "mojo/application/public/cpp/application_impl.h" #include "mojo/application/public/cpp/interface_factory.h" @@ -15,10 +13,6 @@ #include "mojo/services/network/public/interfaces/url_loader_factory.mojom.h" #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_ptr.h" -namespace sql { -class ScopedMojoFilesystemVFS; -} - class NetworkServiceDelegate : public mojo::ApplicationDelegate, public mojo::InterfaceFactory<mojo::NetworkService>, @@ -44,14 +38,6 @@ class NetworkServiceDelegate private: mojo::ApplicationImpl* app_; - - // A worker thread that blocks for file IO. - scoped_ptr<base::Thread> io_worker_thread_; - - // Our connection to the filesystem service, which stores our cookies and - // other data. - filesystem::FileSystemPtr files_; - scoped_ptr<mojo::NetworkContext> context_; }; diff --git a/mojo/tools/mopy/gtest.py b/mojo/tools/mopy/gtest.py index 189ae06..b72aad3 100644 --- a/mojo/tools/mopy/gtest.py +++ b/mojo/tools/mopy/gtest.py @@ -133,11 +133,10 @@ def _build_command_line(config, args, apptest): """Build the apptest command line. This value isn't executed on Android.""" paths = Paths(config) # On Linux, always run tests with xvfb, but not for --gtest_list_tests. - not_list_tests = not "--gtest_list_tests" in args - use_xvfb = config.target_os == Config.OS_LINUX and not_list_tests - xvfb_prefix = [paths.xvfb, paths.build_dir] if use_xvfb else [] - data_dir = ["--use-temporary-user-data-dir"] if not_list_tests else [] - return xvfb_prefix + [paths.mojo_runner] + data_dir + args + [apptest] + use_xvfb = (config.target_os == Config.OS_LINUX and + not "--gtest_list_tests" in args) + prefix = [paths.xvfb, paths.build_dir] if use_xvfb else [] + return prefix + [paths.mojo_runner] + args + [apptest] # TODO(msw): Determine proper test timeout durations (starting small). diff --git a/sql/mojo/mojo_vfs.cc b/sql/mojo/mojo_vfs.cc index 3ef67a1..6e38af9 100644 --- a/sql/mojo/mojo_vfs.cc +++ b/sql/mojo/mojo_vfs.cc @@ -6,7 +6,6 @@ #include "base/logging.h" #include "base/rand_util.h" -#include "base/strings/stringprintf.h" #include "components/filesystem/public/interfaces/file.mojom.h" #include "components/filesystem/public/interfaces/file_system.mojom.h" #include "components/filesystem/public/interfaces/types.mojom.h" @@ -246,25 +245,10 @@ int MojoVFSOpen(sqlite3_vfs* mojo_vfs, if (flags & SQLITE_OPEN_DELETEONCLOSE) open_flags |= filesystem::kDeleteOnClose; - mojo::String mojo_name; - if (name) { - // Don't let callers open the pattern of our temporary databases. When we - // open with a null name and SQLITE_OPEN_DELETEONCLOSE, we unlink the - // database after we open it. If we create a database here, close it - // normally, and then open the same file through the other path, we could - // delete the database. - CHECK(strncmp("Temp_", name, 5) != 0); - mojo_name = name; - } else { - DCHECK(flags & SQLITE_OPEN_DELETEONCLOSE); - static int temp_number = 0; - mojo_name = base::StringPrintf("Temp_%d.db", temp_number++); - } - // Grab the incoming file filesystem::FilePtr file_ptr; filesystem::FileError error = filesystem::FILE_ERROR_FAILED; - GetRootDirectory(mojo_vfs)->OpenFile(mojo_name, GetProxy(&file_ptr), + GetRootDirectory(mojo_vfs)->OpenFile(mojo::String(name), GetProxy(&file_ptr), open_flags, Capture(&error)); GetRootDirectory(mojo_vfs).WaitForIncomingResponse(); if (error != filesystem::FILE_ERROR_OK) { diff --git a/sql/mojo/vfs_unittest.cc b/sql/mojo/vfs_unittest.cc index db16638..8ca7c5c 100644 --- a/sql/mojo/vfs_unittest.cc +++ b/sql/mojo/vfs_unittest.cc @@ -115,19 +115,6 @@ TEST_F(VFSTest, NonexclusiveOpen) { file->pMethods->xClose(file2.get()); } -TEST_F(VFSTest, NullFilenameOpen) { - // Opening a file with a null filename should return a valid file object. - scoped_ptr<sqlite3_file> file(MakeFile()); - int out_flags; - int rc = vfs()->xOpen( - vfs(), nullptr, file.get(), - SQLITE_OPEN_DELETEONCLOSE | SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE, - &out_flags); - EXPECT_EQ(SQLITE_OK, rc); - - file->pMethods->xClose(file.get()); -} - TEST_F(VFSTest, DeleteOnClose) { { scoped_ptr<sqlite3_file> file(MakeFile()); |