summaryrefslogtreecommitdiff
path: root/chromium/content/browser/net
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-07-17 13:57:45 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-07-19 13:44:40 +0000
commit6ec7b8da05d21a3878bd21c691b41e675d74bb1c (patch)
treeb87f250bc19413750b9bb9cdbf2da20ef5014820 /chromium/content/browser/net
parentec02ee4181c49b61fce1c8fb99292dbb8139cc90 (diff)
downloadqtwebengine-chromium-6ec7b8da05d21a3878bd21c691b41e675d74bb1c.tar.gz
BASELINE: Update Chromium to 60.0.3112.70
Change-Id: I9911c2280a014d4632f254857876a395d4baed2d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/content/browser/net')
-rw-r--r--chromium/content/browser/net/network_quality_observer_impl.cc223
-rw-r--r--chromium/content/browser/net/network_quality_observer_impl.h69
-rw-r--r--chromium/content/browser/net/quota_policy_cookie_store.cc22
-rw-r--r--chromium/content/browser/net/quota_policy_cookie_store_unittest.cc67
-rw-r--r--chromium/content/browser/net/view_http_cache_job_factory.cc3
5 files changed, 333 insertions, 51 deletions
diff --git a/chromium/content/browser/net/network_quality_observer_impl.cc b/chromium/content/browser/net/network_quality_observer_impl.cc
new file mode 100644
index 00000000000..b7da9886f64
--- /dev/null
+++ b/chromium/content/browser/net/network_quality_observer_impl.cc
@@ -0,0 +1,223 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/net/network_quality_observer_impl.h"
+
+#include "base/memory/ptr_util.h"
+#include "content/browser/renderer_host/render_process_host_impl.h"
+#include "content/common/view_messages.h"
+#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
+#include "content/public/browser/notification_service.h"
+#include "content/public/browser/notification_types.h"
+#include "content/public/browser/render_process_host.h"
+
+namespace {
+
+// Returns true if the |current_value| is meaningfully different from the
+// |past_value|.
+bool MetricChangedMeaningfully(int32_t past_value, int32_t current_value) {
+ if ((past_value == net::nqe::internal::INVALID_RTT_THROUGHPUT) !=
+ (current_value == net::nqe::internal::INVALID_RTT_THROUGHPUT)) {
+ return true;
+ }
+
+ if (past_value == net::nqe::internal::INVALID_RTT_THROUGHPUT &&
+ current_value == net::nqe::internal::INVALID_RTT_THROUGHPUT) {
+ return false;
+ }
+
+ // Metric has changed meaningfully only if (i) the difference between the two
+ // values exceed the threshold; and, (ii) the ratio of the values also exceeds
+ // the threshold.
+ static const int kMinDifferenceInMetrics = 100;
+ static const float kMinRatio = 1.2f;
+
+ if (std::abs(past_value - current_value) < kMinDifferenceInMetrics) {
+ // The absolute change in the value is not sufficient enough.
+ return false;
+ }
+
+ if (past_value < (kMinRatio * current_value) &&
+ current_value < (kMinRatio * past_value)) {
+ // The relative change in the value is not sufficient enough.
+ return false;
+ }
+
+ return true;
+}
+
+} // namespace
+
+namespace content {
+
+// UiThreadObserver observes the changes to the network quality on the UI
+// thread, and notifies the renderers of the change in the network quality.
+class NetworkQualityObserverImpl::UiThreadObserver
+ : public content::NotificationObserver {
+ public:
+ UiThreadObserver()
+ : last_notified_type_(net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN) {}
+
+ ~UiThreadObserver() override {
+ registrar_.Remove(this, NOTIFICATION_RENDERER_PROCESS_CREATED,
+ NotificationService::AllSources());
+ }
+
+ void InitOnUIThread() {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_CREATED,
+ NotificationService::AllSources());
+ }
+
+ void OnEffectiveConnectionTypeChanged(net::EffectiveConnectionType type) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+
+ if (last_notified_type_ == type)
+ return;
+
+ last_notified_type_ = type;
+
+ // Notify all the existing renderers of the change in the network quality.
+ for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator());
+ !it.IsAtEnd(); it.Advance()) {
+ it.GetCurrentValue()->GetRendererInterface()->OnNetworkQualityChanged(
+ last_notified_type_, last_notified_network_quality_.http_rtt(),
+ last_notified_network_quality_.transport_rtt(),
+ last_notified_network_quality_.downstream_throughput_kbps());
+ }
+ }
+
+ void OnRTTOrThroughputEstimatesComputed(
+ const net::nqe::internal::NetworkQuality& network_quality) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+
+ last_notified_network_quality_ = network_quality;
+
+ // Notify all the existing renderers of the change in the network quality.
+ for (RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator());
+ !it.IsAtEnd(); it.Advance()) {
+ it.GetCurrentValue()->GetRendererInterface()->OnNetworkQualityChanged(
+ last_notified_type_, last_notified_network_quality_.http_rtt(),
+ last_notified_network_quality_.transport_rtt(),
+ last_notified_network_quality_.downstream_throughput_kbps());
+ }
+ }
+
+ private:
+ // NotificationObserver implementation:
+ void Observe(int type,
+ const NotificationSource& source,
+ const NotificationDetails& details) override {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ DCHECK_EQ(NOTIFICATION_RENDERER_PROCESS_CREATED, type);
+
+ RenderProcessHost* rph = Source<RenderProcessHost>(source).ptr();
+
+ // Notify the newly created renderer of the current network quality.
+ rph->GetRendererInterface()->OnNetworkQualityChanged(
+ last_notified_type_, last_notified_network_quality_.http_rtt(),
+ last_notified_network_quality_.transport_rtt(),
+ last_notified_network_quality_.downstream_throughput_kbps());
+ }
+
+ content::NotificationRegistrar registrar_;
+
+ // The network quality that was last sent to the renderers.
+ net::EffectiveConnectionType last_notified_type_;
+ net::nqe::internal::NetworkQuality last_notified_network_quality_;
+
+ DISALLOW_COPY_AND_ASSIGN(UiThreadObserver);
+};
+
+NetworkQualityObserverImpl::NetworkQualityObserverImpl(
+ net::NetworkQualityEstimator* network_quality_estimator)
+ : network_quality_estimator_(network_quality_estimator),
+ last_notified_type_(net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN) {
+ network_quality_estimator_->AddRTTAndThroughputEstimatesObserver(this);
+ network_quality_estimator_->AddEffectiveConnectionTypeObserver(this);
+
+ ui_thread_observer_ = base::MakeUnique<UiThreadObserver>();
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ base::BindOnce(&UiThreadObserver::InitOnUIThread,
+ base::Unretained(ui_thread_observer_.get())));
+}
+
+NetworkQualityObserverImpl::~NetworkQualityObserverImpl() {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ network_quality_estimator_->RemoveRTTAndThroughputEstimatesObserver(this);
+ network_quality_estimator_->RemoveEffectiveConnectionTypeObserver(this);
+
+ DCHECK(ui_thread_observer_);
+
+ // If possible, delete |ui_thread_observer_| on UI thread.
+ UiThreadObserver* ui_thread_observer_ptr = ui_thread_observer_.release();
+ bool posted = BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE,
+ ui_thread_observer_ptr);
+
+ if (!posted)
+ delete ui_thread_observer_ptr;
+}
+
+void NetworkQualityObserverImpl::OnEffectiveConnectionTypeChanged(
+ net::EffectiveConnectionType type) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+
+ if (last_notified_type_ == type)
+ return;
+
+ last_notified_type_ = type;
+
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ base::BindOnce(&UiThreadObserver::OnEffectiveConnectionTypeChanged,
+ base::Unretained(ui_thread_observer_.get()),
+ last_notified_type_));
+}
+
+void NetworkQualityObserverImpl::OnRTTOrThroughputEstimatesComputed(
+ base::TimeDelta http_rtt,
+ base::TimeDelta transport_rtt,
+ int32_t downstream_throughput_kbps) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+
+ // Check if any of the network quality metrics changed meaningfully.
+ bool http_rtt_changed = MetricChangedMeaningfully(
+ last_notified_network_quality_.http_rtt().InMilliseconds(),
+ http_rtt.InMilliseconds());
+
+ bool transport_rtt_changed = MetricChangedMeaningfully(
+ last_notified_network_quality_.transport_rtt().InMilliseconds(),
+ transport_rtt.InMilliseconds());
+ bool kbps_changed = MetricChangedMeaningfully(
+ last_notified_network_quality_.downstream_throughput_kbps(),
+ downstream_throughput_kbps);
+
+ if (!http_rtt_changed && !transport_rtt_changed && !kbps_changed) {
+ // Return since none of the metrics changed meaningfully. This reduces
+ // the number of notifications to the different renderers every time
+ // the network quality is recomputed.
+ return;
+ }
+
+ last_notified_network_quality_ = net::nqe::internal::NetworkQuality(
+ http_rtt, transport_rtt, downstream_throughput_kbps);
+
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ base::BindOnce(&UiThreadObserver::OnRTTOrThroughputEstimatesComputed,
+ base::Unretained(ui_thread_observer_.get()),
+ last_notified_network_quality_));
+}
+
+std::unique_ptr<net::NetworkQualityEstimator::RTTAndThroughputEstimatesObserver>
+CreateNetworkQualityObserver(
+ net::NetworkQualityEstimator* network_quality_estimator) {
+ return base::MakeUnique<NetworkQualityObserverImpl>(
+ network_quality_estimator);
+}
+
+} // namespace content \ No newline at end of file
diff --git a/chromium/content/browser/net/network_quality_observer_impl.h b/chromium/content/browser/net/network_quality_observer_impl.h
new file mode 100644
index 00000000000..915ec17260b
--- /dev/null
+++ b/chromium/content/browser/net/network_quality_observer_impl.h
@@ -0,0 +1,69 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_NET_NETWORK_QUALITY_OBSERVER_IMPL_H_
+#define CONTENT_BROWSER_NET_NETWORK_QUALITY_OBSERVER_IMPL_H_
+
+#include <stdint.h>
+
+#include <memory>
+
+#include "base/macros.h"
+#include "base/threading/thread_checker.h"
+#include "content/common/content_export.h"
+#include "content/public/browser/network_quality_observer_factory.h"
+#include "net/nqe/effective_connection_type.h"
+#include "net/nqe/network_quality.h"
+#include "net/nqe/network_quality_estimator.h"
+
+namespace content {
+
+// Listens for changes to the network quality and manages sending updates to
+// each RenderProcess via mojo.
+class CONTENT_EXPORT NetworkQualityObserverImpl
+ : public net::NetworkQualityEstimator::EffectiveConnectionTypeObserver,
+ public net::NetworkQualityEstimator::RTTAndThroughputEstimatesObserver {
+ public:
+ explicit NetworkQualityObserverImpl(
+ net::NetworkQualityEstimator* network_quality_estimator);
+
+ ~NetworkQualityObserverImpl() override;
+
+ private:
+ class UiThreadObserver;
+
+ // net::NetworkQualityEstimator::EffectiveConnectionTypeObserver
+ // implementation:
+ void OnEffectiveConnectionTypeChanged(
+ net::EffectiveConnectionType type) override;
+
+ // net::NetworkQualityEstimator::RTTAndThroughputEstimatesObserver
+ // implementation:
+ void OnRTTOrThroughputEstimatesComputed(
+ base::TimeDelta http_rtt,
+ base::TimeDelta transport_rtt,
+ int32_t downstream_throughput_kbps) override;
+
+ // |ui_thread_observer_| is owned by |this|, and interacts with
+ // the render processes. It is created on the IO thread but afterwards, should
+ // only be accessed on the UI thread. |ui_thread_observer_| is guaranteed to
+ // be non-null during the lifetime of |this|.
+ std::unique_ptr<UiThreadObserver> ui_thread_observer_;
+
+ // |network_quality_estimator_| is guaranteed to be non-null during the
+ // lifetime of |this|.
+ net::NetworkQualityEstimator* network_quality_estimator_;
+
+ // The network quality when the |ui_thread_observer_| was last notified.
+ net::EffectiveConnectionType last_notified_type_;
+ net::nqe::internal::NetworkQuality last_notified_network_quality_;
+
+ base::ThreadChecker thread_checker_;
+
+ DISALLOW_COPY_AND_ASSIGN(NetworkQualityObserverImpl);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_NET_NETWORK_QUALITY_OBSERVER_IMPL_H_ \ No newline at end of file
diff --git a/chromium/content/browser/net/quota_policy_cookie_store.cc b/chromium/content/browser/net/quota_policy_cookie_store.cc
index 93f3f025c03..22637fe7c4b 100644
--- a/chromium/content/browser/net/quota_policy_cookie_store.cc
+++ b/chromium/content/browser/net/quota_policy_cookie_store.cc
@@ -13,7 +13,8 @@
#include "base/files/file_util.h"
#include "base/memory/ref_counted.h"
#include "base/profiler/scoped_tracker.h"
-#include "base/threading/sequenced_worker_pool.h"
+#include "base/sequenced_task_runner.h"
+#include "base/task_scheduler/post_task.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/cookie_store_factory.h"
#include "net/cookies/canonical_cookie.h"
@@ -109,8 +110,9 @@ void QuotaPolicyCookieStore::OnLoad(
}
CookieStoreConfig::CookieStoreConfig()
- : session_cookie_mode(EPHEMERAL_SESSION_COOKIES),
- crypto_delegate(nullptr) {
+ : session_cookie_mode(EPHEMERAL_SESSION_COOKIES),
+ crypto_delegate(nullptr),
+ channel_id_service(nullptr) {
// Default to an in-memory cookie store.
}
@@ -123,7 +125,8 @@ CookieStoreConfig::CookieStoreConfig(
session_cookie_mode(session_cookie_mode),
storage_policy(storage_policy),
cookie_delegate(cookie_delegate),
- crypto_delegate(nullptr) {
+ crypto_delegate(nullptr),
+ channel_id_service(nullptr) {
CHECK(!path.empty() || session_cookie_mode == EPHEMERAL_SESSION_COOKIES);
}
@@ -154,9 +157,9 @@ std::unique_ptr<net::CookieStore> CreateCookieStore(
}
if (!background_task_runner.get()) {
- background_task_runner =
- BrowserThread::GetBlockingPool()->GetSequencedTaskRunner(
- base::SequencedWorkerPool::GetSequenceToken());
+ background_task_runner = base::CreateSequencedTaskRunnerWithTraits(
+ {base::MayBlock(), base::TaskPriority::BACKGROUND,
+ base::TaskShutdownBehavior::BLOCK_SHUTDOWN});
}
scoped_refptr<net::SQLitePersistentCookieStore> sqlite_store(
@@ -173,8 +176,9 @@ std::unique_ptr<net::CookieStore> CreateCookieStore(
sqlite_store.get(),
config.storage_policy.get());
- cookie_monster.reset(
- new net::CookieMonster(persistent_store, config.cookie_delegate.get()));
+ cookie_monster.reset(new net::CookieMonster(persistent_store,
+ config.cookie_delegate.get(),
+ config.channel_id_service));
if ((config.session_cookie_mode ==
CookieStoreConfig::PERSISTANT_SESSION_COOKIES) ||
(config.session_cookie_mode ==
diff --git a/chromium/content/browser/net/quota_policy_cookie_store_unittest.cc b/chromium/content/browser/net/quota_policy_cookie_store_unittest.cc
index bc6b243a709..ebc38fc10c2 100644
--- a/chromium/content/browser/net/quota_policy_cookie_store_unittest.cc
+++ b/chromium/content/browser/net/quota_policy_cookie_store_unittest.cc
@@ -8,9 +8,10 @@
#include "base/files/scoped_temp_dir.h"
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
+#include "base/sequenced_task_runner.h"
#include "base/synchronization/waitable_event.h"
-#include "base/test/sequenced_worker_pool_owner.h"
-#include "base/threading/sequenced_worker_pool.h"
+#include "base/task_scheduler/post_task.h"
+#include "base/task_scheduler/task_scheduler.h"
#include "base/time/time.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "net/cookies/cookie_util.h"
@@ -36,8 +37,7 @@ using CanonicalCookieVector =
class QuotaPolicyCookieStoreTest : public testing::Test {
public:
QuotaPolicyCookieStoreTest()
- : pool_owner_(new base::SequencedWorkerPoolOwner(3, "Background Pool")),
- loaded_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC,
+ : loaded_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC,
base::WaitableEvent::InitialState::NOT_SIGNALED),
destroy_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC,
base::WaitableEvent::InitialState::NOT_SIGNALED) {}
@@ -56,13 +56,13 @@ class QuotaPolicyCookieStoreTest : public testing::Test {
}
void ReleaseStore() {
- EXPECT_TRUE(background_task_runner()->RunsTasksOnCurrentThread());
+ EXPECT_TRUE(background_task_runner_->RunsTasksInCurrentSequence());
store_ = nullptr;
destroy_event_.Signal();
}
void DestroyStoreOnBackgroundThread() {
- background_task_runner()->PostTask(
+ background_task_runner_->PostTask(
FROM_HERE, base::Bind(&QuotaPolicyCookieStoreTest::ReleaseStore,
base::Unretained(this)));
destroy_event_.Wait();
@@ -70,46 +70,33 @@ class QuotaPolicyCookieStoreTest : public testing::Test {
}
protected:
- scoped_refptr<base::SequencedTaskRunner> background_task_runner() {
- return pool_owner_->pool()->GetSequencedTaskRunner(
- pool_owner_->pool()->GetNamedSequenceToken("background"));
- }
-
- scoped_refptr<base::SequencedTaskRunner> client_task_runner() {
- return pool_owner_->pool()->GetSequencedTaskRunner(
- pool_owner_->pool()->GetNamedSequenceToken("client"));
- }
-
void CreateAndLoad(storage::SpecialStoragePolicy* storage_policy,
CanonicalCookieVector* cookies) {
scoped_refptr<net::SQLitePersistentCookieStore> sqlite_store(
new net::SQLitePersistentCookieStore(
temp_dir_.GetPath().Append(kTestCookiesFilename),
- client_task_runner(), background_task_runner(), true, nullptr));
+ base::CreateSequencedTaskRunnerWithTraits({base::MayBlock()}),
+ background_task_runner_, true, nullptr));
store_ = new QuotaPolicyCookieStore(sqlite_store.get(), storage_policy);
Load(cookies);
}
// Adds a persistent cookie to store_.
- void AddCookie(const GURL& url,
- const std::string& name,
+ void AddCookie(const std::string& name,
const std::string& value,
const std::string& domain,
const std::string& path,
const base::Time& creation) {
- store_->AddCookie(*net::CanonicalCookie::Create(
- url, name, value, domain, path, creation, creation, false, false,
- net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT));
+ store_->AddCookie(net::CanonicalCookie(name, value, domain, path, creation,
+ creation, base::Time(), false, false,
+ net::CookieSameSite::DEFAULT_MODE,
+ net::COOKIE_PRIORITY_DEFAULT));
}
void DestroyStore() {
store_ = nullptr;
- // Ensure that |store_|'s destructor has run by shutting down the pool and
- // then forcing the pool to be destructed. This will ensure that all the
- // tasks that block pool shutdown (e.g. |store_|'s cleanup) have run before
- // yielding control.
- pool_owner_->pool()->FlushForTesting();
- pool_owner_.reset(new base::SequencedWorkerPoolOwner(3, "Background Pool"));
+ // Ensure that |store_|'s destructor has run by flushing TaskScheduler.
+ base::TaskScheduler::GetInstance()->FlushForTesting();
}
void SetUp() override {
@@ -121,7 +108,8 @@ class QuotaPolicyCookieStoreTest : public testing::Test {
}
TestBrowserThreadBundle bundle_;
- std::unique_ptr<base::SequencedWorkerPoolOwner> pool_owner_;
+ const scoped_refptr<base::SequencedTaskRunner> background_task_runner_ =
+ base::CreateSequencedTaskRunnerWithTraits({base::MayBlock()});
base::WaitableEvent loaded_event_;
base::WaitableEvent destroy_event_;
base::ScopedTempDir temp_dir_;
@@ -136,9 +124,9 @@ TEST_F(QuotaPolicyCookieStoreTest, TestPersistence) {
ASSERT_EQ(0U, cookies.size());
base::Time t = base::Time::Now();
- AddCookie(GURL("http://foo.com"), "A", "B", std::string(), "/", t);
+ AddCookie("A", "B", "foo.com", "/", t);
t += base::TimeDelta::FromInternalValue(10);
- AddCookie(GURL("http://persistent.com"), "A", "B", std::string(), "/", t);
+ AddCookie("A", "B", "persistent.com", "/", t);
// Replace the store, which forces the current store to flush data to
// disk. Then, after reloading the store, confirm that the data was flushed by
@@ -180,11 +168,11 @@ TEST_F(QuotaPolicyCookieStoreTest, TestPolicy) {
ASSERT_EQ(0U, cookies.size());
base::Time t = base::Time::Now();
- AddCookie(GURL("http://foo.com"), "A", "B", std::string(), "/", t);
+ AddCookie("A", "B", "foo.com", "/", t);
t += base::TimeDelta::FromInternalValue(10);
- AddCookie(GURL("http://persistent.com"), "A", "B", std::string(), "/", t);
+ AddCookie("A", "B", "persistent.com", "/", t);
t += base::TimeDelta::FromInternalValue(10);
- AddCookie(GURL("http://nonpersistent.com"), "A", "B", std::string(), "/", t);
+ AddCookie("A", "B", "nonpersistent.com", "/", t);
// Replace the store, which forces the current store to flush data to
// disk. Then, after reloading the store, confirm that the data was flushed by
@@ -203,8 +191,7 @@ TEST_F(QuotaPolicyCookieStoreTest, TestPolicy) {
EXPECT_EQ(3U, cookies.size());
t += base::TimeDelta::FromInternalValue(10);
- AddCookie(GURL("http://nonpersistent.com"), "A", "B", std::string(),
- "/second", t);
+ AddCookie("A", "B", "nonpersistent.com", "/second", t);
// Now close the store, and "nonpersistent.com" should be deleted according to
// policy.
@@ -225,7 +212,7 @@ TEST_F(QuotaPolicyCookieStoreTest, ForceKeepSessionState) {
ASSERT_EQ(0U, cookies.size());
base::Time t = base::Time::Now();
- AddCookie(GURL("http://foo.com"), "A", "B", std::string(), "/", t);
+ AddCookie("A", "B", "foo.com", "/", t);
// Recreate |store_| with a storage policy that makes "nonpersistent.com"
// session only, but then instruct the store to forcibly keep all cookies.
@@ -241,9 +228,9 @@ TEST_F(QuotaPolicyCookieStoreTest, ForceKeepSessionState) {
EXPECT_EQ(1U, cookies.size());
t += base::TimeDelta::FromInternalValue(10);
- AddCookie(GURL("http://persistent.com"), "A", "B", std::string(), "/", t);
+ AddCookie("A", "B", "persistent.com", "/", t);
t += base::TimeDelta::FromInternalValue(10);
- AddCookie(GURL("http://nonpersistent.com"), "A", "B", std::string(), "/", t);
+ AddCookie("A", "B", "nonpersistent.com", "/", t);
// Now close the store, but the "nonpersistent.com" cookie should not be
// deleted.
@@ -270,7 +257,7 @@ TEST_F(QuotaPolicyCookieStoreTest, TestDestroyOnBackgroundThread) {
ASSERT_EQ(0U, cookies.size());
base::Time t = base::Time::Now();
- AddCookie(GURL("http://nonpersistent.com"), "A", "B", std::string(), "/", t);
+ AddCookie("A", "B", "nonpersistent.com", "/", t);
// Replace the store, which forces the current store to flush data to
// disk. Then, after reloading the store, confirm that the data was flushed by
diff --git a/chromium/content/browser/net/view_http_cache_job_factory.cc b/chromium/content/browser/net/view_http_cache_job_factory.cc
index ca64341e0d5..179c55be566 100644
--- a/chromium/content/browser/net/view_http_cache_job_factory.cc
+++ b/chromium/content/browser/net/view_http_cache_job_factory.cc
@@ -57,8 +57,7 @@ class ViewHttpCacheJob : public net::URLRequestJob {
public:
Core()
: data_offset_(0),
- callback_(base::Bind(&Core::OnIOComplete, this)) {
- }
+ callback_(base::Bind(&Core::OnIOComplete, base::Unretained(this))) {}
int Start(const net::URLRequest& request, const base::Closure& callback);