Skip to content

Commit

Permalink
net: Rename URLRequestStatus::os_error_.
Browse files Browse the repository at this point in the history
BUG=92264
TEST=None

R=willchan@chromium.org

Review URL: http://codereview.chromium.org/7846007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100136 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
tfarina@chromium.org committed Sep 8, 2011
1 parent f5d75f7 commit d0cc35b
Show file tree
Hide file tree
Showing 42 changed files with 140 additions and 142 deletions.
6 changes: 3 additions & 3 deletions chrome/browser/automation/url_request_automation_job.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
#include "net/base/host_port_pair.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_util.h"
#include "net/url_request/url_request_context.h"

Expand Down Expand Up @@ -345,8 +345,8 @@ void URLRequestAutomationJob::OnRequestEnd(
// so we don't. We could possibly call OnSSLCertificateError with a NULL
// certificate, but I'm not sure if all implementations expect it.
// if (status.status() == net::URLRequestStatus::FAILED &&
// net::IsCertificateError(status.os_error()) && request_->delegate()) {
// request_->delegate()->OnSSLCertificateError(request_, status.os_error());
// net::IsCertificateError(status.error()) && request_->delegate()) {
// request_->delegate()->OnSSLCertificateError(request_, status.error());
// }

DisconnectFromMessageFilter();
Expand Down
6 changes: 3 additions & 3 deletions chrome/browser/extensions/extension_webrequest_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
#include "content/browser/browser_thread.h"
#include "content/browser/renderer_host/resource_dispatcher_host.h"
#include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
#include "googleurl/src/gurl.h"
#include "grit/generated_resources.h"
#include "net/base/auth.h"
#include "net/base/net_errors.h"
#include "net/base/net_log.h"
#include "net/http/http_response_headers.h"
#include "net/url_request/url_request.h"
#include "googleurl/src/gurl.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"

namespace keys = extension_webrequest_api_constants;
Expand Down Expand Up @@ -822,7 +822,7 @@ void ExtensionWebRequestEventRouter::OnErrorOccurred(
dict->SetString(keys::kIpKey, response_ip);
dict->SetBoolean(keys::kFromCache, request->was_cached());
dict->SetString(keys::kErrorKey,
net::ErrorToString(request->status().os_error()));
net::ErrorToString(request->status().error()));
dict->SetDouble(keys::kTimeStampKey, time.ToDoubleT() * 1000);
args.Append(dict);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ TEST_F(ExtensionWebRequestTest, BlockingEventPrecedenceRedirect) {

EXPECT_TRUE(!request.is_pending());
EXPECT_EQ(net::URLRequestStatus::SUCCESS, request.status().status());
EXPECT_EQ(0, request.status().os_error());
EXPECT_EQ(0, request.status().error());
EXPECT_EQ(redirect_url, request.url());
EXPECT_EQ(2U, request.url_chain().size());
EXPECT_EQ(0U, ipc_sender_.GetNumTasks());
Expand Down Expand Up @@ -220,7 +220,7 @@ TEST_F(ExtensionWebRequestTest, BlockingEventPrecedenceRedirect) {

EXPECT_TRUE(!request2.is_pending());
EXPECT_EQ(net::URLRequestStatus::SUCCESS, request2.status().status());
EXPECT_EQ(0, request2.status().os_error());
EXPECT_EQ(0, request2.status().error());
EXPECT_EQ(redirect_url, request2.url());
EXPECT_EQ(2U, request2.url_chain().size());
EXPECT_EQ(0U, ipc_sender_.GetNumTasks());
Expand Down Expand Up @@ -284,7 +284,7 @@ TEST_F(ExtensionWebRequestTest, BlockingEventPrecedenceCancel) {

EXPECT_TRUE(!request.is_pending());
EXPECT_EQ(net::URLRequestStatus::FAILED, request.status().status());
EXPECT_EQ(net::ERR_EMPTY_RESPONSE, request.status().os_error());
EXPECT_EQ(net::ERR_EMPTY_RESPONSE, request.status().error());
EXPECT_EQ(request_url, request.url());
EXPECT_EQ(1U, request.url_chain().size());
EXPECT_EQ(0U, ipc_sender_.GetNumTasks());
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/net/chrome_dns_cert_provenance_checker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class ChromeDnsCertProvenanceChecker
if (!status.is_success()) {
LOG(WARNING) << "Certificate upload failed"
<< " status:" << status.status()
<< " os_error:" << status.os_error();
<< " error:" << status.error();
} else if (request->GetResponseCode() != 200) {
LOG(WARNING) << "Certificate upload HTTP status: "
<< request->GetResponseCode();
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/net/chrome_network_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ void ForwardProxyErrors(net::URLRequest* request,
ExtensionEventRouterForwarder* event_router,
void* profile) {
if (request->status().status() == net::URLRequestStatus::FAILED) {
switch (request->status().os_error()) {
switch (request->status().error()) {
case net::ERR_PROXY_AUTH_UNSUPPORTED:
case net::ERR_PROXY_CONNECTION_FAILED:
case net::ERR_TUNNEL_CONNECTION_FAILED:
ExtensionProxyEventRouter::GetInstance()->OnProxyError(
event_router, profile, request->status().os_error());
event_router, profile, request->status().error());
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/net/connection_tester.cc
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,8 @@ void ConnectionTester::TestRunner::OnResponseCompleted(
net::URLRequest* request) {
int result = net::OK;
if (!request->status().is_success()) {
DCHECK_NE(net::ERR_IO_PENDING, request->status().os_error());
result = request->status().os_error();
DCHECK_NE(net::ERR_IO_PENDING, request->status().error());
result = request->status().error();
}

// Post a task to notify the parent rather than handling it right away,
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/net/gaia/gaia_oauth_fetcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,8 @@ GoogleServiceAuthError GaiaOAuthFetcher::GenerateAuthError(
return GoogleServiceAuthError(GoogleServiceAuthError::REQUEST_CANCELED);
} else {
LOG(WARNING) << "Could not reach Google Accounts servers: errno "
<< status.os_error();
return GoogleServiceAuthError::FromConnectionError(status.os_error());
<< status.error();
return GoogleServiceAuthError::FromConnectionError(status.error());
}
} else {
LOG(WARNING) << "Unrecognized response from Google Accounts servers.";
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/safe_browsing/malware_details_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void MalwareDetailsCacheCollector::OnURLFetchComplete(
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK(current_fetch_.get());
if (status.status() != net::URLRequestStatus::SUCCESS &&
status.os_error() == net::ERR_CACHE_MISS) {
status.error() == net::ERR_CACHE_MISS) {
// Cache miss, skip this resource.
DVLOG(1) << "Cache miss for url: " << url;
AdvanceEntry();
Expand Down
6 changes: 3 additions & 3 deletions chrome/browser/safe_browsing/protocol_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include "base/metrics/histogram.h"
#include "base/rand_util.h"
#include "base/stl_util.h"
#include "base/stringprintf.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "base/task.h"
#include "base/timer.h"
#include "chrome/browser/safe_browsing/protocol_parser.h"
Expand Down Expand Up @@ -264,7 +264,7 @@ void SafeBrowsingProtocolManager::OnURLFetchComplete(
HandleGetHashError(Time::Now());
if (status.status() == net::URLRequestStatus::FAILED) {
VLOG(1) << "SafeBrowsing GetHash request for: " << source->url()
<< " failed with os error: " << status.os_error();
<< " failed with error: " << status.error();
} else {
VLOG(1) << "SafeBrowsing GetHash request for: " << source->url()
<< " failed with error: " << response_code;
Expand Down Expand Up @@ -338,7 +338,7 @@ void SafeBrowsingProtocolManager::OnURLFetchComplete(
UpdateFinished(false);
if (status.status() == net::URLRequestStatus::FAILED) {
VLOG(1) << "SafeBrowsing request for: " << source->url()
<< " failed with os error: " << status.os_error();
<< " failed with error: " << status.error();
} else {
VLOG(1) << "SafeBrowsing request for: " << source->url()
<< " failed with error: " << response_code;
Expand Down
10 changes: 5 additions & 5 deletions chrome/browser/sync/glue/http_bridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ HttpBridge::URLFetchState::URLFetchState() : url_poster(NULL),
request_completed(false),
request_succeeded(false),
http_response_code(-1),
os_error_code(-1) {}
error_code(-1) {}
HttpBridge::URLFetchState::~URLFetchState() {}

HttpBridge::HttpBridge(HttpBridge::RequestContextGetter* context_getter)
Expand Down Expand Up @@ -181,7 +181,7 @@ void HttpBridge::SetPostPayload(const char* content_type,
}
}

bool HttpBridge::MakeSynchronousPost(int* os_error_code, int* response_code) {
bool HttpBridge::MakeSynchronousPost(int* error_code, int* response_code) {
DCHECK_EQ(MessageLoop::current(), created_on_loop_);
if (DCHECK_IS_ON()) {
base::AutoLock lock(fetch_state_lock_);
Expand All @@ -204,7 +204,7 @@ bool HttpBridge::MakeSynchronousPost(int* os_error_code, int* response_code) {

base::AutoLock lock(fetch_state_lock_);
DCHECK(fetch_state_.request_completed || fetch_state_.aborted);
*os_error_code = fetch_state_.os_error_code;
*error_code = fetch_state_.error_code;
*response_code = fetch_state_.http_response_code;
return fetch_state_.request_succeeded;
}
Expand Down Expand Up @@ -261,7 +261,7 @@ void HttpBridge::Abort() {
BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE,
fetch_state_.url_poster);
fetch_state_.url_poster = NULL;
fetch_state_.os_error_code = net::ERR_ABORTED;
fetch_state_.error_code = net::ERR_ABORTED;
http_post_completed_.Signal();
}

Expand All @@ -280,7 +280,7 @@ void HttpBridge::OnURLFetchComplete(const URLFetcher *source,
fetch_state_.request_succeeded =
(net::URLRequestStatus::SUCCESS == status.status());
fetch_state_.http_response_code = response_code;
fetch_state_.os_error_code = status.os_error();
fetch_state_.error_code = status.error();

fetch_state_.response_content = data;
fetch_state_.response_headers = source->response_headers();
Expand Down
6 changes: 3 additions & 3 deletions chrome/browser/sync/glue/http_bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class HttpBridge : public base::RefCountedThreadSafe<HttpBridge>,
virtual void SetURL(const char* url, int port);
virtual void SetPostPayload(const char* content_type, int content_length,
const char* content);
virtual bool MakeSynchronousPost(int* os_error_code, int* response_code);
virtual bool MakeSynchronousPost(int* error_code, int* response_code);
virtual void Abort();

// WARNING: these response content methods are used to extract plain old data
Expand Down Expand Up @@ -186,15 +186,15 @@ class HttpBridge : public base::RefCountedThreadSafe<HttpBridge>,
bool request_completed;
bool request_succeeded;
int http_response_code;
int os_error_code;
int error_code;
std::string response_content;
scoped_refptr<net::HttpResponseHeaders> response_headers;
};

// This lock synchronizes use of state involved in the flow to fetch a URL
// using URLFetcher. Because we can Abort() from any thread, for example,
// this flow needs to be synchronized to gracefully clean up URLFetcher and
// return appropriate values in os_error_code.
// return appropriate values in |error_code|.
mutable base::Lock fetch_state_lock_;
URLFetchState fetch_state_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ class HttpPostProviderInterface {
const char* content) = 0;

// Returns true if the URL request succeeded. If the request failed,
// os_error() may be non-zero and hence contain more information.
virtual bool MakeSynchronousPost(int* os_error_code, int* response_code) = 0;
// error() may be non-zero and hence contain more information.
virtual bool MakeSynchronousPost(int* error_code, int* response_code) = 0;

// Get the length of the content returned in the HTTP response.
// This does not count the trailing null-terminating character returned
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ bool SyncAPIBridgedConnection::Init(const char* path,
payload.data());

// Issue the POST, blocking until it finishes.
int os_error_code = 0;
int error_code = 0;
int response_code = 0;
if (!http->MakeSynchronousPost(&os_error_code, &response_code)) {
VLOG(1) << "Http POST failed, error returns: " << os_error_code;
response->server_status = os_error_code == net::ERR_ABORTED ?
if (!http->MakeSynchronousPost(&error_code, &response_code)) {
VLOG(1) << "Http POST failed, error returns: " << error_code;
response->server_status = error_code == net::ERR_ABORTED ?
HttpResponse::CONNECTION_UNAVAILABLE : HttpResponse::IO_ERROR;
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ class BlockingHttpPost : public HttpPostProviderInterface {
virtual void SetPostPayload(const char* content_type,
int content_length,
const char* content) OVERRIDE {}
virtual bool MakeSynchronousPost(int* os_error_code, int* response_code)
virtual bool MakeSynchronousPost(int* error_code, int* response_code)
OVERRIDE {
wait_for_abort_.TimedWait(TimeDelta::FromMilliseconds(
TestTimeouts::action_max_timeout_ms()));
*os_error_code = net::ERR_ABORTED;
*error_code = net::ERR_ABORTED;
return false;
}
virtual int GetResponseContentLength() const OVERRIDE {
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/sync/internal_api/syncapi_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ class TestHttpPostProviderInterface : public HttpPostProviderInterface {
virtual void SetPostPayload(const char* content_type,
int content_length,
const char* content) OVERRIDE {}
virtual bool MakeSynchronousPost(int* os_error_code, int* response_code)
virtual bool MakeSynchronousPost(int* error_code, int* response_code)
OVERRIDE {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/sync/test/test_http_bridge_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace browser_sync {

bool TestHttpBridge::MakeSynchronousPost(int* os_error_code,
bool TestHttpBridge::MakeSynchronousPost(int* error_code,
int* response_code) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/sync/test/test_http_bridge_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class TestHttpBridge : public sync_api::HttpPostProviderInterface {
int content_length,
const char* content) OVERRIDE {}

virtual bool MakeSynchronousPost(int* os_error_code,
virtual bool MakeSynchronousPost(int* error_code,
int* response_code) OVERRIDE;

virtual int GetResponseContentLength() const OVERRIDE;
Expand Down
10 changes: 5 additions & 5 deletions chrome/common/net/gaia/gaia_auth_fetcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#include <utility>
#include <vector>

#include "base/stringprintf.h"
#include "base/string_split.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "chrome/common/net/gaia/gaia_auth_consumer.h"
#include "chrome/common/net/gaia/gaia_constants.h"
#include "chrome/common/net/gaia/gaia_urls.h"
Expand Down Expand Up @@ -408,8 +408,8 @@ GoogleServiceAuthError GaiaAuthFetcher::GenerateAuthError(
return GoogleServiceAuthError(GoogleServiceAuthError::REQUEST_CANCELED);
} else {
LOG(WARNING) << "Could not reach Google Accounts servers: errno "
<< status.os_error();
return GoogleServiceAuthError::FromConnectionError(status.os_error());
<< status.error();
return GoogleServiceAuthError::FromConnectionError(status.error());
}
} else {
if (IsSecondFactorSuccess(data)) {
Expand Down Expand Up @@ -461,8 +461,8 @@ GoogleServiceAuthError GaiaAuthFetcher::GenerateOAuthLoginError(
return GoogleServiceAuthError(GoogleServiceAuthError::REQUEST_CANCELED);
} else {
LOG(WARNING) << "Could not reach Google Accounts servers: errno "
<< status.os_error();
return GoogleServiceAuthError::FromConnectionError(status.os_error());
<< status.error();
return GoogleServiceAuthError::FromConnectionError(status.error());
}
} else {
if (IsSecondFactorSuccess(data)) {
Expand Down
8 changes: 4 additions & 4 deletions chrome/renderer/chrome_render_process_observer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
#include "net/base/net_errors.h"
#include "net/base/net_module.h"
#include "third_party/sqlite/sqlite3.h"
#include "third_party/tcmalloc/chromium/src/google/malloc_extension.h"
#include "third_party/tcmalloc/chromium/src/google/heap-profiler.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
#include "third_party/tcmalloc/chromium/src/google/malloc_extension.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebCrossOriginPreflightResultCache.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFontCache.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h"
Expand Down Expand Up @@ -82,13 +82,13 @@ class RendererResourceDelegate : public ResourceDispatcherDelegate {
}

if (status.status() != net::URLRequestStatus::CANCELED ||
status.os_error() == net::ERR_ABORTED) {
status.error() == net::ERR_ABORTED) {
return NULL;
}

// Resource canceled with a specific error are filtered.
return SecurityFilterPeer::CreateSecurityFilterPeerForDeniedRequest(
resource_type, current_peer, status.os_error());
resource_type, current_peer, status.error());
}

virtual webkit_glue::ResourceLoaderBridge::Peer* OnReceivedResponse(
Expand Down
2 changes: 1 addition & 1 deletion chrome_frame/test/url_request_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ TEST(UrlmonUrlRequestTest, UnreachableUrl) {
.WillOnce(QUIT_LOOP_SOON(loop, 2));

EXPECT_CALL(mock, OnResponseEnd(1, testing::Property(
&net::URLRequestStatus::os_error,
&net::URLRequestStatus::error,
net::ERR_TUNNEL_CONNECTION_FAILED)))
.Times(testing::AtMost(1));

Expand Down
6 changes: 3 additions & 3 deletions chrome_frame/urlmon_url_request_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,15 @@ class UrlmonUrlRequest
return result_;
}

void set_result(net::URLRequestStatus::Status status, int os_error) {
void set_result(net::URLRequestStatus::Status status, int error) {
result_.set_status(status);
result_.set_os_error(os_error);
result_.set_error(error);
}

void set_result(HRESULT hr) {
result_.set_status(FAILED(hr)? net::URLRequestStatus::FAILED:
net::URLRequestStatus::SUCCESS);
result_.set_os_error(HresultToNetError(hr));
result_.set_error(HresultToNetError(hr));
}

private:
Expand Down
4 changes: 2 additions & 2 deletions content/browser/download/download_resource_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ bool DownloadResourceHandler::OnResponseCompleted(
VLOG(20) << __FUNCTION__ << "()" << DebugString()
<< " request_id = " << request_id
<< " status.status() = " << status.status()
<< " status.os_error() = " << status.os_error();
<< " status.error() = " << status.error();
net::Error error_code = (status.status() == net::URLRequestStatus::FAILED) ?
static_cast<net::Error>(status.os_error()) : net::OK;
static_cast<net::Error>(status.error()) : net::OK;
// We transfer ownership to |DownloadFileManager| to delete |buffer_|,
// so that any functions queued up on the FILE thread are executed
// before deletion.
Expand Down
Loading

0 comments on commit d0cc35b

Please sign in to comment.