diff options
author | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-18 21:15:12 +0000 |
---|---|---|
committer | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-18 21:15:12 +0000 |
commit | a69fe9e3040bb0e202cb7b0274cda473bccf983f (patch) | |
tree | c76428de32e44390554adb57401406c2a61ba3e4 | |
parent | 1eff696aea3737901195a81624ca486a70a988b8 (diff) | |
download | chromium_src-a69fe9e3040bb0e202cb7b0274cda473bccf983f.zip chromium_src-a69fe9e3040bb0e202cb7b0274cda473bccf983f.tar.gz chromium_src-a69fe9e3040bb0e202cb7b0274cda473bccf983f.tar.bz2 |
Removing AccessLog class. This is a partial revert of yzshen's r74872.
The AccessLog class was something we added to track down a crash,
which is no longer happening after that change. Reverting piece by
piece and waiting for the next canary build before doing the next
part.
Note that the use of the AccessLog class could have introduced slight
serialization to the method
URLRequestThrottlerManager::RegisterRequestUrl as it would call the
AccessLog::Add method which synchronized on a lock. So removing is not
100% safe; I will watch for crashes in the canary builds after this.
BUG=71721
TEST=none
Review URL: http://codereview.chromium.org/6538061
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75438 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | net/url_request/url_request_throttler_manager.cc | 64 | ||||
-rw-r--r-- | net/url_request/url_request_throttler_manager.h | 6 |
2 files changed, 1 insertions, 69 deletions
diff --git a/net/url_request/url_request_throttler_manager.cc b/net/url_request/url_request_throttler_manager.cc index 526e4b5..008c235 100644 --- a/net/url_request/url_request_throttler_manager.cc +++ b/net/url_request/url_request_throttler_manager.cc @@ -8,61 +8,6 @@ #include "base/logging.h" #include "base/string_util.h" -#include "base/synchronization/lock.h" -#include "base/threading/platform_thread.h" - -namespace { - -// AccessLog records threads that have accessed the URLRequestThrottlerManager -// singleton object. -// TODO(yzshen): It is used for diagnostic purpose and should be removed once we -// figure out crbug.com/71721 -class AccessLog { - public: - static const size_t kAccessLogSize = 4; - - AccessLog() { - for (size_t i = 0; i < kAccessLogSize; ++i) { - thread_ids_[i] = base::kInvalidThreadId; - urls_[i][0] = '\0'; - } - } - - AccessLog(const AccessLog& log) { - base::AutoLock auto_lock(log.lock_); - for (size_t i = 0; i < kAccessLogSize; ++i) { - thread_ids_[i] = log.thread_ids_[i]; - base::strlcpy(urls_[i], log.urls_[i], kUrlBufferSize); - } - } - - void Add(base::PlatformThreadId id, const GURL& url) { - base::AutoLock auto_lock(lock_); - for (size_t i = 0; i < kAccessLogSize; ++i) { - if (thread_ids_[i] == id) { - return; - } else if (thread_ids_[i] == base::kInvalidThreadId) { - DCHECK(i == 0); - thread_ids_[i] = id; - base::strlcpy(urls_[i], url.spec().c_str(), kUrlBufferSize); - return; - } - } - } - - private: - static const size_t kUrlBufferSize = 128; - - mutable base::Lock lock_; - base::PlatformThreadId thread_ids_[kAccessLogSize]; - // Records the URL argument of the first RegisterRequestUrl() call on each - // thread. - char urls_[kAccessLogSize][kUrlBufferSize]; -}; - -AccessLog access_log; - -} // namespace namespace net { @@ -75,9 +20,6 @@ URLRequestThrottlerManager* URLRequestThrottlerManager::GetInstance() { scoped_refptr<URLRequestThrottlerEntryInterface> URLRequestThrottlerManager::RegisterRequestUrl(const GURL &url) { - if (record_access_log_) - access_log.Add(base::PlatformThread::CurrentId(), url); - // Normalize the url. std::string url_id = GetIdFromUrl(url); @@ -124,13 +66,11 @@ void URLRequestThrottlerManager::EraseEntryForTests(const GURL& url) { void URLRequestThrottlerManager::InitializeOptions(bool enforce_throttling) { enforce_throttling_ = enforce_throttling; - record_access_log_ = true; } URLRequestThrottlerManager::URLRequestThrottlerManager() : requests_since_last_gc_(0), - enforce_throttling_(true), - record_access_log_(false) { + enforce_throttling_(true) { } URLRequestThrottlerManager::~URLRequestThrottlerManager() { @@ -165,8 +105,6 @@ void URLRequestThrottlerManager::GarbageCollectEntriesIfNecessary() { } void URLRequestThrottlerManager::GarbageCollectEntries() { - volatile AccessLog access_log_copy(access_log); - // The more efficient way to remove outdated entries is iterating over all the // elements in the map, and removing those outdated ones during the process. // However, one hypothesis about the cause of crbug.com/71721 is that some diff --git a/net/url_request/url_request_throttler_manager.h b/net/url_request/url_request_throttler_manager.h index 456e84c..58d1985 100644 --- a/net/url_request/url_request_throttler_manager.h +++ b/net/url_request/url_request_throttler_manager.h @@ -102,12 +102,6 @@ class URLRequestThrottlerManager { // period. bool enforce_throttling_; - // Whether to record threads that have accessed the URLRequestThrottlerManager - // singleton object. - // TODO(yzshen): It is used for diagnostic purpose and should be removed once - // we figure out crbug.com/71721 - bool record_access_log_; - DISALLOW_COPY_AND_ASSIGN(URLRequestThrottlerManager); }; |