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

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 jam. 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 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 // Now send any options from our own command line we want to propagate. 1287 // Now send any options from our own command line we want to propagate.
1307 const base::CommandLine& browser_command_line = 1288 const base::CommandLine& browser_command_line =
1308 *base::CommandLine::ForCurrentProcess(); 1289 *base::CommandLine::ForCurrentProcess();
1309 PropagateBrowserCommandLineToRenderer(browser_command_line, command_line); 1290 PropagateBrowserCommandLineToRenderer(browser_command_line, command_line);
1310 1291
1311 // Pass on the browser locale. 1292 // Pass on the browser locale.
1312 const std::string locale = 1293 const std::string locale =
1313 GetContentClient()->browser()->GetApplicationLocale(); 1294 GetContentClient()->browser()->GetApplicationLocale();
1314 command_line->AppendSwitchASCII(switches::kLang, locale); 1295 command_line->AppendSwitchASCII(switches::kLang, locale);
1315 1296
1316 // If we run base::FieldTrials, we want to pass to their state to the
1317 // renderer so that it can act in accordance with each state, or record
1318 // histograms relating to the base::FieldTrial states.
1319 std::string field_trial_states;
1320 base::FieldTrialList::AllStatesToString(&field_trial_states);
1321 if (!field_trial_states.empty()) {
1322 command_line->AppendSwitchASCII(switches::kForceFieldTrials,
1323 field_trial_states);
1324 }
1325
1326 GetContentClient()->browser()->AppendExtraCommandLineSwitches(command_line, 1297 GetContentClient()->browser()->AppendExtraCommandLineSwitches(command_line,
1327 GetID()); 1298 GetID());
1328 1299
1329 if (IsPinchToZoomEnabled()) 1300 if (IsPinchToZoomEnabled())
1330 command_line->AppendSwitch(switches::kEnablePinch); 1301 command_line->AppendSwitch(switches::kEnablePinch);
1331 1302
1332 #if defined(OS_WIN) 1303 #if defined(OS_WIN)
1333 command_line->AppendSwitchASCII( 1304 command_line->AppendSwitchASCII(
1334 switches::kDeviceScaleFactor, 1305 switches::kDeviceScaleFactor,
1335 base::DoubleToString(display::win::GetDPIScale())); 1306 base::DoubleToString(display::win::GetDPIScale()));
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1544 #if defined(USE_OZONE) 1515 #if defined(USE_OZONE)
1545 switches::kOzonePlatform, 1516 switches::kOzonePlatform,
1546 #endif 1517 #endif
1547 #if defined(OS_CHROMEOS) 1518 #if defined(OS_CHROMEOS)
1548 switches::kDisableVaapiAcceleratedVideoEncode, 1519 switches::kDisableVaapiAcceleratedVideoEncode,
1549 #endif 1520 #endif
1550 }; 1521 };
1551 renderer_cmd->CopySwitchesFrom(browser_cmd, kSwitchNames, 1522 renderer_cmd->CopySwitchesFrom(browser_cmd, kSwitchNames,
1552 arraysize(kSwitchNames)); 1523 arraysize(kSwitchNames));
1553 1524
1554 CopyEnableDisableFeatureFlagsToRenderer(renderer_cmd); 1525 BrowserChildProcessHostImpl::CopyFeatureAndFieldTrialFlags(renderer_cmd);
1555 1526
1556 if (browser_cmd.HasSwitch(switches::kTraceStartup) && 1527 if (browser_cmd.HasSwitch(switches::kTraceStartup) &&
1557 BrowserMainLoop::GetInstance()->is_tracing_startup_for_duration()) { 1528 BrowserMainLoop::GetInstance()->is_tracing_startup_for_duration()) {
1558 // Pass kTraceStartup switch to renderer only if startup tracing has not 1529 // Pass kTraceStartup switch to renderer only if startup tracing has not
1559 // finished. 1530 // finished.
1560 renderer_cmd->AppendSwitchASCII( 1531 renderer_cmd->AppendSwitchASCII(
1561 switches::kTraceStartup, 1532 switches::kTraceStartup,
1562 browser_cmd.GetSwitchValueASCII(switches::kTraceStartup)); 1533 browser_cmd.GetSwitchValueASCII(switches::kTraceStartup));
1563 } 1534 }
1564 1535
(...skipping 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after
2789 2760
2790 // Skip widgets in other processes. 2761 // Skip widgets in other processes.
2791 if (rvh->GetProcess()->GetID() != GetID()) 2762 if (rvh->GetProcess()->GetID() != GetID())
2792 continue; 2763 continue;
2793 2764
2794 rvh->OnWebkitPreferencesChanged(); 2765 rvh->OnWebkitPreferencesChanged();
2795 } 2766 }
2796 } 2767 }
2797 2768
2798 } // namespace content 2769 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698