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

Side by Side Diff: ipc/ipc_channel_handle.h

Issue 555503007: Cleanup: Get rid of OS_WIN/OS_POSIX ifdefs from MojoApplication (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated Created 6 years, 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 IPC_IPC_CHANNEL_HANDLE_H_ 5 #ifndef IPC_IPC_CHANNEL_HANDLE_H_
6 #define IPC_IPC_CHANNEL_HANDLE_H_ 6 #define IPC_IPC_CHANNEL_HANDLE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/files/platform_file.h"
10 #include "build/build_config.h" 11 #include "build/build_config.h"
11 12
12 #if defined(OS_POSIX) 13 #if defined(OS_POSIX)
13 #include "base/file_descriptor_posix.h" 14 #include "base/file_descriptor_posix.h"
14 #elif defined(OS_WIN) 15 #elif defined(OS_WIN)
15 #include <windows.h> 16 #include <windows.h>
16 #endif // defined (OS_WIN) 17 #endif // defined (OS_WIN)
17 18
18 // On Windows, any process can create an IPC channel and others can fetch 19 // On Windows, any process can create an IPC channel and others can fetch
19 // it by name. We pass around the channel names over IPC. 20 // it by name. We pass around the channel names over IPC.
(...skipping 24 matching lines...) Expand all
44 #if defined(OS_WIN) 45 #if defined(OS_WIN)
45 explicit ChannelHandle(HANDLE h) : pipe(h) {} 46 explicit ChannelHandle(HANDLE h) : pipe(h) {}
46 #elif defined(OS_POSIX) 47 #elif defined(OS_POSIX)
47 ChannelHandle(const std::string& n, const base::FileDescriptor& s) 48 ChannelHandle(const std::string& n, const base::FileDescriptor& s)
48 : name(n), socket(s) {} 49 : name(n), socket(s) {}
49 #endif // defined(OS_POSIX) 50 #endif // defined(OS_POSIX)
50 51
51 std::string name; 52 std::string name;
52 #if defined(OS_POSIX) 53 #if defined(OS_POSIX)
53 base::FileDescriptor socket; 54 base::FileDescriptor socket;
55
56 base::PlatformFile platform_file() const { return socket.fd; }
54 #elif defined(OS_WIN) 57 #elif defined(OS_WIN)
55 // A simple container to automatically initialize pipe handle 58 // A simple container to automatically initialize pipe handle
56 struct PipeHandle { 59 struct PipeHandle {
57 PipeHandle() : handle(NULL) {} 60 PipeHandle() : handle(NULL) {}
58 PipeHandle(HANDLE h) : handle(h) {} 61 PipeHandle(HANDLE h) : handle(h) {}
59 HANDLE handle; 62 HANDLE handle;
60 }; 63 };
61 PipeHandle pipe; 64 PipeHandle pipe;
65
66 base::PlatformFile platform_file() const { return pipe.handle; }
62 #endif // defined (OS_WIN) 67 #endif // defined (OS_WIN)
63 }; 68 };
64 69
65 } // namespace IPC 70 } // namespace IPC
66 71
67 #endif // IPC_IPC_CHANNEL_HANDLE_H_ 72 #endif // IPC_IPC_CHANNEL_HANDLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698