diff options
Diffstat (limited to 'net/base')
-rw-r--r-- | net/base/host_resolver.h | 16 | ||||
-rw-r--r-- | net/base/host_resolver_impl.cc | 49 | ||||
-rw-r--r-- | net/base/host_resolver_impl.h | 9 | ||||
-rw-r--r-- | net/base/net_error_list.h | 4 | ||||
-rw-r--r-- | net/base/request_priority.cc | 67 | ||||
-rw-r--r-- | net/base/request_priority.h | 6 |
6 files changed, 7 insertions, 144 deletions
diff --git a/net/base/host_resolver.h b/net/base/host_resolver.h index 004e49f..8f53b6b 100644 --- a/net/base/host_resolver.h +++ b/net/base/host_resolver.h @@ -1,5 +1,4 @@ // Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Copyright (c) 2011, Code Aurora Forum. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -17,8 +16,6 @@ #include "net/base/net_export.h" #include "net/base/request_priority.h" -class MessageLoop; - namespace net { class AddressList; @@ -127,13 +124,6 @@ class NET_EXPORT HostResolver { virtual void OnCancelResolution(int id, const RequestInfo& info) = 0; }; - class HostnameResolverExt { - public: - virtual ~HostnameResolverExt() {} - virtual void Resolve()=0; - }; - - virtual void SetResolverExt(HostnameResolverExt* preresolver) {}; // Opaque type used to cancel a request. typedef void* RequestHandle; @@ -255,12 +245,6 @@ NET_EXPORT HostResolver* CreateSystemHostResolver(size_t max_concurrent_resolves HostResolverProc* resolver_proc, NetLog* net_log); -// If specified |net_notification_messageloop| provides a message loop -// to be used for network notifications. -HostResolver* CreateSystemHostResolver(size_t max_concurrent_resolves, - HostResolverProc* resolver_proc, - NetLog* net_log, - MessageLoop* net_notification_messageloop); } // namespace net #endif // NET_BASE_HOST_RESOLVER_H_ diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc index 7fd04fc..1f33369 100644 --- a/net/base/host_resolver_impl.cc +++ b/net/base/host_resolver_impl.cc @@ -1,5 +1,4 @@ // Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Copyright (c) 2011, Code Aurora Forum. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -36,6 +35,7 @@ #include "net/base/net_errors.h" #include "net/base/net_log.h" #include "net/base/net_util.h" + #if defined(OS_WIN) #include "net/base/winsock_init.h" #endif @@ -74,17 +74,6 @@ HostCache* CreateDefaultCache() { HostResolver* CreateSystemHostResolver(size_t max_concurrent_resolves, HostResolverProc* resolver_proc, NetLog* net_log) { -return CreateSystemHostResolver(max_concurrent_resolves, - resolver_proc, - net_log, - NULL); -} - -HostResolver* CreateSystemHostResolver(size_t max_concurrent_resolves, - HostResolverProc* resolver_proc, - NetLog* net_log, - MessageLoop* net_notification_messageloop - ) { // Maximum of 8 concurrent resolver threads. // Some routers (or resolvers) appear to start to provide host-not-found if // too many simultaneous resolutions are pending. This number needs to be @@ -96,7 +85,7 @@ HostResolver* CreateSystemHostResolver(size_t max_concurrent_resolves, HostResolverImpl* resolver = new HostResolverImpl(resolver_proc, CreateDefaultCache(), - max_concurrent_resolves, net_log,net_notification_messageloop); + max_concurrent_resolves, net_log); return resolver; } @@ -915,9 +904,7 @@ HostResolverImpl::HostResolverImpl( HostResolverProc* resolver_proc, HostCache* cache, size_t max_jobs, - NetLog* net_log, - MessageLoop* net_notification_messageloop - ) + NetLog* net_log) : cache_(cache), max_jobs_(max_jobs), next_request_id_(0), @@ -927,10 +914,7 @@ HostResolverImpl::HostResolverImpl( shutdown_(false), ipv6_probe_monitoring_(false), additional_resolver_flags_(0), - net_log_(net_log), - net_notification_messageloop_(net_notification_messageloop), - resolverext_(NULL) -{ + net_log_(net_log) { DCHECK_GT(max_jobs, 0u); // It is cumbersome to expose all of the constraints in the constructor, @@ -944,17 +928,7 @@ HostResolverImpl::HostResolverImpl( if (HaveOnlyLoopbackAddresses()) additional_resolver_flags_ |= HOST_RESOLVER_LOOPBACK_ONLY; #endif - - //register to network notifications via the current thread message loop (if exsits) - //or use the message loop provided in the constructor parameter - if (NULL==net_notification_messageloop_) { - net_notification_messageloop_ = MessageLoop::current(); - } - //add this class as observer for NetworkChangeNotifier - if (net_notification_messageloop_) { - net_notification_messageloop_->PostTask(FROM_HERE, - NewRunnableFunction( &NetworkChangeNotifier::AddIPAddressObserver,this)); - } + NetworkChangeNotifier::AddIPAddressObserver(this); } HostResolverImpl::~HostResolverImpl() { @@ -968,10 +942,7 @@ HostResolverImpl::~HostResolverImpl() { if (cur_completing_job_) cur_completing_job_->Cancel(); - if (net_notification_messageloop_) { - net_notification_messageloop_->PostTask(FROM_HERE, - NewRunnableFunction( &NetworkChangeNotifier::RemoveIPAddressObserver,this)); - } + NetworkChangeNotifier::RemoveIPAddressObserver(this); // Delete the job pools. for (size_t i = 0u; i < arraysize(job_pools_); ++i) @@ -1500,14 +1471,6 @@ void HostResolverImpl::OnIPAddressChanged() { #endif AbortAllInProgressJobs(); // |this| may be deleted inside AbortAllInProgressJobs(). - - if (resolverext_) { - resolverext_->Resolve(); - } } -void HostResolverImpl::SetResolverExt(HostnameResolverExt* resolverext) { - LOG(INFO)<<"HostResolverImpl::SetPreresolver preresolver:"<<resolverext; - resolverext_ = resolverext; - } } // namespace net diff --git a/net/base/host_resolver_impl.h b/net/base/host_resolver_impl.h index 904d896..54e0b9e 100644 --- a/net/base/host_resolver_impl.h +++ b/net/base/host_resolver_impl.h @@ -1,5 +1,4 @@ // Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Copyright (c) 2011, Code Aurora Forum. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -81,9 +80,7 @@ class HostResolverImpl : public HostResolver, HostResolverImpl(HostResolverProc* resolver_proc, HostCache* cache, size_t max_jobs, - NetLog* net_log, - MessageLoop* net_notification_messageloop=NULL - ); + NetLog* net_log); // If any completion callbacks are pending when the resolver is destroyed, // the host resolutions are cancelled, and the completion callbacks will not @@ -131,7 +128,6 @@ class HostResolverImpl : public HostResolver, // TODO(eroman): hack for http://crbug.com/15513 virtual void Shutdown(); - virtual void SetResolverExt(HostnameResolverExt* preresolver); private: class Job; class JobPool; @@ -281,9 +277,6 @@ class HostResolverImpl : public HostResolver, NetLog* net_log_; - MessageLoop* net_notification_messageloop_; - HostnameResolverExt* resolverext_; - DISALLOW_COPY_AND_ASSIGN(HostResolverImpl); }; diff --git a/net/base/net_error_list.h b/net/base/net_error_list.h index e96690d..9e9a980 100644 --- a/net/base/net_error_list.h +++ b/net/base/net_error_list.h @@ -1,5 +1,4 @@ // Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Copyright (c) 2012, Code Aurora Forum. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -445,9 +444,6 @@ NET_ERROR(RESPONSE_HEADERS_MULTIPLE_CONTENT_LENGTH, -346) // headers are missing, so we're expecting additional frames to complete them. NET_ERROR(INCOMPLETE_SPDY_HEADERS, -347) -// GETzip failure - server advices to retry the HTTP request -NET_ERROR(GETZIP, -348) - // SPDY server didn't respond to the PING message. NET_ERROR(SPDY_PING_FAILED, -352) diff --git a/net/base/request_priority.cc b/net/base/request_priority.cc deleted file mode 100644 index dfe083c..0000000 --- a/net/base/request_priority.cc +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Copyright (c) 2012, Code Aurora Forum. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "net/base/request_priority.h" -#include "base/logging.h" - -namespace net { - -RequestPriority DetermineRequestPriority(ResourceType::Type type) -{ - //__android_log_print(ANDROID_LOG_VERBOSE, "Preload", "DetermineRequestPriority, type = %d", type); - - // Determine request priority based on how critical this resource typically - // is to user-perceived page load performance. Important considerations are: - // * Can this resource block the download of other resources. - // * Can this resource block the rendering of the page. - // * How useful is the page to the user if this resource is not loaded yet. - switch (type) { - // Main frames are the highest priority because they can block nearly every - // type of other resource and there is no useful display without them. - // Sub frames are a close second, however it is a common pattern to wrap - // ads in an iframe or even in multiple nested iframes. It is worth - // investigating if there is a better priority for them. - case ResourceType::MAIN_FRAME: - case ResourceType::SUB_FRAME: - return HIGHEST; - - // Stylesheets and scripts can block rendering and loading of other - // resources. Fonts can block text from rendering. - case ResourceType::STYLESHEET: - case ResourceType::SCRIPT: - case ResourceType::FONT_RESOURCE: - return MEDIUM; - - // Sub resources, objects and media are lower priority than potentially - // blocking stylesheets, scripts and fonts, but are higher priority than - // images because if they exist they are probably more central to the page - // focus than images on the page. - case ResourceType::SUB_RESOURCE: - case ResourceType::OBJECT: - case ResourceType::MEDIA: - case ResourceType::WORKER: - case ResourceType::SHARED_WORKER: - return LOW; - - // Images are the "lowest" priority because they typically do not block - // downloads or rendering and most pages have some useful content without - // them. - case ResourceType::IMAGE: - return LOWEST; - - // Prefetches are at a lower priority than even LOWEST, since they - // are not even required for rendering of the current page. - case ResourceType::PREFETCH: - return IDLE; - - default: - // When new resource types are added, their priority must be considered. - NOTREACHED(); - return LOW; - } -} - -} // namespace net - diff --git a/net/base/request_priority.h b/net/base/request_priority.h index ca454bf..ca7a1ec 100644 --- a/net/base/request_priority.h +++ b/net/base/request_priority.h @@ -1,6 +1,4 @@ // Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Copyright (c) 2011, Code Aurora Forum. All rights reserved. -// // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,8 +6,6 @@ #define NET_BASE_REQUEST_PRIORITY_H__ #pragma once -#include "webkit/glue/resource_type.h" - namespace net { // Prioritization used in various parts of the networking code such @@ -23,8 +19,6 @@ enum RequestPriority { NUM_PRIORITIES, }; -RequestPriority DetermineRequestPriority(ResourceType::Type type); - } // namespace net #endif // NET_BASE_REQUEST_PRIORITY_H__ |