OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_PUBLIC_COMMON_SERVICE_INFO_H_ |
| 6 #define CONTENT_PUBLIC_COMMON_SERVICE_INFO_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/callback.h" |
| 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/single_thread_task_runner.h" |
| 13 #include "content/common/content_export.h" |
| 14 |
| 15 namespace shell { |
| 16 class Service; |
| 17 } |
| 18 |
| 19 namespace content { |
| 20 |
| 21 // ServiceInfo provides details necessary to construct and bind new instances |
| 22 // of embedded services. |
| 23 struct CONTENT_EXPORT ServiceInfo { |
| 24 using ServiceFactory = base::Callback<std::unique_ptr<shell::Service>( |
| 25 const base::Closure& quit_closure)>; |
| 26 |
| 27 ServiceInfo(); |
| 28 ServiceInfo(const ServiceInfo& other); |
| 29 ~ServiceInfo(); |
| 30 |
| 31 // A factory function which will be called to produce a new Service |
| 32 // instance for this service whenever one is needed. |
| 33 ServiceFactory factory; |
| 34 |
| 35 // The task runner on which to construct and bind new Service instances |
| 36 // for this service. If null, behavior depends on the value of |
| 37 // |use_own_thread| below. |
| 38 scoped_refptr<base::SingleThreadTaskRunner> task_runner; |
| 39 |
| 40 // If |task_runner| is null, setting this to |true| will give each instance of |
| 41 // this service its own thread to run on. Setting this to |false| (the |
| 42 // default) will instead run the service on the main thread's task runner. |
| 43 // |
| 44 // If |task_runner| is not null, this value is ignored. |
| 45 bool use_own_thread = false; |
| 46 }; |
| 47 |
| 48 } // namespace content |
| 49 |
| 50 #endif // CONTENT_PUBLIC_COMMON_SERVICE_INFO_H_ |
OLD | NEW |