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

Side by Side Diff: services/service_manager/standalone/context.cc

Issue 2525073002: Initialize TaskScheduler in Mash. (Closed)
Patch Set: shared constant for max num threads Created 4 years 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 | « services/service_manager/standalone/context.h ('k') | no next file » | 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 "services/service_manager/standalone/context.h" 5 #include "services/service_manager/standalone/context.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 class Setup { 67 class Setup {
68 public: 68 public:
69 Setup() { mojo::edk::Init(); } 69 Setup() { mojo::edk::Init(); }
70 70
71 ~Setup() {} 71 ~Setup() {}
72 72
73 private: 73 private:
74 DISALLOW_COPY_AND_ASSIGN(Setup); 74 DISALLOW_COPY_AND_ASSIGN(Setup);
75 }; 75 };
76 76
77 const size_t kMaxBlockingPoolThreads = 3;
78
79 std::unique_ptr<base::Thread> CreateIOThread(const char* name) { 77 std::unique_ptr<base::Thread> CreateIOThread(const char* name) {
80 std::unique_ptr<base::Thread> thread(new base::Thread(name)); 78 std::unique_ptr<base::Thread> thread(new base::Thread(name));
81 base::Thread::Options options; 79 base::Thread::Options options;
82 options.message_loop_type = base::MessageLoop::TYPE_IO; 80 options.message_loop_type = base::MessageLoop::TYPE_IO;
83 thread->StartWithOptions(options); 81 thread->StartWithOptions(options);
84 return thread; 82 return thread;
85 } 83 }
86 84
87 void OnInstanceQuit(const std::string& name, const Identity& identity) { 85 void OnInstanceQuit(const std::string& name, const Identity& identity) {
88 if (name == identity.name()) 86 if (name == identity.name())
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 tracer_.Start( 119 tracer_.Start(
122 command_line.GetSwitchValueASCII(::switches::kTraceStartup), 120 command_line.GetSwitchValueASCII(::switches::kTraceStartup),
123 command_line.GetSwitchValueASCII(::switches::kTraceStartupDuration), 121 command_line.GetSwitchValueASCII(::switches::kTraceStartupDuration),
124 "mojo_runner.trace"); 122 "mojo_runner.trace");
125 } 123 }
126 124
127 if (!init_params || init_params->init_edk) 125 if (!init_params || init_params->init_edk)
128 EnsureEmbedderIsInitialized(); 126 EnsureEmbedderIsInitialized();
129 127
130 service_manager_runner_ = base::ThreadTaskRunnerHandle::Get(); 128 service_manager_runner_ = base::ThreadTaskRunnerHandle::Get();
131 blocking_pool_ = 129 blocking_pool_ = new base::SequencedWorkerPool(
132 new base::SequencedWorkerPool(kMaxBlockingPoolThreads, "blocking_pool", 130 kThreadPoolMaxThreads, "blocking_pool", base::TaskPriority::USER_VISIBLE);
133 base::TaskPriority::USER_VISIBLE);
134 131
135 init_edk_ = !init_params || init_params->init_edk; 132 init_edk_ = !init_params || init_params->init_edk;
136 if (init_edk_) { 133 if (init_edk_) {
137 mojo::edk::InitIPCSupport(this, io_thread_->task_runner().get()); 134 mojo::edk::InitIPCSupport(this, io_thread_->task_runner().get());
138 #if defined(OS_MACOSX) 135 #if defined(OS_MACOSX)
139 mojo::edk::SetMachPortProvider(MachBroker::GetInstance()->port_provider()); 136 mojo::edk::SetMachPortProvider(MachBroker::GetInstance()->port_provider());
140 #endif 137 #endif
141 } 138 }
142 139
143 std::unique_ptr<NativeRunnerFactory> runner_factory; 140 std::unique_ptr<NativeRunnerFactory> runner_factory;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 mojom::InterfaceProviderPtr local_interfaces; 256 mojom::InterfaceProviderPtr local_interfaces;
260 257
261 std::unique_ptr<ConnectParams> params(new ConnectParams); 258 std::unique_ptr<ConnectParams> params(new ConnectParams);
262 params->set_source(CreateServiceManagerIdentity()); 259 params->set_source(CreateServiceManagerIdentity());
263 params->set_target(Identity(name, mojom::kRootUserID)); 260 params->set_target(Identity(name, mojom::kRootUserID));
264 params->set_remote_interfaces(mojo::GetProxy(&remote_interfaces)); 261 params->set_remote_interfaces(mojo::GetProxy(&remote_interfaces));
265 service_manager_->Connect(std::move(params)); 262 service_manager_->Connect(std::move(params));
266 } 263 }
267 264
268 } // namespace service_manager 265 } // namespace service_manager
OLDNEW
« no previous file with comments | « services/service_manager/standalone/context.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698