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

Side by Side Diff: remoting/host/setup/test_util.cc

Issue 1830433002: Adding the message writing class used for remote_security_key STDOUT communication. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@messages
Patch Set: Integrating security message changes Created 4 years, 9 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 "build/build_config.h" 5 #include "build/build_config.h"
6 #include "remoting/host/setup/test_util.h" 6 #include "remoting/host/setup/test_util.h"
7 7
8 #if defined(OS_WIN) 8 #if defined(OS_WIN)
9 #include <windows.h> 9 #include <windows.h>
10 #elif defined(OS_POSIX) 10 #elif defined(OS_POSIX)
11 #include <unistd.h> 11 #include <unistd.h>
12 #endif 12 #endif
13 13
14 namespace remoting { 14 namespace remoting {
15 15
16 bool MakePipe(base::File* read_file, 16 bool MakePipe(base::File* read_file,
17 base::File* write_file) { 17 base::File* write_file) {
18 return MakePipe(read_file, write_file, 0);
19 }
20
21 bool MakePipe(base::File* read_file,
22 base::File* write_file,
23 unsigned int buffer_size_bytes) {
Sergey Ulanov 2016/03/28 18:26:43 This parameter is windows-specific. I suggest wrap
joedow 2016/03/29 22:14:14 Acknowledged.
18 #if defined(OS_WIN) 24 #if defined(OS_WIN)
19 base::PlatformFile read_handle; 25 base::PlatformFile read_handle;
20 base::PlatformFile write_handle; 26 base::PlatformFile write_handle;
21 if (!CreatePipe(&read_handle, &write_handle, nullptr, 0)) 27 if (!CreatePipe(&read_handle, &write_handle, nullptr, buffer_size_bytes))
22 return false; 28 return false;
23 *read_file = base::File(read_handle); 29 *read_file = base::File(read_handle);
24 *write_file = base::File(write_handle); 30 *write_file = base::File(write_handle);
25 return true; 31 return true;
26 #elif defined(OS_POSIX) 32 #elif defined(OS_POSIX)
27 int fds[2]; 33 int fds[2];
28 if (pipe(fds) == 0) { 34 if (pipe(fds) == 0) {
29 *read_file = base::File(fds[0]); 35 *read_file = base::File(fds[0]);
30 *write_file = base::File(fds[1]); 36 *write_file = base::File(fds[1]);
31 return true; 37 return true;
32 } 38 }
33 return false; 39 return false;
34 #else 40 #else
35 #error Not implemented 41 #error Not implemented
36 #endif 42 #endif
37 } 43 }
38 44
39 } // namepsace remoting 45 } // namepsace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698