Skip to content

Commit

Permalink
Remove the HttpRequestFactory trait.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ms2ger committed Nov 24, 2016
1 parent 38db554 commit fc6fa56
Showing 1 changed file with 12 additions and 21 deletions.
33 changes: 12 additions & 21 deletions components/net/http_loader.rs
Expand Up @@ -144,19 +144,11 @@ impl HttpResponse for WrappedHttpResponse {
}
}

trait HttpRequestFactory {
type R: HttpRequest;

fn create(&self, url: ServoUrl, method: Method, headers: Headers) -> Result<Self::R, LoadError>;
}

struct NetworkHttpRequestFactory {
pub connector: Arc<Pool<Connector>>,
}

impl HttpRequestFactory for NetworkHttpRequestFactory {
type R = WrappedHttpRequest;

impl NetworkHttpRequestFactory {
fn create(&self, url: ServoUrl, method: Method, headers: Headers)
-> Result<WrappedHttpRequest, LoadError> {
let connection = HyperRequest::with_connector(method,
Expand Down Expand Up @@ -518,18 +510,17 @@ fn auth_from_cache(auth_cache: &Arc<RwLock<AuthCache>>, origin: &UrlOrigin) -> O
}
}

fn obtain_response<A>(request_factory: &HttpRequestFactory<R=A>,
url: &ServoUrl,
method: &Method,
request_headers: &Headers,
data: &Option<Vec<u8>>,
load_data_method: &Method,
pipeline_id: &Option<PipelineId>,
iters: u32,
request_id: Option<&str>,
is_xhr: bool)
-> Result<(A::R, Option<ChromeToDevtoolsControlMsg>), LoadError>
where A: HttpRequest + 'static {
fn obtain_response(request_factory: &NetworkHttpRequestFactory,
url: &ServoUrl,
method: &Method,
request_headers: &Headers,
data: &Option<Vec<u8>>,
load_data_method: &Method,
pipeline_id: &Option<PipelineId>,
iters: u32,
request_id: Option<&str>,
is_xhr: bool)
-> Result<(WrappedHttpResponse, Option<ChromeToDevtoolsControlMsg>), LoadError> {
let null_data = None;
let response;
let connection_url = replace_hosts(&url);
Expand Down

0 comments on commit fc6fa56

Please sign in to comment.