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

Side by Side Diff: chromecast/base/chromecast_switches.cc

Issue 1767603003: [chromecast] Add cast_shell --accept-resource-provider switch (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: bool -> int Created 4 years, 9 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/command_line.h"
halliwell 2016/03/05 01:01:50 ordering nit: put the header corresponding to the
jyw 2016/03/08 02:09:24 Done.
5 #include "chromecast/base/chromecast_switches.h" 6 #include "chromecast/base/chromecast_switches.h"
6 7
7 namespace switches { 8 namespace switches {
8 9
10 namespace {
11 // Value indicating whether flag from command line switch is false.
12 const char kSwitchValueFalse[] = "false";
13 } // namespace
14
9 // Enable the CMA media pipeline. 15 // Enable the CMA media pipeline.
10 const char kEnableCmaMediaPipeline[] = "enable-cma-media-pipeline"; 16 const char kEnableCmaMediaPipeline[] = "enable-cma-media-pipeline";
11 17
12 // The bitmask of codecs (media_caps.h) supported by the current HDMI sink. 18 // The bitmask of codecs (media_caps.h) supported by the current HDMI sink.
13 const char kHdmiSinkSupportedCodecs[] = "hdmi-sink-supported-codecs"; 19 const char kHdmiSinkSupportedCodecs[] = "hdmi-sink-supported-codecs";
14 20
15 // Enable file accesses. It should not be enabled for most Cast devices. 21 // Enable file accesses. It should not be enabled for most Cast devices.
16 const char kEnableLocalFileAccesses[] = "enable-local-file-accesses"; 22 const char kEnableLocalFileAccesses[] = "enable-local-file-accesses";
17 23
18 // Override the URL to which metrics logs are sent for debugging. 24 // Override the URL to which metrics logs are sent for debugging.
19 const char kOverrideMetricsUploadUrl[] = "override-metrics-upload-url"; 25 const char kOverrideMetricsUploadUrl[] = "override-metrics-upload-url";
20 26
21 // Disable features that require WiFi management. 27 // Disable features that require WiFi management.
22 const char kNoWifi[] = "no-wifi"; 28 const char kNoWifi[] = "no-wifi";
23 29
24 // Allows media playback for hidden WebContents 30 // Allows media playback for hidden WebContents
25 const char kAllowHiddenMediaPlayback[] = "allow-hidden-media-playback"; 31 const char kAllowHiddenMediaPlayback[] = "allow-hidden-media-playback";
26 32
27 // Pass the app id information to the renderer process, to be used for logging. 33 // Pass the app id information to the renderer process, to be used for logging.
28 // last-launched-app should be the app that just launched and is spawning the 34 // last-launched-app should be the app that just launched and is spawning the
29 // renderer. 35 // renderer.
30 const char kLastLaunchedApp[] = "last-launched-app"; 36 const char kLastLaunchedApp[] = "last-launched-app";
31 // previous-app should be the app that was running when last-launched-app 37 // previous-app should be the app that was running when last-launched-app
32 // started. 38 // started.
33 const char kPreviousApp[] = "previous-app"; 39 const char kPreviousApp[] = "previous-app";
34 40
41 // Flag indicating that a resource provider must be set up to provide cast
42 // receiver with resources. Apps cannot start until provided resources.
43 const char kAcceptResourceProvider[] = "accept-resource-provider";
44
35 // Size of the ALSA output buffer in frames. This directly sets the latency of 45 // Size of the ALSA output buffer in frames. This directly sets the latency of
36 // the output device. Latency can be calculated by multiplying the sample rate 46 // the output device. Latency can be calculated by multiplying the sample rate
37 // by the output buffer size. 47 // by the output buffer size.
38 const char kAlsaOutputBufferSize[] = "alsa-output-buffer-size"; 48 const char kAlsaOutputBufferSize[] = "alsa-output-buffer-size";
39 49
40 // Size of the ALSA output period in frames. The period of an ALSA output device 50 // Size of the ALSA output period in frames. The period of an ALSA output device
41 // determines how many frames elapse between hardware interrupts. 51 // determines how many frames elapse between hardware interrupts.
42 const char kAlsaOutputPeriodSize[] = "alsa-output-period-size"; 52 const char kAlsaOutputPeriodSize[] = "alsa-output-period-size";
43 53
44 // How many frames need to be in the output buffer before output starts. 54 // How many frames need to be in the output buffer before output starts.
45 const char kAlsaOutputStartThreshold[] = "alsa-output-start-threshold"; 55 const char kAlsaOutputStartThreshold[] = "alsa-output-start-threshold";
46 56
47 // Minimum number of available frames for scheduling a transfer. 57 // Minimum number of available frames for scheduling a transfer.
48 const char kAlsaOutputAvailMin[] = "alsa-output-avail-min"; 58 const char kAlsaOutputAvailMin[] = "alsa-output-avail-min";
49 59
50 // Time in ms to wait before closing the PCM handle when no more mixer inputs 60 // Time in ms to wait before closing the PCM handle when no more mixer inputs
51 // remain. 61 // remain.
52 const char kAlsaCheckCloseTimeout[] = "alsa-check-close-timeout"; 62 const char kAlsaCheckCloseTimeout[] = "alsa-check-close-timeout";
53 63
54 // Number of channels on the alsa output device that the stream mixer uses. 64 // Number of channels on the alsa output device that the stream mixer uses.
55 // Default is 2 channels. 65 // Default is 2 channels.
56 const char kAlsaNumOutputChannels[] = "alsa-num-output-channels"; 66 const char kAlsaNumOutputChannels[] = "alsa-num-output-channels";
57 67
58 } // namespace switches 68 } // namespace switches
69
70 namespace base {
71
72 bool GetSwitchValueBoolean(const std::string& switch_string) {
73 const base::CommandLine* command_line =
74 base::CommandLine::ForCurrentProcess();
75 return command_line->HasSwitch(switch_string) &&
76 command_line->GetSwitchValueASCII(switch_string)
77 .compare(switches::kSwitchValueFalse);
halliwell 2016/03/05 01:01:50 seems like this function accepts any old value tha
byungchul 2016/03/07 17:19:40 These functions are used to disable a feature expl
halliwell 2016/03/07 23:33:55 Thanks for explanation. It definitely sounds good
kmackay 2016/03/08 00:06:11 Or, just have one function, and pass in the defaul
kmackay 2016/03/08 00:06:11 I'd rather just accept 'true' or 'false' (or no va
jyw 2016/03/08 02:09:24 Done.
78 }
79
80 bool IsSwitchExplicitFalse(const std::string& switch_string) {
81 const base::CommandLine* command_line =
82 base::CommandLine::ForCurrentProcess();
83 return command_line->HasSwitch(switch_string) &&
84 command_line->GetSwitchValueASCII(switch_string)
85 .compare(switches::kSwitchValueFalse) == 0;
halliwell 2016/03/05 01:10:58 Also, just remembered: GetSwitchValueASCII returns
byungchul 2016/03/07 17:19:40 One benefit of these functions is consistency in c
86 }
87
88 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698