| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_BROWSER_RENDER_PROCESS_HOST_H_ | 5 #ifndef CHROME_BROWSER_RENDER_PROCESS_HOST_H_ |
| 6 #define CHROME_BROWSER_RENDER_PROCESS_HOST_H_ | 6 #define CHROME_BROWSER_RENDER_PROCESS_HOST_H_ |
| 7 | 7 |
| 8 #include <limits> |
| 8 #include <set> | 9 #include <set> |
| 9 #include <vector> | 10 #include <vector> |
| 10 #include <windows.h> | 11 #include <windows.h> |
| 11 | 12 |
| 12 #include "base/id_map.h" | 13 #include "base/id_map.h" |
| 13 #include "base/object_watcher.h" | 14 #include "base/object_watcher.h" |
| 14 #include "base/process.h" | 15 #include "base/process.h" |
| 16 #include "base/rand_util.h" |
| 15 #include "base/ref_counted.h" | 17 #include "base/ref_counted.h" |
| 16 #include "base/scoped_handle.h" | 18 #include "base/scoped_handle.h" |
| 17 #include "base/scoped_ptr.h" | 19 #include "base/scoped_ptr.h" |
| 18 #include "chrome/common/ipc_sync_channel.h" | 20 #include "chrome/common/ipc_sync_channel.h" |
| 19 #include "chrome/common/notification_service.h" | 21 #include "chrome/common/notification_service.h" |
| 20 #include "chrome/common/rand_util.h" | |
| 21 #include "chrome/common/render_messages.h" | 22 #include "chrome/common/render_messages.h" |
| 22 | 23 |
| 23 class PrefService; | 24 class PrefService; |
| 24 class Profile; | 25 class Profile; |
| 25 class RenderWidgetHelper; | 26 class RenderWidgetHelper; |
| 26 class WebContents; | 27 class WebContents; |
| 27 | 28 |
| 28 namespace base { | 29 namespace base { |
| 29 class Thread; | 30 class Thread; |
| 30 } | 31 } |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 inline std::wstring GenerateRandomChannelID(void* instance) { | 265 inline std::wstring GenerateRandomChannelID(void* instance) { |
| 265 // Note: the string must start with the current process id, this is how | 266 // Note: the string must start with the current process id, this is how |
| 266 // child processes determine the pid of the parent. | 267 // child processes determine the pid of the parent. |
| 267 // Build the channel ID. This is composed of a unique identifier for the | 268 // Build the channel ID. This is composed of a unique identifier for the |
| 268 // parent browser process, an identifier for the renderer/plugin instance, | 269 // parent browser process, an identifier for the renderer/plugin instance, |
| 269 // and a random component. We use a random component so that a hacked child | 270 // and a random component. We use a random component so that a hacked child |
| 270 // process can't cause denial of service by causing future named pipe creation | 271 // process can't cause denial of service by causing future named pipe creation |
| 271 // to fail. | 272 // to fail. |
| 272 return StringPrintf(L"%d.%x.%d", | 273 return StringPrintf(L"%d.%x.%d", |
| 273 GetCurrentProcessId(), instance, | 274 GetCurrentProcessId(), instance, |
| 274 rand_util::RandIntSecure(0, kint32max)); | 275 base::RandInt(0, std::numeric_limits<int>::max())); |
| 275 } | 276 } |
| 276 | 277 |
| 277 | 278 |
| 278 #endif // CHROME_BROWSER_RENDER_PROCESS_HOST_H_ | 279 #endif // CHROME_BROWSER_RENDER_PROCESS_HOST_H_ |
| 279 | 280 |
| OLD | NEW |