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

Side by Side Diff: ipc/ipc_channel.cc

Issue 10546140: Add untrusted NaCl build for PPAPI proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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 | « build/all.gyp ('k') | ipc/ipc_untrusted.gyp » ('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 #include "ipc/ipc_channel.h" 5 #include "ipc/ipc_channel.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/atomic_sequence_num.h" 9 #include "base/atomic_sequence_num.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 12 matching lines...) Expand all
23 // static 23 // static
24 std::string Channel::GenerateUniqueRandomChannelID() { 24 std::string Channel::GenerateUniqueRandomChannelID() {
25 // Note: the string must start with the current process id, this is how 25 // Note: the string must start with the current process id, this is how
26 // some child processes determine the pid of the parent. 26 // some child processes determine the pid of the parent.
27 // 27 //
28 // This is composed of a unique incremental identifier, the process ID of 28 // This is composed of a unique incremental identifier, the process ID of
29 // the creator, an identifier for the child instance, and a strong random 29 // the creator, an identifier for the child instance, and a strong random
30 // component. The strong random component prevents other processes from 30 // component. The strong random component prevents other processes from
31 // hijacking or squatting on predictable channel names. 31 // hijacking or squatting on predictable channel names.
32 32
33 int process_id;
34 #if !defined(OS_NACL) 33 #if !defined(OS_NACL)
35 process_id = base::GetCurrentProcId(); 34 int process_id = base::GetCurrentProcId();
36 #else
37 process_id = 0;
38 #endif
39 return base::StringPrintf("%d.%u.%d", 35 return base::StringPrintf("%d.%u.%d",
40 process_id, 36 process_id,
41 g_last_id.GetNext(), 37 g_last_id.GetNext(),
42 base::RandInt(0, std::numeric_limits<int32>::max())); 38 base::RandInt(0, std::numeric_limits<int32>::max()));
39 #else
40 return std::string();
41 #endif
43 } 42 }
44 43
45 } // namespace IPC 44 } // namespace IPC
46 45
OLDNEW
« no previous file with comments | « build/all.gyp ('k') | ipc/ipc_untrusted.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698