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

Side by Side Diff: ipc/ipc_channel_handle.h

Issue 2301103003: Use ChannelMojo for NaCl PPAPI channels. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « ipc/ipc_channel_common.cc ('k') | ppapi/nacl_irt/plugin_startup.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 ChannelHandle(const std::string& n) : name(n) {} 43 ChannelHandle(const std::string& n) : name(n) {}
44 ChannelHandle(const char* n) : name(n) {} 44 ChannelHandle(const char* n) : name(n) {}
45 #if defined(OS_WIN) 45 #if defined(OS_WIN)
46 explicit ChannelHandle(HANDLE h) : pipe(h) {} 46 explicit ChannelHandle(HANDLE h) : pipe(h) {}
47 #elif defined(OS_POSIX) 47 #elif defined(OS_POSIX)
48 ChannelHandle(const std::string& n, const base::FileDescriptor& s) 48 ChannelHandle(const std::string& n, const base::FileDescriptor& s)
49 : name(n), socket(s) {} 49 : name(n), socket(s) {}
50 #endif // defined(OS_POSIX) 50 #endif // defined(OS_POSIX)
51 ChannelHandle(mojo::MessagePipeHandle h) : mojo_handle(h) {} 51 ChannelHandle(mojo::MessagePipeHandle h) : mojo_handle(h) {}
52 52
53 bool is_mojo_channel_handle() const {
54 #if defined(OS_WIN)
55 if (pipe.handle)
56 return false;
57 #elif defined(OS_POSIX)
58 if (socket.fd != -1)
59 return false;
60 #endif // defined(OS_POSIX)
61 return mojo_handle.is_valid() && name.empty();
62 }
63
53 std::string name; 64 std::string name;
54 #if defined(OS_POSIX) 65 #if defined(OS_POSIX)
55 base::FileDescriptor socket; 66 base::FileDescriptor socket;
56 #elif defined(OS_WIN) 67 #elif defined(OS_WIN)
57 // A simple container to automatically initialize pipe handle 68 // A simple container to automatically initialize pipe handle
58 struct PipeHandle { 69 struct PipeHandle {
59 PipeHandle() : handle(NULL) {} 70 PipeHandle() : handle(NULL) {}
60 PipeHandle(HANDLE h) : handle(h) {} 71 PipeHandle(HANDLE h) : handle(h) {}
61 HANDLE handle; 72 HANDLE handle;
62 }; 73 };
63 PipeHandle pipe; 74 PipeHandle pipe;
64 #endif // defined (OS_WIN) 75 #endif // defined (OS_WIN)
65 mojo::MessagePipeHandle mojo_handle; 76 mojo::MessagePipeHandle mojo_handle;
66 }; 77 };
67 78
68 } // namespace IPC 79 } // namespace IPC
69 80
70 #endif // IPC_IPC_CHANNEL_HANDLE_H_ 81 #endif // IPC_IPC_CHANNEL_HANDLE_H_
OLDNEW
« no previous file with comments | « ipc/ipc_channel_common.cc ('k') | ppapi/nacl_irt/plugin_startup.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698