| OLD | NEW |
| 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 "content/renderer/render_process_impl.h" | 5 #include "content/renderer/render_process_impl.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "base/debug/crash_logging.h" | 22 #include "base/debug/crash_logging.h" |
| 23 #include "base/feature_list.h" | 23 #include "base/feature_list.h" |
| 24 #include "base/sys_info.h" | 24 #include "base/sys_info.h" |
| 25 #include "base/task_scheduler/initialization_util.h" | 25 #include "base/task_scheduler/initialization_util.h" |
| 26 #include "base/task_scheduler/scheduler_worker_pool_params.h" | 26 #include "base/task_scheduler/scheduler_worker_pool_params.h" |
| 27 #include "base/task_scheduler/task_scheduler.h" | 27 #include "base/task_scheduler/task_scheduler.h" |
| 28 #include "base/task_scheduler/task_traits.h" | 28 #include "base/task_scheduler/task_traits.h" |
| 29 #include "base/threading/platform_thread.h" | 29 #include "base/threading/platform_thread.h" |
| 30 #include "base/time/time.h" | 30 #include "base/time/time.h" |
| 31 #include "content/child/site_isolation_stats_gatherer.h" | 31 #include "content/child/site_isolation_stats_gatherer.h" |
| 32 #include "content/public/common/bindings_policy.h" |
| 32 #include "content/public/common/content_client.h" | 33 #include "content/public/common/content_client.h" |
| 33 #include "content/public/common/content_features.h" | 34 #include "content/public/common/content_features.h" |
| 34 #include "content/public/common/content_switches.h" | 35 #include "content/public/common/content_switches.h" |
| 35 #include "content/public/renderer/content_renderer_client.h" | 36 #include "content/public/renderer/content_renderer_client.h" |
| 36 #include "third_party/WebKit/public/web/WebFrame.h" | 37 #include "third_party/WebKit/public/web/WebFrame.h" |
| 37 #include "v8/include/v8.h" | 38 #include "v8/include/v8.h" |
| 38 | 39 |
| 39 #if defined(OS_WIN) | 40 #if defined(OS_WIN) |
| 40 #include "base/win/win_util.h" | 41 #include "base/win/win_util.h" |
| 41 #endif | 42 #endif |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 if (command_line.HasSwitch(switches::kJavaScriptFlags)) { | 209 if (command_line.HasSwitch(switches::kJavaScriptFlags)) { |
| 209 std::string flags( | 210 std::string flags( |
| 210 command_line.GetSwitchValueASCII(switches::kJavaScriptFlags)); | 211 command_line.GetSwitchValueASCII(switches::kJavaScriptFlags)); |
| 211 v8::V8::SetFlagsFromString(flags.c_str(), static_cast<int>(flags.size())); | 212 v8::V8::SetFlagsFromString(flags.c_str(), static_cast<int>(flags.size())); |
| 212 } | 213 } |
| 213 | 214 |
| 214 SiteIsolationStatsGatherer::SetEnabled( | 215 SiteIsolationStatsGatherer::SetEnabled( |
| 215 GetContentClient()->renderer()->ShouldGatherSiteIsolationStats()); | 216 GetContentClient()->renderer()->ShouldGatherSiteIsolationStats()); |
| 216 | 217 |
| 217 InitializeTaskScheduler(); | 218 InitializeTaskScheduler(); |
| 219 |
| 220 if (command_line.HasSwitch(switches::kDomAutomationController)) |
| 221 enabled_bindings_ |= BINDINGS_POLICY_DOM_AUTOMATION; |
| 222 if (command_line.HasSwitch(switches::kStatsCollectionController)) |
| 223 enabled_bindings_ |= BINDINGS_POLICY_STATS_COLLECTION; |
| 218 } | 224 } |
| 219 | 225 |
| 220 RenderProcessImpl::~RenderProcessImpl() { | 226 RenderProcessImpl::~RenderProcessImpl() { |
| 221 #ifndef NDEBUG | 227 #ifndef NDEBUG |
| 222 int count = blink::WebFrame::instanceCount(); | 228 int count = blink::WebFrame::instanceCount(); |
| 223 if (count) | 229 if (count) |
| 224 DLOG(ERROR) << "WebFrame LEAKED " << count << " TIMES"; | 230 DLOG(ERROR) << "WebFrame LEAKED " << count << " TIMES"; |
| 225 #endif | 231 #endif |
| 226 | 232 |
| 227 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 233 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 228 switches::kSingleProcess)) { | 234 switches::kSingleProcess)) { |
| 229 DCHECK(base::TaskScheduler::GetInstance()); | 235 DCHECK(base::TaskScheduler::GetInstance()); |
| 230 base::TaskScheduler::GetInstance()->Shutdown(); | 236 base::TaskScheduler::GetInstance()->Shutdown(); |
| 231 } | 237 } |
| 232 | 238 |
| 233 GetShutDownEvent()->Signal(); | 239 GetShutDownEvent()->Signal(); |
| 234 } | 240 } |
| 235 | 241 |
| 236 void RenderProcessImpl::AddBindings(int bindings) { | 242 void RenderProcessImpl::AddBindings(int bindings) { |
| 237 enabled_bindings_ |= bindings; | 243 enabled_bindings_ |= bindings; |
| 238 } | 244 } |
| 239 | 245 |
| 240 int RenderProcessImpl::GetEnabledBindings() const { | 246 int RenderProcessImpl::GetEnabledBindings() const { |
| 241 return enabled_bindings_; | 247 return enabled_bindings_; |
| 242 } | 248 } |
| 243 | 249 |
| 244 } // namespace content | 250 } // namespace content |
| OLD | NEW |