OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
7 | 7 |
8 #include "content/browser/renderer_host/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
11 #include <limits> | 11 #include <limits> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/base_switches.h" | 14 #include "base/base_switches.h" |
15 #include "base/bind.h" | 15 #include "base/bind.h" |
16 #include "base/bind_helpers.h" | 16 #include "base/bind_helpers.h" |
17 #include "base/callback.h" | 17 #include "base/callback.h" |
18 #include "base/command_line.h" | 18 #include "base/command_line.h" |
19 #include "base/debug/dump_without_crashing.h" | 19 #include "base/debug/dump_without_crashing.h" |
| 20 #include "base/feature_list.h" |
20 #include "base/files/file.h" | 21 #include "base/files/file.h" |
21 #include "base/lazy_instance.h" | 22 #include "base/lazy_instance.h" |
22 #include "base/location.h" | 23 #include "base/location.h" |
23 #include "base/logging.h" | 24 #include "base/logging.h" |
24 #include "base/metrics/field_trial.h" | 25 #include "base/metrics/field_trial.h" |
25 #include "base/metrics/histogram.h" | 26 #include "base/metrics/histogram.h" |
26 #include "base/process/process_handle.h" | 27 #include "base/process/process_handle.h" |
27 #include "base/rand_util.h" | 28 #include "base/rand_util.h" |
28 #include "base/single_thread_task_runner.h" | 29 #include "base/single_thread_task_runner.h" |
29 #include "base/stl_util.h" | 30 #include "base/stl_util.h" |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 std::string UintVectorToString(const std::vector<unsigned>& vector) { | 427 std::string UintVectorToString(const std::vector<unsigned>& vector) { |
427 std::string str; | 428 std::string str; |
428 for (auto it : vector) { | 429 for (auto it : vector) { |
429 if (!str.empty()) | 430 if (!str.empty()) |
430 str += ","; | 431 str += ","; |
431 str += base::UintToString(it); | 432 str += base::UintToString(it); |
432 } | 433 } |
433 return str; | 434 return str; |
434 } | 435 } |
435 | 436 |
| 437 // Copies kEnableFeatures and kDisableFeatures to the renderer command line. |
| 438 // Generates them from the FeatureList override state, to take into account |
| 439 // overrides from FieldTrials. |
| 440 void CopyEnableDisableFeatureFlagsToRenderer(base::CommandLine* renderer_cmd) { |
| 441 std::string enabled_features; |
| 442 std::string disabled_features; |
| 443 base::FeatureList::GetInstance()->GetFeatureOverrides(&enabled_features, |
| 444 &disabled_features); |
| 445 if (!enabled_features.empty()) { |
| 446 renderer_cmd->AppendSwitchASCII(switches::kEnableFeatures, |
| 447 enabled_features); |
| 448 } |
| 449 if (!disabled_features.empty()) { |
| 450 renderer_cmd->AppendSwitchASCII(switches::kDisableFeatures, |
| 451 disabled_features); |
| 452 } |
| 453 } |
| 454 |
436 } // namespace | 455 } // namespace |
437 | 456 |
438 RendererMainThreadFactoryFunction g_renderer_main_thread_factory = NULL; | 457 RendererMainThreadFactoryFunction g_renderer_main_thread_factory = NULL; |
439 | 458 |
440 base::MessageLoop* g_in_process_thread; | 459 base::MessageLoop* g_in_process_thread; |
441 | 460 |
442 base::MessageLoop* | 461 base::MessageLoop* |
443 RenderProcessHostImpl::GetInProcessRendererThreadForTesting() { | 462 RenderProcessHostImpl::GetInProcessRendererThreadForTesting() { |
444 return g_in_process_thread; | 463 return g_in_process_thread; |
445 } | 464 } |
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1295 switches::kDisableAcceleratedVideoDecode, | 1314 switches::kDisableAcceleratedVideoDecode, |
1296 switches::kDisableBlinkFeatures, | 1315 switches::kDisableBlinkFeatures, |
1297 switches::kDisableBreakpad, | 1316 switches::kDisableBreakpad, |
1298 switches::kDisablePreferCompositingToLCDText, | 1317 switches::kDisablePreferCompositingToLCDText, |
1299 switches::kDisableDatabases, | 1318 switches::kDisableDatabases, |
1300 switches::kDisableDelayAgnosticAec, | 1319 switches::kDisableDelayAgnosticAec, |
1301 switches::kDisableDirectNPAPIRequests, | 1320 switches::kDisableDirectNPAPIRequests, |
1302 switches::kDisableDisplayList2dCanvas, | 1321 switches::kDisableDisplayList2dCanvas, |
1303 switches::kDisableDistanceFieldText, | 1322 switches::kDisableDistanceFieldText, |
1304 switches::kDisableEncryptedMedia, | 1323 switches::kDisableEncryptedMedia, |
1305 switches::kDisableFeatures, | |
1306 switches::kDisableFileSystem, | 1324 switches::kDisableFileSystem, |
1307 switches::kDisableGestureRequirementForMediaPlayback, | 1325 switches::kDisableGestureRequirementForMediaPlayback, |
1308 switches::kDisableGpuCompositing, | 1326 switches::kDisableGpuCompositing, |
1309 switches::kDisableGpuMemoryBufferVideoFrames, | 1327 switches::kDisableGpuMemoryBufferVideoFrames, |
1310 switches::kDisableGpuVsync, | 1328 switches::kDisableGpuVsync, |
1311 switches::kDisableLowResTiling, | 1329 switches::kDisableLowResTiling, |
1312 switches::kDisableHistogramCustomizer, | 1330 switches::kDisableHistogramCustomizer, |
1313 switches::kDisableIconNtp, | 1331 switches::kDisableIconNtp, |
1314 switches::kDisableLCDText, | 1332 switches::kDisableLCDText, |
1315 switches::kDisableLocalStorage, | 1333 switches::kDisableLocalStorage, |
(...skipping 18 matching lines...) Expand all Loading... |
1334 switches::kDisableV8IdleTasks, | 1352 switches::kDisableV8IdleTasks, |
1335 switches::kDomAutomationController, | 1353 switches::kDomAutomationController, |
1336 switches::kEnableBlinkFeatures, | 1354 switches::kEnableBlinkFeatures, |
1337 switches::kEnableBrowserSideNavigation, | 1355 switches::kEnableBrowserSideNavigation, |
1338 switches::kEnableCompositorAnimationTimelines, | 1356 switches::kEnableCompositorAnimationTimelines, |
1339 switches::kEnableCredentialManagerAPI, | 1357 switches::kEnableCredentialManagerAPI, |
1340 switches::kEnableDisplayList2dCanvas, | 1358 switches::kEnableDisplayList2dCanvas, |
1341 switches::kEnableDistanceFieldText, | 1359 switches::kEnableDistanceFieldText, |
1342 switches::kEnableExperimentalCanvasFeatures, | 1360 switches::kEnableExperimentalCanvasFeatures, |
1343 switches::kEnableExperimentalWebPlatformFeatures, | 1361 switches::kEnableExperimentalWebPlatformFeatures, |
1344 switches::kEnableFeatures, | |
1345 switches::kEnableHeapProfiling, | 1362 switches::kEnableHeapProfiling, |
1346 switches::kEnableGPUClientLogging, | 1363 switches::kEnableGPUClientLogging, |
1347 switches::kEnableGpuClientTracing, | 1364 switches::kEnableGpuClientTracing, |
1348 switches::kEnableGpuMemoryBufferVideoFrames, | 1365 switches::kEnableGpuMemoryBufferVideoFrames, |
1349 switches::kEnableGPUServiceLogging, | 1366 switches::kEnableGPUServiceLogging, |
1350 switches::kEnableIconNtp, | 1367 switches::kEnableIconNtp, |
1351 switches::kEnableLinkDisambiguationPopup, | 1368 switches::kEnableLinkDisambiguationPopup, |
1352 switches::kEnableLowResTiling, | 1369 switches::kEnableLowResTiling, |
1353 switches::kEnableInbandTextTracks, | 1370 switches::kEnableInbandTextTracks, |
1354 switches::kEnableLCDText, | 1371 switches::kEnableLCDText, |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1476 switches::kOzonePlatform, | 1493 switches::kOzonePlatform, |
1477 #endif | 1494 #endif |
1478 #if defined(OS_CHROMEOS) | 1495 #if defined(OS_CHROMEOS) |
1479 switches::kDisableVaapiAcceleratedVideoEncode, | 1496 switches::kDisableVaapiAcceleratedVideoEncode, |
1480 #endif | 1497 #endif |
1481 "use-new-edk", // TODO(use_chrome_edk): temporary. | 1498 "use-new-edk", // TODO(use_chrome_edk): temporary. |
1482 }; | 1499 }; |
1483 renderer_cmd->CopySwitchesFrom(browser_cmd, kSwitchNames, | 1500 renderer_cmd->CopySwitchesFrom(browser_cmd, kSwitchNames, |
1484 arraysize(kSwitchNames)); | 1501 arraysize(kSwitchNames)); |
1485 | 1502 |
| 1503 CopyEnableDisableFeatureFlagsToRenderer(renderer_cmd); |
| 1504 |
1486 if (browser_cmd.HasSwitch(switches::kTraceStartup) && | 1505 if (browser_cmd.HasSwitch(switches::kTraceStartup) && |
1487 BrowserMainLoop::GetInstance()->is_tracing_startup_for_duration()) { | 1506 BrowserMainLoop::GetInstance()->is_tracing_startup_for_duration()) { |
1488 // Pass kTraceStartup switch to renderer only if startup tracing has not | 1507 // Pass kTraceStartup switch to renderer only if startup tracing has not |
1489 // finished. | 1508 // finished. |
1490 renderer_cmd->AppendSwitchASCII( | 1509 renderer_cmd->AppendSwitchASCII( |
1491 switches::kTraceStartup, | 1510 switches::kTraceStartup, |
1492 browser_cmd.GetSwitchValueASCII(switches::kTraceStartup)); | 1511 browser_cmd.GetSwitchValueASCII(switches::kTraceStartup)); |
1493 } | 1512 } |
1494 | 1513 |
1495 #if defined(ENABLE_WEBRTC) | 1514 #if defined(ENABLE_WEBRTC) |
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2619 void RenderProcessHostImpl::GetAudioOutputControllers( | 2638 void RenderProcessHostImpl::GetAudioOutputControllers( |
2620 const GetAudioOutputControllersCallback& callback) const { | 2639 const GetAudioOutputControllersCallback& callback) const { |
2621 audio_renderer_host()->GetOutputControllers(callback); | 2640 audio_renderer_host()->GetOutputControllers(callback); |
2622 } | 2641 } |
2623 | 2642 |
2624 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() { | 2643 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() { |
2625 return bluetooth_dispatcher_host_.get(); | 2644 return bluetooth_dispatcher_host_.get(); |
2626 } | 2645 } |
2627 | 2646 |
2628 } // namespace content | 2647 } // namespace content |
OLD | NEW |