OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef CONTENT_PUBLIC_BROWSER_UTILITY_PROCESS_MOJO_CLIENT_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_UTILITY_PROCESS_MOJO_CLIENT_H_ |
6 #define CONTENT_PUBLIC_BROWSER_UTILITY_PROCESS_MOJO_CLIENT_H_ | 6 #define CONTENT_PUBLIC_BROWSER_UTILITY_PROCESS_MOJO_CLIENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 } | 49 } |
50 | 50 |
51 // Starts the utility process and connect to the remote Mojo service. | 51 // Starts the utility process and connect to the remote Mojo service. |
52 void Start() { | 52 void Start() { |
53 DCHECK(thread_checker_.CalledOnValidThread()); | 53 DCHECK(thread_checker_.CalledOnValidThread()); |
54 DCHECK(!on_error_callback_.is_null()); | 54 DCHECK(!on_error_callback_.is_null()); |
55 DCHECK(!start_called_); | 55 DCHECK(!start_called_); |
56 | 56 |
57 start_called_ = true; | 57 start_called_ = true; |
58 | 58 |
59 mojo::InterfaceRequest<MojoInterface> req = mojo::MakeRequest(&service_); | 59 mojo::InterfaceRequest<MojoInterface> req(&service_); |
60 service_.set_connection_error_handler(on_error_callback_); | 60 service_.set_connection_error_handler(on_error_callback_); |
61 helper_->Start(MojoInterface::Name_, req.PassMessagePipe()); | 61 helper_->Start(MojoInterface::Name_, req.PassMessagePipe()); |
62 } | 62 } |
63 | 63 |
64 // Returns the Mojo service used to make calls to the utility process. | 64 // Returns the Mojo service used to make calls to the utility process. |
65 MojoInterface* service() WARN_UNUSED_RESULT { | 65 MojoInterface* service() WARN_UNUSED_RESULT { |
66 DCHECK(thread_checker_.CalledOnValidThread()); | 66 DCHECK(thread_checker_.CalledOnValidThread()); |
67 DCHECK(start_called_); | 67 DCHECK(start_called_); |
68 | 68 |
69 return service_.get(); | 69 return service_.get(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 134 |
135 // Checks that this class is always accessed from the same thread. | 135 // Checks that this class is always accessed from the same thread. |
136 base::ThreadChecker thread_checker_; | 136 base::ThreadChecker thread_checker_; |
137 | 137 |
138 DISALLOW_COPY_AND_ASSIGN(UtilityProcessMojoClient); | 138 DISALLOW_COPY_AND_ASSIGN(UtilityProcessMojoClient); |
139 }; | 139 }; |
140 | 140 |
141 } // namespace content | 141 } // namespace content |
142 | 142 |
143 #endif // CONTENT_PUBLIC_BROWSER_UTILITY_PROCESS_MOJO_CLIENT_H_ | 143 #endif // CONTENT_PUBLIC_BROWSER_UTILITY_PROCESS_MOJO_CLIENT_H_ |
OLD | NEW |