mirror of
https://github.com/servo/servo.git
synced 2025-08-11 00:15:32 +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
|
@ -38,7 +38,7 @@ fn test_exit() {
|
|||
let (tx, _rx) = ipc::channel().unwrap();
|
||||
let (sender, receiver) = ipc::channel().unwrap();
|
||||
let (resource_thread, _) = new_core_resource_thread(
|
||||
"".to_owned(), None, ProfilerChan(tx), None);
|
||||
"".into(), None, ProfilerChan(tx), None);
|
||||
resource_thread.send(CoreResourceMsg::Exit(sender)).unwrap();
|
||||
receiver.recv().unwrap();
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ fn test_bad_scheme() {
|
|||
let (tx, _rx) = ipc::channel().unwrap();
|
||||
let (sender, receiver) = ipc::channel().unwrap();
|
||||
let (resource_thread, _) = new_core_resource_thread(
|
||||
"".to_owned(), None, ProfilerChan(tx), None);
|
||||
"".into(), None, ProfilerChan(tx), None);
|
||||
let (start_chan, start) = ipc::channel().unwrap();
|
||||
let url = Url::parse("bogus://whatever").unwrap();
|
||||
resource_thread.send(CoreResourceMsg::Load(LoadData::new(LoadContext::Browsing, url, &ResourceTest),
|
||||
|
@ -228,7 +228,7 @@ fn test_cancelled_listener() {
|
|||
let (tx, _rx) = ipc::channel().unwrap();
|
||||
let (exit_sender, exit_receiver) = ipc::channel().unwrap();
|
||||
let (resource_thread, _) = new_core_resource_thread(
|
||||
"".to_owned(), None, ProfilerChan(tx), None);
|
||||
"".into(), None, ProfilerChan(tx), None);
|
||||
let (sender, receiver) = ipc::channel().unwrap();
|
||||
let (id_sender, id_receiver) = ipc::channel().unwrap();
|
||||
let (sync_sender, sync_receiver) = ipc::channel().unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue