Skip to content

Commit

Permalink
Add OVERRIDE throughout net/proxy/*
Browse files Browse the repository at this point in the history
In the process I discovered 2 dummy virtual overrides of NetworkDelegate interface. (Interface it was trying to overwrite no longer exists).

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93664 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
eroman@chromium.org committed Jul 22, 2011
1 parent 800df5f commit c4c1b48
Show file tree
Hide file tree
Showing 29 changed files with 217 additions and 197 deletions.
11 changes: 4 additions & 7 deletions net/proxy/mock_proxy_resolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,12 @@ class MockAsyncProxyResolverBase : public ProxyResolver {
ProxyInfo* results,
CompletionCallback* callback,
RequestHandle* request_handle,
const BoundNetLog& /*net_log*/);

virtual void CancelRequest(RequestHandle request_handle);

const BoundNetLog& /*net_log*/) OVERRIDE;
virtual void CancelRequest(RequestHandle request_handle) OVERRIDE;
virtual int SetPacScript(
const scoped_refptr<ProxyResolverScriptData>& script_data,
CompletionCallback* callback);

virtual void CancelSetPacScript();
CompletionCallback* callback) OVERRIDE;
virtual void CancelSetPacScript() OVERRIDE;

const RequestsList& pending_requests() const {
return pending_requests_;
Expand Down
8 changes: 4 additions & 4 deletions net/proxy/multi_threaded_proxy_resolver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class MultiThreadedProxyResolver::SetPacScriptJob
}

