mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Migrate user agent string to Cow<'static, str>
.
In most scenarios, where the user of Servo will not override the default user agent, the user agent can be a `&'static str`. But since we allow for customization, we currently use a `String` to represent the user agent. This commit migrates the user agent to be represented as a `Cow<'static, str>`, which (at the cost of ergonomics) prevents unnecessary allocations whenever cloning the user agent string in the scenario the user doesn't override the user agent.
This commit is contained in:
parent
ef7423bf00
commit
60afad1b61
7 changed files with 66 additions and 63 deletions
|
@ -252,7 +252,7 @@ fn create_constellation(opts: opts::Opts,
|
|||
let bluetooth_thread: IpcSender<BluetoothMethodMsg> = BluetoothThreadFactory::new();
|
||||
|
||||
let (public_resource_threads, private_resource_threads) =
|
||||
new_resource_threads(opts.user_agent.clone(),
|
||||
new_resource_threads(opts.user_agent,
|
||||
devtools_chan.clone(),
|
||||
time_profiler_chan.clone(),
|
||||
opts.config_dir.map(Into::into));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue