Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 1928863002: Enable FeatureList for the GPU process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from asvitkine. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <utility> 12 #include <utility>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/base_switches.h" 15 #include "base/base_switches.h"
16 #include "base/bind.h" 16 #include "base/bind.h"
17 #include "base/bind_helpers.h" 17 #include "base/bind_helpers.h"
18 #include "base/callback.h" 18 #include "base/callback.h"
19 #include "base/command_line.h" 19 #include "base/command_line.h"
20 #include "base/debug/dump_without_crashing.h" 20 #include "base/debug/dump_without_crashing.h"
21 #include "base/feature_list.h" 21 #include "base/feature_list.h"
22 #include "base/files/file.h" 22 #include "base/files/file.h"
23 #include "base/lazy_instance.h" 23 #include "base/lazy_instance.h"
24 #include "base/location.h" 24 #include "base/location.h"
25 #include "base/logging.h" 25 #include "base/logging.h"
26 #include "base/macros.h" 26 #include "base/macros.h"
27 #include "base/memory/shared_memory.h" 27 #include "base/memory/shared_memory.h"
28 #include "base/memory/shared_memory_handle.h" 28 #include "base/memory/shared_memory_handle.h"
29 #include "base/metrics/field_trial.h"
30 #include "base/metrics/histogram.h" 29 #include "base/metrics/histogram.h"
31 #include "base/metrics/persistent_histogram_allocator.h" 30 #include "base/metrics/persistent_histogram_allocator.h"
32 #include "base/metrics/persistent_memory_allocator.h" 31 #include "base/metrics/persistent_memory_allocator.h"
33 #include "base/process/process_handle.h" 32 #include "base/process/process_handle.h"
34 #include "base/rand_util.h" 33 #include "base/rand_util.h"
35 #include "base/single_thread_task_runner.h" 34 #include "base/single_thread_task_runner.h"
36 #include "base/stl_util.h" 35 #include "base/stl_util.h"
37 #include "base/strings/string_number_conversions.h" 36 #include "base/strings/string_number_conversions.h"
38 #include "base/strings/stringprintf.h" 37 #include "base/strings/stringprintf.h"
39 #include "base/supports_user_data.h" 38 #include "base/supports_user_data.h"
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 std::string UintVectorToString(const std::vector<unsigned>& vector) { 438 std::string UintVectorToString(const std::vector<unsigned>& vector) {
440 std::string str; 439 std::string str;
441 for (auto it : vector) { 440 for (auto it : vector) {
442 if (!str.empty()) 441 if (!str.empty())
443 str += ","; 442 str += ",";
444 str += base::UintToString(it); 443 str += base::UintToString(it);
445 } 444 }
446 return str; 445 return str;
447 } 446 }
448 447
449 // Copies kEnableFeatures and kDisableFeatures to the renderer command line.
450 // Generates them from the FeatureList override state, to take into account
451 // overrides from FieldTrials.
452 void CopyEnableDisableFeatureFlagsToRenderer(base::CommandLine* renderer_cmd) {
453 std::string enabled_features;
454 std::string disabled_features;
455 base::FeatureList::GetInstance()->GetFeatureOverrides(&enabled_features,
456 &disabled_features);
457 if (!enabled_features.empty()) {
458 renderer_cmd->AppendSwitchASCII(switches::kEnableFeatures,
459 enabled_features);
460 }
461 if (!disabled_features.empty()) {
462 renderer_cmd->AppendSwitchASCII(switches::kDisableFeatures,
463 disabled_features);
464 }
465 }
466
467 } // namespace 448 } // namespace
468 449
469 RendererMainThreadFactoryFunction g_renderer_main_thread_factory = NULL; 450 RendererMainThreadFactoryFunction g_renderer_main_thread_factory = NULL;
470 451
471 base::MessageLoop* g_in_process_thread; 452 base::MessageLoop* g_in_process_thread;
472 453
473 base::MessageLoop* 454 base::MessageLoop*
474 RenderProcessHostImpl::GetInProcessRendererThreadForTesting() { 455 RenderProcessHostImpl::GetInProcessRendererThreadForTesting() {
475 return g_in_process_thread; 456 return g_in_process_thread;
476 } 457 }
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 // Now send any options from our own command line we want to propagate. 1295 // Now send any options from our own command line we want to propagate.
1315 const base::CommandLine& browser_command_line = 1296 const base::CommandLine& browser_command_line =
1316 *base::CommandLine::ForCurrentProcess(); 1297 *base::CommandLine::ForCurrentProcess();
1317 PropagateBrowserCommandLineToRenderer(browser_command_line, command_line); 1298 PropagateBrowserCommandLineToRenderer(browser_command_line, command_line);
1318 1299
1319 // Pass on the browser locale. 1300 // Pass on the browser locale.
1320 const std::string locale = 1301 const std::string locale =
1321 GetContentClient()->browser()->GetApplicationLocale(); 1302 GetContentClient()->browser()->GetApplicationLocale();
1322 command_line->AppendSwitchASCII(switches::kLang, locale); 1303 command_line->AppendSwitchASCII(switches::kLang, locale);
1323 1304
1324 // If we run base::FieldTrials, we want to pass to their state to the
1325 // renderer so that it can act in accordance with each state, or record
1326 // histograms relating to the base::FieldTrial states.
1327 std::string field_trial_states;
1328 base::FieldTrialList::AllStatesToString(&field_trial_states);
1329 if (!field_trial_states.empty()) {
1330 command_line->AppendSwitchASCII(switches::kForceFieldTrials,
1331 field_trial_states);
1332 }
1333
1334 GetContentClient()->browser()->AppendExtraCommandLineSwitches(command_line, 1305 GetContentClient()->browser()->AppendExtraCommandLineSwitches(command_line,
1335 GetID()); 1306 GetID());
1336 1307
1337 if (IsPinchToZoomEnabled()) 1308 if (IsPinchToZoomEnabled())
1338 command_line->AppendSwitch(switches::kEnablePinch); 1309 command_line->AppendSwitch(switches::kEnablePinch);
1339 1310
1340 #if defined(OS_WIN) 1311 #if defined(OS_WIN)
1341 command_line->AppendSwitchASCII( 1312 command_line->AppendSwitchASCII(
1342 switches::kDeviceScaleFactor, 1313 switches::kDeviceScaleFactor,
1343 base::DoubleToString(display::win::GetDPIScale())); 1314 base::DoubleToString(display::win::GetDPIScale()));
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 #if defined(USE_OZONE) 1522 #if defined(USE_OZONE)
1552 switches::kOzonePlatform, 1523 switches::kOzonePlatform,
1553 #endif 1524 #endif
1554 #if defined(OS_CHROMEOS) 1525 #if defined(OS_CHROMEOS)
1555 switches::kDisableVaapiAcceleratedVideoEncode, 1526 switches::kDisableVaapiAcceleratedVideoEncode,
1556 #endif 1527 #endif
1557 }; 1528 };
1558 renderer_cmd->CopySwitchesFrom(browser_cmd, kSwitchNames, 1529 renderer_cmd->CopySwitchesFrom(browser_cmd, kSwitchNames,
1559 arraysize(kSwitchNames)); 1530 arraysize(kSwitchNames));
1560 1531
1561 CopyEnableDisableFeatureFlagsToRenderer(renderer_cmd); 1532 ChildProcessHostImpl::CopyEnableDisableFeatureFlags(renderer_cmd);
1562 1533
1563 if (browser_cmd.HasSwitch(switches::kTraceStartup) && 1534 if (browser_cmd.HasSwitch(switches::kTraceStartup) &&
1564 BrowserMainLoop::GetInstance()->is_tracing_startup_for_duration()) { 1535 BrowserMainLoop::GetInstance()->is_tracing_startup_for_duration()) {
1565 // Pass kTraceStartup switch to renderer only if startup tracing has not 1536 // Pass kTraceStartup switch to renderer only if startup tracing has not
1566 // finished. 1537 // finished.
1567 renderer_cmd->AppendSwitchASCII( 1538 renderer_cmd->AppendSwitchASCII(
1568 switches::kTraceStartup, 1539 switches::kTraceStartup,
1569 browser_cmd.GetSwitchValueASCII(switches::kTraceStartup)); 1540 browser_cmd.GetSwitchValueASCII(switches::kTraceStartup));
1570 } 1541 }
1571 1542
(...skipping 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after
2796 2767
2797 // Skip widgets in other processes. 2768 // Skip widgets in other processes.
2798 if (rvh->GetProcess()->GetID() != GetID()) 2769 if (rvh->GetProcess()->GetID() != GetID())
2799 continue; 2770 continue;
2800 2771
2801 rvh->OnWebkitPreferencesChanged(); 2772 rvh->OnWebkitPreferencesChanged();
2802 } 2773 }
2803 } 2774 }
2804 2775
2805 } // namespace content 2776 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698