summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-04 09:46:51 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-04 09:46:51 +0000
commitbe7b41e8ba4e2629a5ad62cacb1d5983e0797e4c (patch)
tree0d62275a8d7603ea512f9b3a5d25e78dc6b0c525
parent60f59cdcb8eec9a21b6a07ded9390da3f7f9d5c7 (diff)
downloadchromium_src-be7b41e8ba4e2629a5ad62cacb1d5983e0797e4c.zip
chromium_src-be7b41e8ba4e2629a5ad62cacb1d5983e0797e4c.tar.gz
chromium_src-be7b41e8ba4e2629a5ad62cacb1d5983e0797e4c.tar.bz2
content/common/ shouldn't extend the webkit_glue namespace. Move contents of resource_dispatcher.{h,cc} into the content namespace.
R=jam@chromium.org Review URL: https://chromiumcodereview.appspot.com/10690069 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145448 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/common/child_thread.cc1
-rw-r--r--content/common/child_thread.h9
-rw-r--r--content/common/resource_dispatcher.cc51
-rw-r--r--content/common/resource_dispatcher.h15
-rw-r--r--content/common/resource_dispatcher_unittest.cc10
5 files changed, 46 insertions, 40 deletions
diff --git a/content/common/child_thread.cc b/content/common/child_thread.cc
index e2f1b20..550622a 100644
--- a/content/common/child_thread.cc
+++ b/content/common/child_thread.cc
@@ -28,6 +28,7 @@
#include "content/common/handle_enumerator_win.h"
#endif
+using content::ResourceDispatcher;
using tracked_objects::ThreadData;
ChildThread::ChildThread() {
diff --git a/content/common/child_thread.h b/content/common/child_thread.h
index 9a16aec..1a1d1a2 100644
--- a/content/common/child_thread.h
+++ b/content/common/child_thread.h
@@ -18,9 +18,12 @@
class FileSystemDispatcher;
class MessageLoop;
class QuotaDispatcher;
-class ResourceDispatcher;
class SocketStreamDispatcher;
+namespace content {
+class ResourceDispatcher;
+}
+
namespace IPC {
class SyncChannel;
class SyncMessageFilter;
@@ -61,7 +64,7 @@ class CONTENT_EXPORT ChildThread : public IPC::Listener, public IPC::Sender {
// but on windows the child process directly allocates the block.
base::SharedMemory* AllocateSharedMemory(size_t buf_size);
- ResourceDispatcher* resource_dispatcher();
+ content::ResourceDispatcher* resource_dispatcher();
SocketStreamDispatcher* socket_stream_dispatcher() {
return socket_stream_dispatcher_.get();
@@ -129,7 +132,7 @@ class CONTENT_EXPORT ChildThread : public IPC::Listener, public IPC::Sender {
MessageRouter router_;
// Handles resource loads for this process.
- scoped_ptr<ResourceDispatcher> resource_dispatcher_;
+ scoped_ptr<content::ResourceDispatcher> resource_dispatcher_;
// Handles SocketStream for this process.
scoped_ptr<SocketStreamDispatcher> socket_stream_dispatcher_;
diff --git a/content/common/resource_dispatcher.cc b/content/common/resource_dispatcher.cc
index 404558b..cbc98c5 100644
--- a/content/common/resource_dispatcher.cc
+++ b/content/common/resource_dispatcher.cc
@@ -24,11 +24,10 @@
#include "net/http/http_response_headers.h"
#include "webkit/glue/resource_type.h"
-using content::InterProcessTimeTicksConverter;
-using content::LocalTimeDelta;
-using content::LocalTimeTicks;
-using content::RemoteTimeDelta;
-using content::RemoteTimeTicks;
+using webkit_glue::ResourceLoaderBridge;
+using webkit_glue::ResourceResponseInfo;
+
+namespace content {
// Each resource request is assigned an ID scoped to this process.
static int MakeRequestID() {
@@ -41,12 +40,10 @@ static int MakeRequestID() {
// ResourceLoaderBridge implementation ----------------------------------------
-namespace webkit_glue {
-
class IPCResourceLoaderBridge : public ResourceLoaderBridge {
public:
IPCResourceLoaderBridge(ResourceDispatcher* dispatcher,
- const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info);
+ const ResourceLoaderBridge::RequestInfo& request_info);
virtual ~IPCResourceLoaderBridge();
// ResourceLoaderBridge
@@ -85,7 +82,7 @@ class IPCResourceLoaderBridge : public ResourceLoaderBridge {
IPCResourceLoaderBridge::IPCResourceLoaderBridge(
ResourceDispatcher* dispatcher,
- const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info)
+ const ResourceLoaderBridge::RequestInfo& request_info)
: peer_(NULL),
dispatcher_(dispatcher),
request_id_(-1),
@@ -124,7 +121,7 @@ IPCResourceLoaderBridge::IPCResourceLoaderBridge(
request_.parent_is_main_frame = false;
request_.parent_frame_id = -1;
request_.allow_download = true;
- request_.transition_type = content::PAGE_TRANSITION_LINK;
+ request_.transition_type = PAGE_TRANSITION_LINK;
request_.transferred_request_child_id = -1;
request_.transferred_request_request_id = -1;
}
@@ -235,7 +232,7 @@ void IPCResourceLoaderBridge::SyncLoad(SyncLoadResponse* response) {
request_id_ = MakeRequestID();
is_synchronous_request_ = true;
- content::SyncLoadResult result;
+ SyncLoadResult result;
IPC::SyncMessage* msg = new ResourceHostMsg_SyncLoad(routing_id_, request_id_,
request_, &result);
// NOTE: This may pump events (see RenderThread::Send).
@@ -260,8 +257,6 @@ void IPCResourceLoaderBridge::SyncLoad(SyncLoadResponse* response) {
response->download_file_path = result.download_file_path;
}
-} // namespace webkit_glue
-
// ResourceDispatcher ---------------------------------------------------------
ResourceDispatcher::ResourceDispatcher(IPC::Sender* sender)
@@ -340,21 +335,21 @@ void ResourceDispatcher::OnUploadProgress(
}
void ResourceDispatcher::OnReceivedResponse(
- int request_id, const content::ResourceResponseHead& response_head) {
+ int request_id, const ResourceResponseHead& response_head) {
PendingRequestInfo* request_info = GetPendingRequestInfo(request_id);
if (!request_info)
return;
request_info->response_start = base::TimeTicks::Now();
if (delegate_) {
- webkit_glue::ResourceLoaderBridge::Peer* new_peer =
+ ResourceLoaderBridge::Peer* new_peer =
delegate_->OnReceivedResponse(
request_info->peer, response_head.mime_type, request_info->url);
if (new_peer)
request_info->peer = new_peer;
}
- webkit_glue::ResourceResponseInfo renderer_response_info;
+ ResourceResponseInfo renderer_response_info;
ToResourceResponseInfo(*request_info, response_head, &renderer_response_info);
request_info->peer->OnReceivedResponse(renderer_response_info);
}
@@ -410,7 +405,7 @@ void ResourceDispatcher::OnReceivedRedirect(
const IPC::Message& message,
int request_id,
const GURL& new_url,
- const content::ResourceResponseHead& response_head) {
+ const ResourceResponseHead& response_head) {
PendingRequestInfo* request_info = GetPendingRequestInfo(request_id);
if (!request_info)
return;
@@ -419,7 +414,7 @@ void ResourceDispatcher::OnReceivedRedirect(
int32 routing_id = message.routing_id();
bool has_new_first_party_for_cookies = false;
GURL new_first_party_for_cookies;
- webkit_glue::ResourceResponseInfo renderer_response_info;
+ ResourceResponseInfo renderer_response_info;
ToResourceResponseInfo(*request_info, response_head, &renderer_response_info);
if (request_info->peer->OnReceivedRedirect(new_url, renderer_response_info,
&has_new_first_party_for_cookies,
@@ -459,10 +454,10 @@ void ResourceDispatcher::OnRequestComplete(
return;
request_info->completion_time = base::TimeTicks::Now();
- webkit_glue::ResourceLoaderBridge::Peer* peer = request_info->peer;
+ ResourceLoaderBridge::Peer* peer = request_info->peer;
if (delegate_) {
- webkit_glue::ResourceLoaderBridge::Peer* new_peer =
+ ResourceLoaderBridge::Peer* new_peer =
delegate_->OnRequestComplete(
request_info->peer, request_info->resource_type, status);
if (new_peer)
@@ -478,7 +473,7 @@ void ResourceDispatcher::OnRequestComplete(
}
int ResourceDispatcher::AddPendingRequest(
- webkit_glue::ResourceLoaderBridge::Peer* callback,
+ ResourceLoaderBridge::Peer* callback,
ResourceType::Type resource_type,
const GURL& request_url) {
// Compute a unique request_id for this renderer process.
@@ -580,15 +575,15 @@ void ResourceDispatcher::FlushDeferredMessages(int request_id) {
}
}
-webkit_glue::ResourceLoaderBridge* ResourceDispatcher::CreateBridge(
- const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) {
- return new webkit_glue::IPCResourceLoaderBridge(this, request_info);
+ResourceLoaderBridge* ResourceDispatcher::CreateBridge(
+ const ResourceLoaderBridge::RequestInfo& request_info) {
+ return new IPCResourceLoaderBridge(this, request_info);
}
void ResourceDispatcher::ToResourceResponseInfo(
const PendingRequestInfo& request_info,
- const content::ResourceResponseHead& browser_info,
- webkit_glue::ResourceResponseInfo* renderer_info) const {
+ const ResourceResponseHead& browser_info,
+ ResourceResponseInfo* renderer_info) const {
*renderer_info = browser_info;
if (request_info.request_start.is_null() ||
request_info.response_start.is_null() ||
@@ -596,7 +591,7 @@ void ResourceDispatcher::ToResourceResponseInfo(
browser_info.response_start.is_null()) {
return;
}
- content::InterProcessTimeTicksConverter converter(
+ InterProcessTimeTicksConverter converter(
LocalTimeTicks::FromTimeTicks(request_info.request_start),
LocalTimeTicks::FromTimeTicks(request_info.response_start),
RemoteTimeTicks::FromTimeTicks(browser_info.request_start),
@@ -694,3 +689,5 @@ void ResourceDispatcher::ReleaseResourcesInMessageQueue(MessageQueue* queue) {
delete message;
}
}
+
+} // namespace content
diff --git a/content/common/resource_dispatcher.h b/content/common/resource_dispatcher.h
index 363fb78..ba12524 100644
--- a/content/common/resource_dispatcher.h
+++ b/content/common/resource_dispatcher.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -24,7 +24,6 @@
namespace content {
class ResourceDispatcherDelegate;
struct ResourceResponseHead;
-}
// This class serves as a communication interface between the
// ResourceDispatcherHost in the browser process and the ResourceLoaderBridge in
@@ -65,7 +64,7 @@ class CONTENT_EXPORT ResourceDispatcher : public IPC::Listener {
// This does not take ownership of the delegate. It is expected that the
// delegate have a longer lifetime than the ResourceDispatcher.
- void set_delegate(content::ResourceDispatcherDelegate* delegate) {
+ void set_delegate(ResourceDispatcherDelegate* delegate) {
delegate_ = delegate;
}
@@ -110,13 +109,13 @@ class CONTENT_EXPORT ResourceDispatcher : public IPC::Listener {
int request_id,
int64 position,
int64 size);
- void OnReceivedResponse(int request_id, const content::ResourceResponseHead&);
+ void OnReceivedResponse(int request_id, const ResourceResponseHead&);
void OnReceivedCachedMetadata(int request_id, const std::vector<char>& data);
void OnReceivedRedirect(
const IPC::Message& message,
int request_id,
const GURL& new_url,
- const content::ResourceResponseHead& response_head);
+ const ResourceResponseHead& response_head);
void OnReceivedData(
const IPC::Message& message,
int request_id,
@@ -142,7 +141,7 @@ class CONTENT_EXPORT ResourceDispatcher : public IPC::Listener {
void ToResourceResponseInfo(
const PendingRequestInfo& request_info,
- const content::ResourceResponseHead& browser_info,
+ const ResourceResponseHead& browser_info,
webkit_glue::ResourceResponseInfo* renderer_info) const;
base::TimeTicks ToRendererCompletionTime(
@@ -170,9 +169,11 @@ class CONTENT_EXPORT ResourceDispatcher : public IPC::Listener {
base::WeakPtrFactory<ResourceDispatcher> weak_factory_;
- content::ResourceDispatcherDelegate* delegate_;
+ ResourceDispatcherDelegate* delegate_;
DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher);
};
+} // namespace content
+
#endif // CONTENT_COMMON_RESOURCE_DISPATCHER_H_
diff --git a/content/common/resource_dispatcher_unittest.cc b/content/common/resource_dispatcher_unittest.cc
index cf31c3c..0d32cec 100644
--- a/content/common/resource_dispatcher_unittest.cc
+++ b/content/common/resource_dispatcher_unittest.cc
@@ -21,6 +21,8 @@
using webkit_glue::ResourceLoaderBridge;
using webkit_glue::ResourceResponseInfo;
+namespace content {
+
static const char test_page_url[] = "http://www.google.com/";
static const char test_page_headers[] =
"HTTP/1.1 200 OK\nContent-Type:text/html\n\n";
@@ -113,7 +115,7 @@ class ResourceDispatcherTest : public testing::Test, public IPC::Sender {
EXPECT_EQ(test_page_url, request.url.spec());
// received response message
- content::ResourceResponseHead response;
+ ResourceResponseHead response;
std::string raw_headers(test_page_headers);
std::replace(raw_headers.begin(), raw_headers.end(), '\n', '\0');
response.headers = new net::HttpResponseHeaders(raw_headers);
@@ -172,7 +174,7 @@ class ResourceDispatcherTest : public testing::Test, public IPC::Sender {
request_info.routing_id = 0;
RequestExtraData extra_data(WebKit::WebReferrerPolicyDefault,
true, 0, false, -1, true,
- content::PAGE_TRANSITION_LINK, -1, -1);
+ PAGE_TRANSITION_LINK, -1, -1);
request_info.extra_data = &extra_data;
return dispatcher_->CreateBridge(request_info);
@@ -241,7 +243,7 @@ class DeferredResourceLoadingTest : public ResourceDispatcherTest,
void InitMessages() {
set_defer_loading(true);
- content::ResourceResponseHead response_head;
+ ResourceResponseHead response_head;
response_head.status.set_status(net::URLRequestStatus::SUCCESS);
IPC::Message* response_message =
@@ -339,3 +341,5 @@ TEST_F(DeferredResourceLoadingTest, DeferredLoadTest) {
message_loop.RunAllPending();
delete bridge;
}
+
+} // namespace content