Skip to content

Commit

Permalink
Begin CompletionCallback switchover.
Browse files Browse the repository at this point in the history
Rename CompletionCallback to OldCompletionCallback in preparation for introducing a new CompletionCallback based on base::Callback.

Also renames other CompletionCallback types like CancelableCompletionCallback and TestCompletionCallback and CompletionCallbackImpl. All using sed with s/CompletionCallback/OldCompletionCallback/g.

BUG=98719
TEST=none

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103650 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
willchan@chromium.org committed Oct 1, 2011
1 parent d166653 commit f1f3f0f
Show file tree
Hide file tree
Showing 356 changed files with 2,086 additions and 2,086 deletions.
2 changes: 1 addition & 1 deletion chrome/browser/browsing_data_appcache_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void BrowsingDataAppCacheHelper::StartFetching(Callback0::Type* callback) {

DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
appcache_info_callback_ =
new net::CancelableCompletionCallback<BrowsingDataAppCacheHelper>(
new net::CancelableOldCompletionCallback<BrowsingDataAppCacheHelper>(
this, &BrowsingDataAppCacheHelper::OnFetchComplete);
appcache_service_->GetAllAppCacheInfo(info_collection_,
appcache_info_callback_);
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/browsing_data_appcache_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class BrowsingDataAppCacheHelper

bool is_fetching_;
scoped_refptr<ChromeAppCacheService> appcache_service_;
scoped_refptr<net::CancelableCompletionCallback<BrowsingDataAppCacheHelper> >
scoped_refptr<net::CancelableOldCompletionCallback<BrowsingDataAppCacheHelper> >
appcache_info_callback_;

DISALLOW_COPY_AND_ASSIGN(BrowsingDataAppCacheHelper);
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/browsing_data_remover.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ class BrowsingDataRemover : public NotificationObserver,
static bool removing_;

// Used to delete data from the HTTP caches.
net::CompletionCallbackImpl<BrowsingDataRemover> cache_callback_;
net::OldCompletionCallbackImpl<BrowsingDataRemover> cache_callback_;
CacheState next_cache_state_;
disk_cache::Backend* cache_;

Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/chrome_benchmarking_message_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

namespace {

class ClearCacheCompletion : public net::CompletionCallback {
class ClearCacheCompletion : public net::OldCompletionCallback {
public:
ClearCacheCompletion(ChromeBenchmarkingMessageFilter* filter,
IPC::Message* reply_msg)
Expand Down Expand Up @@ -82,7 +82,7 @@ class DoomEntriesHelper {
disk_cache::Backend* backend_;
disk_cache::Entry* entry_;
void* iter_;
net::CompletionCallbackImpl<DoomEntriesHelper> callback_;
net::OldCompletionCallbackImpl<DoomEntriesHelper> callback_;
ClearCacheCompletion* user_callback_;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ProxyResolverImpl : public ProxyResolverInterface {
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, notify_task_);
}

net::CompletionCallbackImpl<Request> completion_callback_;
net::OldCompletionCallbackImpl<Request> completion_callback_;

std::string source_url_; // URL being resolved.
int result_; // Result of proxy resolution.
Expand Down
8 changes: 4 additions & 4 deletions chrome/browser/extensions/extension_webrequest_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ struct ExtensionWebRequestEventRouter::BlockedRequest {
const net::BoundNetLog* net_log;

// The callback to call when we get a response from all event handlers.
net::CompletionCallback* callback;
net::OldCompletionCallback* callback;

// If non-empty, this contains the new URL that the request will redirect to.
// Only valid for OnBeforeRequest.
Expand Down Expand Up @@ -464,7 +464,7 @@ int ExtensionWebRequestEventRouter::OnBeforeRequest(
void* profile,
ExtensionInfoMap* extension_info_map,
net::URLRequest* request,
net::CompletionCallback* callback,
net::OldCompletionCallback* callback,
GURL* new_url) {
// TODO(jochen): Figure out what to do with events from the system context.
if (!profile)
Expand Down Expand Up @@ -506,7 +506,7 @@ int ExtensionWebRequestEventRouter::OnBeforeSendHeaders(
void* profile,
ExtensionInfoMap* extension_info_map,
net::URLRequest* request,
net::CompletionCallback* callback,
net::OldCompletionCallback* callback,
net::HttpRequestHeaders* headers) {
// TODO(jochen): Figure out what to do with events from the system context.
if (!profile)
Expand Down Expand Up @@ -1282,7 +1282,7 @@ void ExtensionWebRequestEventRouter::DecrementBlockCount(
// distinguished from a regular failure.
if (blocked_request.callback) {
int rv = canceled ? net::ERR_EMPTY_RESPONSE : net::OK;
net::CompletionCallback* callback = blocked_request.callback;
net::OldCompletionCallback* callback = blocked_request.callback;
// Ensure that request is removed before callback because the callback
// might trigger the next event.
blocked_requests_.erase(request_id);
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/extensions/extension_webrequest_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class ExtensionWebRequestEventRouter {
int OnBeforeRequest(void* profile,
ExtensionInfoMap* extension_info_map,
net::URLRequest* request,
net::CompletionCallback* callback,
net::OldCompletionCallback* callback,
GURL* new_url);

// Dispatches the onBeforeSendHeaders event. This is fired for HTTP(s)
Expand All @@ -159,7 +159,7 @@ class ExtensionWebRequestEventRouter {
int OnBeforeSendHeaders(void* profile,
ExtensionInfoMap* extension_info_map,
net::URLRequest* request,
net::CompletionCallback* callback,
net::OldCompletionCallback* callback,
net::HttpRequestHeaders* headers);

// Dispatches the onSendHeaders event. This is fired for HTTP(s) requests
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 @@ -73,7 +73,7 @@ void ChromeNetworkDelegate::InitializeReferrersEnabled(

int ChromeNetworkDelegate::OnBeforeURLRequest(
net::URLRequest* request,
net::CompletionCallback* callback,
net::OldCompletionCallback* callback,
GURL* new_url) {
#if defined(ENABLE_CONFIGURATION_POLICY)
// TODO(joaodasilva): This prevents extensions from seeing URLs that are
Expand All @@ -98,7 +98,7 @@ int ChromeNetworkDelegate::OnBeforeURLRequest(

int ChromeNetworkDelegate::OnBeforeSendHeaders(
net::URLRequest* request,
net::CompletionCallback* callback,
net::OldCompletionCallback* callback,
net::HttpRequestHeaders* headers) {
return ExtensionWebRequestEventRouter::GetInstance()->OnBeforeSendHeaders(
profile_, extension_info_map_.get(), request, callback, headers);
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/net/chrome_network_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ class ChromeNetworkDelegate : public net::NetworkDelegate {
private:
// NetworkDelegate methods:
virtual int OnBeforeURLRequest(net::URLRequest* request,
net::CompletionCallback* callback,
net::OldCompletionCallback* callback,
GURL* new_url) OVERRIDE;
virtual int OnBeforeSendHeaders(net::URLRequest* request,
net::CompletionCallback* callback,
net::OldCompletionCallback* callback,
net::HttpRequestHeaders* headers) OVERRIDE;
virtual void OnSendHeaders(net::URLRequest* request,
const net::HttpRequestHeaders& headers) OVERRIDE;
Expand Down
6 changes: 3 additions & 3 deletions chrome/browser/net/network_stats.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ NetworkStats::~NetworkStats() {
bool NetworkStats::Start(net::HostResolver* host_resolver,
const net::HostPortPair& server_host_port_pair,
uint32 bytes_to_send,
net::CompletionCallback* finished_callback) {
net::OldCompletionCallback* finished_callback) {
DCHECK(bytes_to_send); // We should have data to send.

Initialize(bytes_to_send, finished_callback);
Expand All @@ -114,7 +114,7 @@ bool NetworkStats::Start(net::HostResolver* host_resolver,
}

void NetworkStats::Initialize(uint32 bytes_to_send,
net::CompletionCallback* finished_callback) {
net::OldCompletionCallback* finished_callback) {
DCHECK(bytes_to_send); // We should have data to send.

load_size_ = bytes_to_send;
Expand Down Expand Up @@ -156,7 +156,7 @@ bool NetworkStats::ConnectComplete(int result) {

void NetworkStats::DoFinishCallback(int result) {
if (finished_callback_ != NULL) {
net::CompletionCallback* callback = finished_callback_;
net::OldCompletionCallback* callback = finished_callback_;
finished_callback_ = NULL;
callback->Run(result);
}
Expand Down
14 changes: 7 additions & 7 deletions chrome/browser/net/network_stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class NetworkStats {
bool Start(net::HostResolver* host_resolver,
const net::HostPortPair& server,
uint32 bytes_to_send,
net::CompletionCallback* callback);
net::OldCompletionCallback* callback);

protected:
// Constructs an NetworkStats object that collects metrics for network
Expand All @@ -86,7 +86,7 @@ class NetworkStats {
// server. |finished_callback| is called when we are done with the test.
// |finished_callback| is mainly useful for unittests.
void Initialize(uint32 bytes_to_send,
net::CompletionCallback* finished_callback);
net::OldCompletionCallback* finished_callback);

// Called after host is resolved. UDPStatsClient and TCPStatsClient implement
// this method. They create the socket and connect to the server.
Expand Down Expand Up @@ -177,18 +177,18 @@ class NetworkStats {
net::AddressList addresses_;

// Callback to call when host resolution is completed.
net::CompletionCallbackImpl<NetworkStats> resolve_callback_;
net::OldCompletionCallbackImpl<NetworkStats> resolve_callback_;

// Callback to call when data is read from the server.
net::CompletionCallbackImpl<NetworkStats> read_callback_;
net::OldCompletionCallbackImpl<NetworkStats> read_callback_;

// Callback to call when data is sent to the server.
net::CompletionCallbackImpl<NetworkStats> write_callback_;
net::OldCompletionCallbackImpl<NetworkStats> write_callback_;

// Callback to call when echo protocol is successefully finished or whenever
// there is an error (this allows unittests to wait until echo protocol's
// round trip is finished).
net::CompletionCallback* finished_callback_;
net::OldCompletionCallback* finished_callback_;

// The time when the session was started.
base::TimeTicks start_time_;
Expand Down Expand Up @@ -252,7 +252,7 @@ class TCPStatsClient : public NetworkStats {
void OnConnectComplete(int result);

// Callback to call when connect is completed.
net::CompletionCallbackImpl<TCPStatsClient> connect_callback_;
net::OldCompletionCallbackImpl<TCPStatsClient> connect_callback_;
};

// This collects the network connectivity stats for UDP and TCP for small
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/net/network_stats_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class NetworkStatsTestUDP : public NetworkStatsTest {

protected:
void RunUDPEchoTest(int bytes) {
TestCompletionCallback cb;
TestOldCompletionCallback cb;

scoped_ptr<net::MockHostResolver> host_resolver(
new net::MockHostResolver());
Expand All @@ -61,7 +61,7 @@ class NetworkStatsTestTCP : public NetworkStatsTest {

protected:
void RunTCPEchoTest(int bytes) {
TestCompletionCallback cb;
TestOldCompletionCallback cb;

scoped_ptr<net::MockHostResolver> host_resolver(
new net::MockHostResolver());
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/net/predictor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class Predictor::LookupRequest {
}

// HostResolver will call us using this callback when resolution is complete.
net::CompletionCallbackImpl<LookupRequest> net_callback_;
net::OldCompletionCallbackImpl<LookupRequest> net_callback_;

Predictor* predictor_; // The predictor which started us.

Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/net/view_http_cache_job_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class ViewHttpCacheJob : public net::URLRequestJob {
std::string data_;
int data_offset_;
net::ViewCacheHelper cache_helper_;
net::CompletionCallbackImpl<Core> callback_;
net::OldCompletionCallbackImpl<Core> callback_;
Callback0::Type* user_callback_;

DISALLOW_COPY_AND_ASSIGN(Core);
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/renderer_host/offline_resource_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ bool OfflineResourceHandler::OnWillStart(int request_id,
AddRef(); // Balanced with OnCanHandleOfflineComplete
DCHECK(!appcache_completion_callback_);
appcache_completion_callback_ =
new net::CancelableCompletionCallback<OfflineResourceHandler>(
new net::CancelableOldCompletionCallback<OfflineResourceHandler>(
this, &OfflineResourceHandler::OnCanHandleOfflineComplete);
appcache_service_->CanHandleMainResourceOffline(
url, request_->first_party_for_cookies(),
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/renderer_host/offline_resource_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class OfflineResourceHandler : public ResourceHandler,
int deferred_request_id_;
GURL deferred_url_;

scoped_refptr<net::CancelableCompletionCallback<OfflineResourceHandler> >
scoped_refptr<net::CancelableOldCompletionCallback<OfflineResourceHandler> >
appcache_completion_callback_;

DISALLOW_COPY_AND_ASSIGN(OfflineResourceHandler);
Expand Down
8 changes: 4 additions & 4 deletions chrome/browser/safe_browsing/malware_details_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void WriteHeaders(disk_cache::Entry* entry, const std::string headers) {
reinterpret_cast<const char*>(pickle.data())));
int len = static_cast<int>(pickle.size());

TestCompletionCallback cb;
TestOldCompletionCallback cb;
int rv = entry->WriteData(0, 0, buf, len, &cb, true);
ASSERT_EQ(len, cb.GetResult(rv));
}
Expand All @@ -82,14 +82,14 @@ void WriteData(disk_cache::Entry* entry, const std::string data) {
scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(len));
memcpy(buf->data(), data.data(), data.length());

TestCompletionCallback cb;
TestOldCompletionCallback cb;
int rv = entry->WriteData(1, 0, buf, len, &cb, true);
ASSERT_EQ(len, cb.GetResult(rv));
}

void WriteToEntry(disk_cache::Backend* cache, const std::string key,
const std::string headers, const std::string data) {
TestCompletionCallback cb;
TestOldCompletionCallback cb;
disk_cache::Entry* entry;
int rv = cache->CreateEntry(key, &entry, &cb);
rv = cb.GetResult(rv);
Expand All @@ -104,7 +104,7 @@ void WriteToEntry(disk_cache::Backend* cache, const std::string key,
}

void FillCache(net::URLRequestContextGetter* context_getter) {
TestCompletionCallback cb;
TestOldCompletionCallback cb;
disk_cache::Backend* cache;
int rv =
context_getter->GetURLRequestContext()->http_transaction_factory()->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class P2PSocketDispatcherHost::DnsRequest {

DoneCallback done_callback_;

net::CompletionCallbackImpl<DnsRequest> completion_callback_;
net::OldCompletionCallbackImpl<DnsRequest> completion_callback_;
};

P2PSocketDispatcherHost::P2PSocketDispatcherHost(
Expand Down
6 changes: 3 additions & 3 deletions content/browser/renderer_host/p2p/socket_host_tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ class CONTENT_EXPORT P2PSocketHostTcp : public P2PSocketHost {

bool connected_;

net::CompletionCallbackImpl<P2PSocketHostTcp> connect_callback_;
net::CompletionCallbackImpl<P2PSocketHostTcp> read_callback_;
net::CompletionCallbackImpl<P2PSocketHostTcp> write_callback_;
net::OldCompletionCallbackImpl<P2PSocketHostTcp> connect_callback_;
net::OldCompletionCallbackImpl<P2PSocketHostTcp> read_callback_;
net::OldCompletionCallbackImpl<P2PSocketHostTcp> write_callback_;

DISALLOW_COPY_AND_ASSIGN(P2PSocketHostTcp);
};
Expand Down
2 changes: 1 addition & 1 deletion content/browser/renderer_host/p2p/socket_host_tcp_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class CONTENT_EXPORT P2PSocketHostTcpServer : public P2PSocketHost {
scoped_ptr<net::StreamSocket> accept_socket_;
AcceptedSocketsMap accepted_sockets_;

net::CompletionCallbackImpl<P2PSocketHostTcpServer> accept_callback_;
net::OldCompletionCallbackImpl<P2PSocketHostTcpServer> accept_callback_;

DISALLOW_COPY_AND_ASSIGN(P2PSocketHostTcpServer);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class FakeServerSocket : public net::ServerSocket {
DCHECK(incoming_sockets_.empty());
accept_socket_->reset(socket);
accept_socket_ = NULL;
net::CompletionCallback* cb = accept_callback_;
net::OldCompletionCallback* cb = accept_callback_;
accept_callback_ = NULL;
cb->Run(net::OK);
} else {
Expand All @@ -54,7 +54,7 @@ class FakeServerSocket : public net::ServerSocket {
}

virtual int Accept(scoped_ptr<net::StreamSocket>* socket,
net::CompletionCallback* callback) OVERRIDE {
net::OldCompletionCallback* callback) OVERRIDE {
DCHECK(socket);
if (!incoming_sockets_.empty()) {
socket->reset(incoming_sockets_.front());
Expand All @@ -73,7 +73,7 @@ class FakeServerSocket : public net::ServerSocket {
net::IPEndPoint local_address_;

scoped_ptr<net::StreamSocket>* accept_socket_;
net::CompletionCallback* accept_callback_;
net::OldCompletionCallback* accept_callback_;

std::list<net::StreamSocket*> incoming_sockets_;
};
Expand Down
Loading

0 comments on commit f1f3f0f

Please sign in to comment.