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

Side by Side Diff: ipc/ipc_channel_win.h

Issue 9968111: Make IPC channels track their peer process ID (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « ipc/ipc_channel_proxy.cc ('k') | ipc/ipc_channel_win.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_WIN_H_ 5 #ifndef IPC_IPC_CHANNEL_WIN_H_
6 #define IPC_IPC_CHANNEL_WIN_H_ 6 #define IPC_IPC_CHANNEL_WIN_H_
7 #pragma once 7 #pragma once
8 8
9 #include "ipc/ipc_channel.h" 9 #include "ipc/ipc_channel.h"
10 10
(...skipping 15 matching lines...) Expand all
26 public MessageLoopForIO::IOHandler { 26 public MessageLoopForIO::IOHandler {
27 public: 27 public:
28 // Mirror methods of Channel, see ipc_channel.h for description. 28 // Mirror methods of Channel, see ipc_channel.h for description.
29 ChannelImpl(const IPC::ChannelHandle &channel_handle, Mode mode, 29 ChannelImpl(const IPC::ChannelHandle &channel_handle, Mode mode,
30 Listener* listener); 30 Listener* listener);
31 ~ChannelImpl(); 31 ~ChannelImpl();
32 bool Connect(); 32 bool Connect();
33 void Close(); 33 void Close();
34 bool Send(Message* message); 34 bool Send(Message* message);
35 static bool IsNamedServerInitialized(const std::string& channel_id); 35 static bool IsNamedServerInitialized(const std::string& channel_id);
36 base::ProcessId peer_pid() const { return peer_pid_; }
36 37
37 private: 38 private:
38 // ChannelReader implementation. 39 // ChannelReader implementation.
39 virtual ReadState ReadData(char* buffer, 40 virtual ReadState ReadData(char* buffer,
40 int buffer_len, 41 int buffer_len,
41 int* bytes_read) OVERRIDE; 42 int* bytes_read) OVERRIDE;
42 virtual bool WillDispatchInputMessage(Message* msg) OVERRIDE; 43 virtual bool WillDispatchInputMessage(Message* msg) OVERRIDE;
43 bool DidEmptyInputBuffers() OVERRIDE; 44 bool DidEmptyInputBuffers() OVERRIDE;
44 virtual void HandleHelloMessage(const Message& msg) OVERRIDE; 45 virtual void HandleHelloMessage(const Message& msg) OVERRIDE;
45 46
(...skipping 14 matching lines...) Expand all
60 ~State(); 61 ~State();
61 MessageLoopForIO::IOContext context; 62 MessageLoopForIO::IOContext context;
62 bool is_pending; 63 bool is_pending;
63 }; 64 };
64 65
65 State input_state_; 66 State input_state_;
66 State output_state_; 67 State output_state_;
67 68
68 HANDLE pipe_; 69 HANDLE pipe_;
69 70
71 base::ProcessId peer_pid_;
72
70 // Messages to be sent are queued here. 73 // Messages to be sent are queued here.
71 std::queue<Message*> output_queue_; 74 std::queue<Message*> output_queue_;
72 75
73 // In server-mode, we have to wait for the client to connect before we 76 // In server-mode, we have to wait for the client to connect before we
74 // can begin reading. We make use of the input_state_ when performing 77 // can begin reading. We make use of the input_state_ when performing
75 // the connect operation in overlapped mode. 78 // the connect operation in overlapped mode.
76 bool waiting_connect_; 79 bool waiting_connect_;
77 80
78 // This flag is set when processing incoming messages. It is used to 81 // This flag is set when processing incoming messages. It is used to
79 // avoid recursing through ProcessIncomingMessages, which could cause 82 // avoid recursing through ProcessIncomingMessages, which could cause
(...skipping 13 matching lines...) Expand all
93 base::WeakPtrFactory<ChannelImpl> weak_factory_; 96 base::WeakPtrFactory<ChannelImpl> weak_factory_;
94 97
95 scoped_ptr<base::NonThreadSafe> thread_check_; 98 scoped_ptr<base::NonThreadSafe> thread_check_;
96 99
97 DISALLOW_COPY_AND_ASSIGN(ChannelImpl); 100 DISALLOW_COPY_AND_ASSIGN(ChannelImpl);
98 }; 101 };
99 102
100 } // namespace IPC 103 } // namespace IPC
101 104
102 #endif // IPC_IPC_CHANNEL_WIN_H_ 105 #endif // IPC_IPC_CHANNEL_WIN_H_
OLDNEW
« no previous file with comments | « ipc/ipc_channel_proxy.cc ('k') | ipc/ipc_channel_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698