summaryrefslogtreecommitdiffstats
path: root/chrome/browser/predictors
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/predictors')
-rw-r--r--chrome/browser/predictors/autocomplete_action_predictor.cc7
-rw-r--r--chrome/browser/predictors/resource_prefetch_predictor.cc6
-rw-r--r--chrome/browser/predictors/resource_prefetch_predictor_unittest.cc48
-rw-r--r--chrome/browser/predictors/resource_prefetcher.cc2
4 files changed, 31 insertions, 32 deletions
diff --git a/chrome/browser/predictors/autocomplete_action_predictor.cc b/chrome/browser/predictors/autocomplete_action_predictor.cc
index 1572d80..90d2418f 100644
--- a/chrome/browser/predictors/autocomplete_action_predictor.cc
+++ b/chrome/browser/predictors/autocomplete_action_predictor.cc
@@ -150,10 +150,9 @@ void AutocompleteActionPredictor::StartPrerendering(
content::SessionStorageNamespaceMap::const_iterator it =
session_storage_namespace_map.find(std::string());
if (it != session_storage_namespace_map.end())
- session_storage_namespace = it->second;
- prerender_handle_.reset(
- prerender_manager->AddPrerenderFromOmnibox(
- url, session_storage_namespace, size));
+ session_storage_namespace = it->second.get();
+ prerender_handle_.reset(prerender_manager->AddPrerenderFromOmnibox(
+ url, session_storage_namespace, size));
}
if (old_prerender_handle)
old_prerender_handle->OnCancel();
diff --git a/chrome/browser/predictors/resource_prefetch_predictor.cc b/chrome/browser/predictors/resource_prefetch_predictor.cc
index b37f3a1..e6917df 100644
--- a/chrome/browser/predictors/resource_prefetch_predictor.cc
+++ b/chrome/browser/predictors/resource_prefetch_predictor.cc
@@ -208,7 +208,7 @@ bool ResourcePrefetchPredictor::IsHandledSubresource(
resource_status |= RESOURCE_STATUS_URL_TOO_LONG;
}
- if (!response->response_info().headers)
+ if (!response->response_info().headers.get())
resource_status |= RESOURCE_STATUS_HEADERS_MISSING;
if (!IsCacheable(response))
@@ -229,7 +229,7 @@ bool ResourcePrefetchPredictor::IsCacheable(const net::URLRequest* response) {
// For non cached responses, we will ensure that the freshness lifetime is
// some sane value.
const net::HttpResponseInfo& response_info = response->response_info();
- if (!response_info.headers)
+ if (!response_info.headers.get())
return false;
base::Time response_time(response_info.response_time);
response_time += base::TimeDelta::FromSeconds(1);
@@ -442,7 +442,7 @@ void ResourcePrefetchPredictor::Observe(
}
void ResourcePrefetchPredictor::Shutdown() {
- if (prefetch_manager_) {
+ if (prefetch_manager_.get()) {
prefetch_manager_->ShutdownOnUIThread();
prefetch_manager_ = NULL;
}
diff --git a/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc b/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc
index aa1e02a..cde7ceb 100644
--- a/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc
+++ b/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc
@@ -195,7 +195,7 @@ void ResourcePrefetchPredictorTest::SetUp() {
ResetPredictor();
EXPECT_EQ(predictor_->initialization_state_,
ResourcePrefetchPredictor::NOT_INITIALIZED);
- EXPECT_CALL(*mock_tables_,
+ EXPECT_CALL(*mock_tables_.get(),
GetAllData(Pointee(ContainerEq(PrefetchDataMap())),
Pointee(ContainerEq(PrefetchDataMap()))));
InitializePredictor();
@@ -354,7 +354,7 @@ TEST_F(ResourcePrefetchPredictorTest, LazilyInitializeWithData) {
AddUrlToHistory("http://www.google.com/", 4);
AddUrlToHistory("http://www.yahoo.com/", 2);
- EXPECT_CALL(*mock_tables_,
+ EXPECT_CALL(*mock_tables_.get(),
GetAllData(Pointee(ContainerEq(PrefetchDataMap())),
Pointee(ContainerEq(PrefetchDataMap()))))
.WillOnce(DoAll(SetArgPointee<0>(test_url_data_),
@@ -423,7 +423,7 @@ TEST_F(ResourcePrefetchPredictorTest, NavigationNotRecorded) {
0,
0,
3.0));
- EXPECT_CALL(*mock_tables_, UpdateData(empty_url_data_, host_data));
+ EXPECT_CALL(*mock_tables_.get(), UpdateData(empty_url_data_, host_data));
predictor_->OnNavigationComplete(main_frame.navigation_id);
profile_->BlockUntilHistoryProcessesPendingRequests();
@@ -507,11 +507,11 @@ TEST_F(ResourcePrefetchPredictorTest, NavigationUrlNotInDB) {
0,
0,
7.0));
- EXPECT_CALL(*mock_tables_, UpdateData(url_data, empty_host_data_));
+ EXPECT_CALL(*mock_tables_.get(), UpdateData(url_data, empty_host_data_));
PrefetchData host_data(PREFETCH_KEY_TYPE_HOST, "www.google.com");
host_data.resources = url_data.resources;
- EXPECT_CALL(*mock_tables_, UpdateData(empty_url_data_, host_data));
+ EXPECT_CALL(*mock_tables_.get(), UpdateData(empty_url_data_, host_data));
predictor_->OnNavigationComplete(main_frame.navigation_id);
profile_->BlockUntilHistoryProcessesPendingRequests();
@@ -522,7 +522,7 @@ TEST_F(ResourcePrefetchPredictorTest, NavigationUrlInDB) {
// the database cache.
AddUrlToHistory("http://www.google.com", 4);
- EXPECT_CALL(*mock_tables_,
+ EXPECT_CALL(*mock_tables_.get(),
GetAllData(Pointee(ContainerEq(PrefetchDataMap())),
Pointee(ContainerEq(PrefetchDataMap()))))
.WillOnce(DoAll(SetArgPointee<0>(test_url_data_),
@@ -605,11 +605,11 @@ TEST_F(ResourcePrefetchPredictorTest, NavigationUrlInDB) {
0,
0,
3.0));
- EXPECT_CALL(*mock_tables_, UpdateData(url_data, empty_host_data_));
+ EXPECT_CALL(*mock_tables_.get(), UpdateData(url_data, empty_host_data_));
- EXPECT_CALL(*mock_tables_,
- DeleteSingleDataPoint("www.facebook.com",
- PREFETCH_KEY_TYPE_HOST));
+ EXPECT_CALL(
+ *mock_tables_.get(),
+ DeleteSingleDataPoint("www.facebook.com", PREFETCH_KEY_TYPE_HOST));
PrefetchData host_data(PREFETCH_KEY_TYPE_HOST, "www.google.com");
host_data.resources.push_back(ResourceRow(std::string(),
@@ -640,7 +640,7 @@ TEST_F(ResourcePrefetchPredictorTest, NavigationUrlInDB) {
0,
0,
7.0));
- EXPECT_CALL(*mock_tables_, UpdateData(empty_url_data_, host_data));
+ EXPECT_CALL(*mock_tables_.get(), UpdateData(empty_url_data_, host_data));
predictor_->OnNavigationComplete(main_frame.navigation_id);
profile_->BlockUntilHistoryProcessesPendingRequests();
@@ -650,7 +650,7 @@ TEST_F(ResourcePrefetchPredictorTest, NavigationUrlNotInDBAndDBFull) {
// Tests that a URL is deleted before another is added if the cache is full.
AddUrlToHistory("http://www.nike.com/", 4);
- EXPECT_CALL(*mock_tables_,
+ EXPECT_CALL(*mock_tables_.get(),
GetAllData(Pointee(ContainerEq(PrefetchDataMap())),
Pointee(ContainerEq(PrefetchDataMap()))))
.WillOnce(DoAll(SetArgPointee<0>(test_url_data_),
@@ -680,12 +680,12 @@ TEST_F(ResourcePrefetchPredictorTest, NavigationUrlNotInDBAndDBFull) {
ResourceType::IMAGE, "image/png", false);
predictor_->RecordUrlResponse(resource2);
- EXPECT_CALL(*mock_tables_,
- DeleteSingleDataPoint("http://www.google.com/",
- PREFETCH_KEY_TYPE_URL));
- EXPECT_CALL(*mock_tables_,
- DeleteSingleDataPoint("www.facebook.com",
- PREFETCH_KEY_TYPE_HOST));
+ EXPECT_CALL(
+ *mock_tables_.get(),
+ DeleteSingleDataPoint("http://www.google.com/", PREFETCH_KEY_TYPE_URL));
+ EXPECT_CALL(
+ *mock_tables_.get(),
+ DeleteSingleDataPoint("www.facebook.com", PREFETCH_KEY_TYPE_HOST));
PrefetchData url_data(PREFETCH_KEY_TYPE_URL, "http://www.nike.com/");
url_data.resources.push_back(ResourceRow(std::string(),
@@ -702,11 +702,11 @@ TEST_F(ResourcePrefetchPredictorTest, NavigationUrlNotInDBAndDBFull) {
0,
0,
2.0));
- EXPECT_CALL(*mock_tables_, UpdateData(url_data, empty_host_data_));
+ EXPECT_CALL(*mock_tables_.get(), UpdateData(url_data, empty_host_data_));
PrefetchData host_data(PREFETCH_KEY_TYPE_HOST, "www.nike.com");
host_data.resources = url_data.resources;
- EXPECT_CALL(*mock_tables_, UpdateData(empty_url_data_, host_data));
+ EXPECT_CALL(*mock_tables_.get(), UpdateData(empty_url_data_, host_data));
predictor_->OnNavigationComplete(main_frame.navigation_id);
profile_->BlockUntilHistoryProcessesPendingRequests();
@@ -752,15 +752,15 @@ TEST_F(ResourcePrefetchPredictorTest, DeleteUrls) {
hosts_to_delete.push_back("www.google.com");
hosts_to_delete.push_back("www.apple.com");
- EXPECT_CALL(*mock_tables_,
- DeleteData(ContainerEq(urls_to_delete),
- ContainerEq(hosts_to_delete)));
+ EXPECT_CALL(
+ *mock_tables_.get(),
+ DeleteData(ContainerEq(urls_to_delete), ContainerEq(hosts_to_delete)));
predictor_->DeleteUrls(rows);
EXPECT_EQ(2, static_cast<int>(predictor_->url_table_cache_->size()));
EXPECT_EQ(1, static_cast<int>(predictor_->host_table_cache_->size()));
- EXPECT_CALL(*mock_tables_, DeleteAllData());
+ EXPECT_CALL(*mock_tables_.get(), DeleteAllData());
predictor_->DeleteAllUrls();
EXPECT_TRUE(predictor_->url_table_cache_->empty());
diff --git a/chrome/browser/predictors/resource_prefetcher.cc b/chrome/browser/predictors/resource_prefetcher.cc
index 1fff633..9acbe08 100644
--- a/chrome/browser/predictors/resource_prefetcher.cc
+++ b/chrome/browser/predictors/resource_prefetcher.cc
@@ -167,7 +167,7 @@ void ResourcePrefetcher::ReadFullResponse(net::URLRequest* request) {
int bytes_read = 0;
scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(
kResourceBufferSizeBytes));
- status = request->Read(buffer, kResourceBufferSizeBytes, &bytes_read);
+ status = request->Read(buffer.get(), kResourceBufferSizeBytes, &bytes_read);
if (status) {
status = ShouldContinueReadingRequest(request, bytes_read);