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 #include "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <objidl.h> | 9 #include <objidl.h> |
10 #include <mlang.h> | 10 #include <mlang.h> |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 "GdiInitializeLanguagePack")); | 65 "GdiInitializeLanguagePack")); |
66 DCHECK(gdi_init_lpk); | 66 DCHECK(gdi_init_lpk); |
67 if (gdi_init_lpk) { | 67 if (gdi_init_lpk) { |
68 gdi_init_lpk(0); | 68 gdi_init_lpk(0); |
69 } | 69 } |
70 } | 70 } |
71 #endif | 71 #endif |
72 | 72 |
73 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 73 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
74 if (command_line.HasSwitch(switches::kJavaScriptFlags)) { | 74 if (command_line.HasSwitch(switches::kJavaScriptFlags)) { |
75 // TODO(port) | |
76 // Try and limit what we pull in for our non-Win unit test bundle | |
77 #if defined(OS_WIN) || (!defined(UNIT_TEST)) | |
78 webkit_glue::SetJavaScriptFlags( | 75 webkit_glue::SetJavaScriptFlags( |
79 command_line.GetSwitchValue(switches::kJavaScriptFlags)); | 76 command_line.GetSwitchValue(switches::kJavaScriptFlags)); |
80 #endif | |
81 } | 77 } |
82 if (command_line.HasSwitch(switches::kPlaybackMode) || | 78 if (command_line.HasSwitch(switches::kPlaybackMode) || |
83 command_line.HasSwitch(switches::kRecordMode)) { | 79 command_line.HasSwitch(switches::kRecordMode)) { |
84 // TODO(port) | |
85 // Try and limit what we pull in for our non-Win unit test bundle | |
86 #if defined(OS_WIN) || (!defined(UNIT_TEST)) | |
87 webkit_glue::SetRecordPlaybackMode(true); | 80 webkit_glue::SetRecordPlaybackMode(true); |
88 #endif | |
89 } | 81 } |
90 | 82 |
91 if (command_line.HasSwitch(switches::kInProcessPlugins) || | 83 if (command_line.HasSwitch(switches::kInProcessPlugins) || |
92 command_line.HasSwitch(switches::kSingleProcess)) | 84 command_line.HasSwitch(switches::kSingleProcess)) |
93 load_plugins_in_process_ = true; | 85 load_plugins_in_process_ = true; |
94 | 86 |
95 if (command_line.HasSwitch(switches::kEnableWatchdog)) { | 87 if (command_line.HasSwitch(switches::kEnableWatchdog)) { |
96 // TODO(JAR): Need to implement renderer IO msgloop watchdog. | 88 // TODO(JAR): Need to implement renderer IO msgloop watchdog. |
97 } | 89 } |
98 | 90 |
(...skipping 23 matching lines...) Expand all Loading... | |
122 ChildProcess::GlobalCleanup(); | 114 ChildProcess::GlobalCleanup(); |
123 } | 115 } |
124 | 116 |
125 // static | 117 // static |
126 bool RenderProcess::ShouldLoadPluginsInProcess() { | 118 bool RenderProcess::ShouldLoadPluginsInProcess() { |
127 return load_plugins_in_process_; | 119 return load_plugins_in_process_; |
128 } | 120 } |
129 | 121 |
130 // static | 122 // static |
131 base::SharedMemory* RenderProcess::AllocSharedMemory(size_t size) { | 123 base::SharedMemory* RenderProcess::AllocSharedMemory(size_t size) { |
124 #if defined(OS_LINUX) | |
125 // Linux has trouble with ""; the Create() call below will fail when | |
126 // triggered by RenderProcessTest.TestSharedMemoryAllocOne(), every | |
127 // time. | |
128 std::wstring root_name(L"root"); | |
brettw
2009/01/28 01:46:27
What does Linux/OSX do if the name is an existing
jeremy
2009/01/28 02:13:15
ob-warning: Named POSIX shared memory has bad beha
| |
129 #else | |
130 std::wstring root_name(L""); | |
131 #endif | |
132 | |
132 self()->clearer_factory_.RevokeAll(); | 133 self()->clearer_factory_.RevokeAll(); |
133 | 134 |
134 base::SharedMemory* mem = self()->GetSharedMemFromCache(size); | 135 base::SharedMemory* mem = self()->GetSharedMemFromCache(size); |
135 if (mem) | 136 if (mem) |
136 return mem; | 137 return mem; |
137 | 138 |
138 // Round-up size to allocation granularity | 139 // Round-up size to allocation granularity |
139 size_t allocation_granularity = base::SysInfo::VMAllocationGranularity(); | 140 size_t allocation_granularity = base::SysInfo::VMAllocationGranularity(); |
140 size = size / allocation_granularity + 1; | 141 size = size / allocation_granularity + 1; |
141 size = size * allocation_granularity; | 142 size = size * allocation_granularity; |
142 | 143 |
143 mem = new base::SharedMemory(); | 144 mem = new base::SharedMemory(); |
144 if (!mem) | 145 if (!mem) |
145 return NULL; | 146 return NULL; |
146 if (!mem->Create(L"", false, true, size)) { | 147 if (!mem->Create(root_name, false, true, size)) { |
147 delete mem; | 148 delete mem; |
148 return NULL; | 149 return NULL; |
149 } | 150 } |
150 | 151 |
151 return mem; | 152 return mem; |
152 } | 153 } |
153 | 154 |
154 // static | 155 // static |
155 void RenderProcess::FreeSharedMemory(base::SharedMemory* mem) { | 156 void RenderProcess::FreeSharedMemory(base::SharedMemory* mem) { |
156 if (self()->PutSharedMemInCache(mem)) { | 157 if (self()->PutSharedMemInCache(mem)) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
214 clearer_factory_.RevokeAll(); | 215 clearer_factory_.RevokeAll(); |
215 | 216 |
216 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 217 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
217 clearer_factory_.NewRunnableMethod(&RenderProcess::ClearSharedMemCache), | 218 clearer_factory_.NewRunnableMethod(&RenderProcess::ClearSharedMemCache), |
218 5000 /* 5 seconds */); | 219 5000 /* 5 seconds */); |
219 } | 220 } |
220 | 221 |
221 void RenderProcess::Cleanup() { | 222 void RenderProcess::Cleanup() { |
222 // TODO(port) | 223 // TODO(port) |
223 // Try and limit what we pull in for our non-Win unit test bundle | 224 // Try and limit what we pull in for our non-Win unit test bundle |
224 #if defined(OS_WIN) || (!defined(UNIT_TEST)) | |
225 #ifndef NDEBUG | 225 #ifndef NDEBUG |
226 // log important leaked objects | 226 // log important leaked objects |
227 webkit_glue::CheckForLeaks(); | 227 webkit_glue::CheckForLeaks(); |
228 #endif | 228 #endif |
229 #endif | |
230 } | 229 } |
OLD | NEW |