| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/common/child_process_info.h" | 5 #include "chrome/common/child_process_info.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" |
| 9 #include "base/logging.h" | 10 #include "base/logging.h" |
| 10 #include "base/process_util.h" | 11 #include "base/process_util.h" |
| 11 #include "base/rand_util.h" | 12 #include "base/rand_util.h" |
| 12 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 13 #include "chrome/common/l10n_util.h" | |
| 14 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
| 15 | 15 |
| 16 std::wstring ChildProcessInfo::GetTypeNameInEnglish( | 16 std::wstring ChildProcessInfo::GetTypeNameInEnglish( |
| 17 ChildProcessInfo::ProcessType type) { | 17 ChildProcessInfo::ProcessType type) { |
| 18 switch (type) { | 18 switch (type) { |
| 19 case BROWSER_PROCESS: | 19 case BROWSER_PROCESS: |
| 20 return L"Browser"; | 20 return L"Browser"; |
| 21 case RENDER_PROCESS: | 21 case RENDER_PROCESS: |
| 22 return L"Tab"; | 22 return L"Tab"; |
| 23 case PLUGIN_PROCESS: | 23 case PLUGIN_PROCESS: |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // Note: the string must start with the current process id, this is how | 71 // Note: the string must start with the current process id, this is how |
| 72 // child processes determine the pid of the parent. | 72 // child processes determine the pid of the parent. |
| 73 // Build the channel ID. This is composed of a unique identifier for the | 73 // Build the channel ID. This is composed of a unique identifier for the |
| 74 // parent browser process, an identifier for the child instance, and a random | 74 // parent browser process, an identifier for the child instance, and a random |
| 75 // component. We use a random component so that a hacked child process can't | 75 // component. We use a random component so that a hacked child process can't |
| 76 // cause denial of service by causing future named pipe creation to fail. | 76 // cause denial of service by causing future named pipe creation to fail. |
| 77 return StringPrintf(L"%d.%x.%d", | 77 return StringPrintf(L"%d.%x.%d", |
| 78 base::GetCurrentProcId(), instance, | 78 base::GetCurrentProcId(), instance, |
| 79 base::RandInt(0, std::numeric_limits<int>::max())); | 79 base::RandInt(0, std::numeric_limits<int>::max())); |
| 80 } | 80 } |
| OLD | NEW |