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

Unified Diff: content/browser/gpu/gpu_process_host.cc

Issue 2365273004: Initial implementation for sharing field trial state (win) (Closed)
Patch Set: add feature logic for sharing field trials Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/gpu/gpu_process_host.cc
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc
index 367a69d9323fd065203a78416690ba86d09ad846..23e756a50b0948bd557738e31629e7f678596019 100644
--- a/content/browser/gpu/gpu_process_host.cc
+++ b/content/browser/gpu/gpu_process_host.cc
@@ -48,6 +48,7 @@
#include "content/public/browser/render_widget_host_view_frame_subscriber.h"
#include "content/public/common/connection_filter.h"
#include "content/public/common/content_client.h"
+#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/mojo_channel_switches.h"
#include "content/public/common/mojo_shell_connection.h"
@@ -973,8 +974,20 @@ bool GpuProcessHost::LaunchGpuProcess(gpu::GpuPreferences* gpu_preferences) {
base::CommandLine* cmd_line = new base::CommandLine(exe_path);
#endif
+
cmd_line->AppendSwitchASCII(switches::kProcessType, switches::kGpuProcess);
- BrowserChildProcessHostImpl::CopyFeatureAndFieldTrialFlags(cmd_line);
+
+#if defined(OS_WIN)
+ if (base::FeatureList::IsEnabled(
+ features::kShareFieldTrialStateViaSharedMemory))
Alexei Svitkine (slow) 2016/10/04 18:49:35 Nit: {}'s
lawrencewu 2016/10/05 20:57:56 Done.
+ field_trial_state_.reset(new base::SharedMemory());
+#endif
+ BrowserChildProcessHostImpl::CopyFeatureAndFieldTrialFlags(
+ cmd_line, field_trial_state_.get());
+#if defined(OS_WIN)
+ if (!field_trial_state_.get()->handle().GetHandle())
Alexei Svitkine (slow) 2016/10/04 18:49:36 Is this just an error case? Needs a comment at the
lawrencewu 2016/10/05 20:57:56 Yes, it is the case when there were no field trial
+ field_trial_state_.reset();
+#endif
#if defined(OS_WIN)
cmd_line->AppendArg(switches::kPrefetchArgumentGpu);
@@ -1018,10 +1031,8 @@ bool GpuProcessHost::LaunchGpuProcess(gpu::GpuPreferences* gpu_preferences) {
cmd_line->PrependWrapper(gpu_launcher);
process_->Launch(
- new GpuSandboxedProcessLauncherDelegate(cmd_line,
- process_->GetHost()),
- cmd_line,
- true);
+ new GpuSandboxedProcessLauncherDelegate(cmd_line, process_->GetHost()),
+ cmd_line, field_trial_state_.get(), true);
process_launched_ = true;
UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents",

Powered by Google App Engine
This is Rietveld 408576698