// Runs on the worker thread.
virtual void Run(scoped_refptr<base::MessageLoopProxy> origin_loop) {
virtual void Run(scoped_refptr<base::MessageLoopProxy> origin_loop) OVERRIDE {
ProxyResolver* resolver = executor()->resolver();
int rv = resolver->SetPacScript(script_data_, NULL);

Expand Down Expand Up @@ -232,13 +232,13 @@ class MultiThreadedProxyResolver::GetProxyForURLJob

BoundNetLog* net_log() { return &net_log_; }

virtual void WaitingForThread() {
virtual void WaitingForThread() OVERRIDE {
was_waiting_for_thread_ = true;
net_log_.BeginEvent(
NetLog::TYPE_WAITING_FOR_PROXY_RESOLVER_THREAD, NULL);
}

virtual void FinishedWaitingForThread() {
virtual void FinishedWaitingForThread() OVERRIDE {
DCHECK(executor());

if (was_waiting_for_thread_) {
Expand All @@ -253,7 +253,7 @@ class MultiThreadedProxyResolver::GetProxyForURLJob
}

// Runs on the worker thread.
virtual void Run(scoped_refptr<base::MessageLoopProxy> origin_loop) {
virtual void Run(scoped_refptr<base::MessageLoopProxy> origin_loop) OVERRIDE {
ProxyResolver* resolver = executor()->resolver();
int rv = resolver->GetProxyForURL(
url_, &results_buf_, NULL, NULL, net_log_);
Expand Down
10 changes: 5 additions & 5 deletions net/proxy/multi_threaded_proxy_resolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ class NET_TEST MultiThreadedProxyResolver
ProxyInfo* results,
CompletionCallback* callback,
RequestHandle* request,
const BoundNetLog& net_log);
virtual void CancelRequest(RequestHandle request);
virtual void CancelSetPacScript();
virtual void PurgeMemory();
const BoundNetLog& net_log) OVERRIDE;
virtual void CancelRequest(RequestHandle request) OVERRIDE;
virtual void CancelSetPacScript() OVERRIDE;
virtual void PurgeMemory() OVERRIDE;
virtual int SetPacScript(
const scoped_refptr<ProxyResolverScriptData>& script_data,
CompletionCallback* callback);
CompletionCallback* callback) OVERRIDE;

private:
class Executor;
Expand Down
28 changes: 14 additions & 14 deletions net/proxy/multi_threaded_proxy_resolver_unittest.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 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.

Expand Down Expand Up @@ -40,7 +40,7 @@ class MockProxyResolver : public ProxyResolver {
ProxyInfo* results,
CompletionCallback* callback,
RequestHandle* request,
const BoundNetLog& net_log) {
const BoundNetLog& net_log) OVERRIDE {
if (resolve_latency_ms_)
base::PlatformThread::Sleep(resolve_latency_ms_);

Expand All @@ -58,23 +58,23 @@ class MockProxyResolver : public ProxyResolver {
return request_count_++;
}

virtual void CancelRequest(RequestHandle request) {
virtual void CancelRequest(RequestHandle request) OVERRIDE {
NOTREACHED();
}

virtual void CancelSetPacScript() {
virtual void CancelSetPacScript() OVERRIDE {
NOTREACHED();
}

virtual int SetPacScript(
const scoped_refptr<ProxyResolverScriptData>& script_data,
CompletionCallback* callback) {
CompletionCallback* callback) OVERRIDE {
CheckIsOnWorkerThread();
last_script_data_ = script_data;
return OK;
}

virtual void PurgeMemory() {
virtual void PurgeMemory() OVERRIDE {
CheckIsOnWorkerThread();
++purge_count_;
}
Expand Down Expand Up @@ -139,7 +139,7 @@ class BlockableProxyResolver : public MockProxyResolver {
ProxyInfo* results,
CompletionCallback* callback,
RequestHandle* request,
const BoundNetLog& net_log) {
const BoundNetLog& net_log) OVERRIDE {
if (should_block_) {
blocked_.Signal();
unblocked_.Wait();
Expand All @@ -166,26 +166,26 @@ class ForwardingProxyResolver : public ProxyResolver {
ProxyInfo* results,
CompletionCallback* callback,
RequestHandle* request,
const BoundNetLog& net_log) {
const BoundNetLog& net_log) OVERRIDE {
return impl_->GetProxyForURL(
query_url, results, callback, request, net_log);
}

virtual void CancelRequest(RequestHandle request) {
virtual void CancelRequest(RequestHandle request) OVERRIDE {
impl_->CancelRequest(request);
}

virtual void CancelSetPacScript() {
virtual void CancelSetPacScript() OVERRIDE {
impl_->CancelSetPacScript();
}

virtual int SetPacScript(
const scoped_refptr<ProxyResolverScriptData>& script_data,
CompletionCallback* callback) {
CompletionCallback* callback) OVERRIDE {
return impl_->SetPacScript(script_data, callback);
}

virtual void PurgeMemory() {
virtual void PurgeMemory() OVERRIDE {
impl_->PurgeMemory();
}

Expand All @@ -201,7 +201,7 @@ class ForwardingProxyResolverFactory : public ProxyResolverFactory {
: ProxyResolverFactory(resolver->expects_pac_bytes()),
resolver_(resolver) {}

virtual ProxyResolver* CreateProxyResolver() {
virtual ProxyResolver* CreateProxyResolver() OVERRIDE {
return new ForwardingProxyResolver(resolver_);
}

Expand All @@ -218,7 +218,7 @@ class BlockableProxyResolverFactory : public ProxyResolverFactory {
STLDeleteElements(&resolvers_);
}

virtual ProxyResolver* CreateProxyResolver() {
virtual ProxyResolver* CreateProxyResolver() OVERRIDE {
BlockableProxyResolver* resolver = new BlockableProxyResolver;
resolvers_.push_back(resolver);
return new ForwardingProxyResolver(resolver);
Expand Down
4 changes: 3 additions & 1 deletion net/proxy/network_delegate_error_observer.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#define NET_PROXY_NETWORK_DELEGATE_ERROR_OBSERVER_H_
#pragma once

#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "net/proxy/proxy_resolver_error_observer.h"

Expand All @@ -27,7 +28,8 @@ class NET_TEST NetworkDelegateErrorObserver
virtual ~NetworkDelegateErrorObserver();

// ProxyResolverErrorObserver implementation.
virtual void OnPACScriptError(int line_number, const string16& error);
virtual void OnPACScriptError(int line_number, const string16& error)
OVERRIDE;

private:
class Core;
Expand Down
23 changes: 10 additions & 13 deletions net/proxy/network_delegate_error_observer_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,26 @@ class TestNetworkDelegate : public net::NetworkDelegate {
// net::NetworkDelegate:
virtual int OnBeforeURLRequest(URLRequest* request,
CompletionCallback* callback,
GURL* new_url) {
GURL* new_url) OVERRIDE {
return net::OK;
}
virtual int OnBeforeSendHeaders(URLRequest* request,
CompletionCallback* callback,
HttpRequestHeaders* headers) {
HttpRequestHeaders* headers) OVERRIDE {
return net::OK;
}
virtual void OnSendHeaders(URLRequest* request,
const HttpRequestHeaders& headers) {}
const HttpRequestHeaders& headers) OVERRIDE {}
virtual void OnBeforeRedirect(URLRequest* request,
const GURL& new_location) {}
virtual void OnResponseStarted(URLRequest* request) {}
const GURL& new_location) OVERRIDE {}
virtual void OnResponseStarted(URLRequest* request) OVERRIDE {}
virtual void OnRawBytesRead(const URLRequest& request,
int bytes_read) {}
virtual void OnCompleted(URLRequest* request) {}
virtual void OnURLRequestDestroyed(URLRequest* request) {}
virtual void OnHttpTransactionDestroyed(uint64 request_id) {}
virtual URLRequestJob* OnMaybeCreateURLRequestJob(URLRequest* request) {
return NULL;
}
int bytes_read) OVERRIDE {}
virtual void OnCompleted(URLRequest* request) OVERRIDE {}
virtual void OnURLRequestDestroyed(URLRequest* request) OVERRIDE {}

virtual void OnPACScriptError(int line_number,
const string16& error) {
const string16& error) OVERRIDE {
got_pac_error_ = true;
}

Expand Down
9 changes: 5 additions & 4 deletions net/proxy/polling_proxy_config_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#define NET_PROXY_POLLING_PROXY_CONFIG_SERVICE_H_
#pragma once

#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "base/time.h"
#include "net/proxy/proxy_config_service.h"
Expand All @@ -20,10 +21,10 @@ namespace net {
class NET_TEST PollingProxyConfigService : public ProxyConfigService {
public:
// ProxyConfigService implementation:
virtual void AddObserver(Observer* observer);
virtual void RemoveObserver(Observer* observer);
virtual ConfigAvailability GetLatestProxyConfig(ProxyConfig* config);
virtual void OnLazyPoll();
virtual void AddObserver(Observer* observer) OVERRIDE;
virtual void RemoveObserver(Observer* observer) OVERRIDE;
virtual ConfigAvailability GetLatestProxyConfig(ProxyConfig* config) OVERRIDE;
virtual void OnLazyPoll() OVERRIDE;

protected:
// Function for retrieving the current proxy configuration.
Expand Down
18 changes: 9 additions & 9 deletions net/proxy/proxy_bypass_rules.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class HostnamePatternRule : public ProxyBypassRules::Rule {
optional_port_(optional_port) {
}

virtual bool Matches(const GURL& url) const {
virtual bool Matches(const GURL& url) const OVERRIDE {
if (optional_port_ != -1 && url.EffectiveIntPort() != optional_port_)
return false; // Didn't match port expectation.

Expand All @@ -37,7 +37,7 @@ class HostnamePatternRule : public ProxyBypassRules::Rule {
return MatchPattern(StringToLowerASCII(url.host()), hostname_pattern_);
}

virtual std::string ToString() const {
virtual std::string ToString() const OVERRIDE {
std::string str;
if (!optional_scheme_.empty())
base::StringAppendF(&str, "%s://", optional_scheme_.c_str());
Expand All @@ -47,7 +47,7 @@ class HostnamePatternRule : public ProxyBypassRules::Rule {
return str;
}

virtual Rule* Clone() const {
virtual Rule* Clone() const OVERRIDE {
return new HostnamePatternRule(optional_scheme_,
hostname_pattern_,
optional_port_);
Expand All @@ -61,18 +61,18 @@ class HostnamePatternRule : public ProxyBypassRules::Rule {

class BypassLocalRule : public ProxyBypassRules::Rule {
public:
virtual bool Matches(const GURL& url) const {
virtual bool Matches(const GURL& url) const OVERRIDE {
const std::string& host = url.host();
if (host == "127.0.0.1" || host == "[::1]")
return true;
return host.find('.') == std::string::npos;
}

virtual std::string ToString() const {
virtual std::string ToString() const OVERRIDE {
return "<local>";
}

virtual Rule* Clone() const {
virtual Rule* Clone() const OVERRIDE {
return new BypassLocalRule();
}
};
Expand All @@ -93,7 +93,7 @@ class BypassIPBlockRule : public ProxyBypassRules::Rule {
prefix_length_in_bits_(prefix_length_in_bits) {
}

virtual bool Matches(const GURL& url) const {
virtual bool Matches(const GURL& url) const OVERRIDE {
if (!url.HostIsIPAddress())
return false;

Expand All @@ -110,11 +110,11 @@ class BypassIPBlockRule : public ProxyBypassRules::Rule {
prefix_length_in_bits_);
}

virtual std::string ToString() const {
virtual std::string ToString() const OVERRIDE {
return description_;
}

virtual Rule* Clone() const {
virtual Rule* Clone() const OVERRIDE {
return new BypassIPBlockRule(description_,
optional_scheme_,
ip_prefix_,
Expand Down
7 changes: 4 additions & 3 deletions net/proxy/proxy_config_service_fixed.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#define NET_PROXY_PROXY_CONFIG_SERVICE_FIXED_H_
#pragma once

#include "base/compiler_specific.h"
#include "net/base/net_errors.h"
#include "net/proxy/proxy_config.h"
#include "net/proxy/proxy_config_service.h"
Expand All @@ -19,9 +20,9 @@ class NET_API ProxyConfigServiceFixed : public ProxyConfigService {
virtual ~ProxyConfigServiceFixed();

// ProxyConfigService methods:
virtual void AddObserver(Observer* observer) {}
virtual void RemoveObserver(Observer* observer) {}
virtual ConfigAvailability GetLatestProxyConfig(ProxyConfig* config);
virtual void AddObserver(Observer* observer) OVERRIDE {}
virtual void RemoveObserver(Observer* observer) OVERRIDE {}
virtual ConfigAvailability GetLatestProxyConfig(ProxyConfig* config) OVERRIDE;

private:
ProxyConfig pc_;
Expand Down
Loading

0 comments on commit c4c1b48

Please sign in to comment.