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

Side by Side Diff: remoting/host/it2me/it2me_native_messaging_host_main.cc

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU Created 4 years, 8 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 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 "remoting/host/it2me/it2me_native_messaging_host_main.h" 5 #include "remoting/host/it2me/it2me_native_messaging_host_main.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/at_exit.h" 9 #include "base/at_exit.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // The files are automatically closed. 110 // The files are automatically closed.
111 base::File read_file(STDIN_FILENO); 111 base::File read_file(STDIN_FILENO);
112 base::File write_file(STDOUT_FILENO); 112 base::File write_file(STDOUT_FILENO);
113 #else 113 #else
114 #error Not implemented. 114 #error Not implemented.
115 #endif 115 #endif
116 116
117 base::MessageLoopForUI message_loop; 117 base::MessageLoopForUI message_loop;
118 base::RunLoop run_loop; 118 base::RunLoop run_loop;
119 119
120 scoped_ptr<It2MeHostFactory> factory(new It2MeHostFactory()); 120 std::unique_ptr<It2MeHostFactory> factory(new It2MeHostFactory());
121 121
122 scoped_ptr<NativeMessagingPipe> native_messaging_pipe( 122 std::unique_ptr<NativeMessagingPipe> native_messaging_pipe(
123 new NativeMessagingPipe()); 123 new NativeMessagingPipe());
124 124
125 // Set up the native messaging channel. 125 // Set up the native messaging channel.
126 scoped_ptr<extensions::NativeMessagingChannel> channel( 126 std::unique_ptr<extensions::NativeMessagingChannel> channel(
127 new PipeMessagingChannel(std::move(read_file), std::move(write_file))); 127 new PipeMessagingChannel(std::move(read_file), std::move(write_file)));
128 128
129 scoped_ptr<ChromotingHostContext> context = 129 std::unique_ptr<ChromotingHostContext> context =
130 ChromotingHostContext::Create(new remoting::AutoThreadTaskRunner( 130 ChromotingHostContext::Create(new remoting::AutoThreadTaskRunner(
131 message_loop.task_runner(), run_loop.QuitClosure())); 131 message_loop.task_runner(), run_loop.QuitClosure()));
132 scoped_ptr<extensions::NativeMessageHost> host( 132 std::unique_ptr<extensions::NativeMessageHost> host(
133 new It2MeNativeMessagingHost(std::move(context), std::move(factory))); 133 new It2MeNativeMessagingHost(std::move(context), std::move(factory)));
134 134
135 host->Start(native_messaging_pipe.get()); 135 host->Start(native_messaging_pipe.get());
136 136
137 native_messaging_pipe->Start(std::move(host), std::move(channel)); 137 native_messaging_pipe->Start(std::move(host), std::move(channel));
138 138
139 // Run the loop until channel is alive. 139 // Run the loop until channel is alive.
140 run_loop.Run(); 140 run_loop.Run();
141 141
142 return kSuccessExitCode; 142 return kSuccessExitCode;
143 } 143 }
144 144
145 int It2MeNativeMessagingHostMain(int argc, char** argv) { 145 int It2MeNativeMessagingHostMain(int argc, char** argv) {
146 // This object instance is required by Chrome code (such as MessageLoop). 146 // This object instance is required by Chrome code (such as MessageLoop).
147 base::AtExitManager exit_manager; 147 base::AtExitManager exit_manager;
148 148
149 base::CommandLine::Init(argc, argv); 149 base::CommandLine::Init(argc, argv);
150 remoting::InitHostLogging(); 150 remoting::InitHostLogging();
151 151
152 return StartIt2MeNativeMessagingHost(); 152 return StartIt2MeNativeMessagingHost();
153 } 153 }
154 154
155 } // namespace remoting 155 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/it2me/it2me_native_messaging_host.cc ('k') | remoting/host/it2me/it2me_native_messaging_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698