summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-18 23:47:54 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-18 23:47:54 +0000
commitdc993e3cc843429dd2664878de3339a69f4dc7b8 (patch)
tree638486ad332ff6cc199c18aec20ec1c62806f9b4 /chrome
parent4f4a13fdcca50a40cc0d761fe9bd00b643169992 (diff)
downloadchromium_src-dc993e3cc843429dd2664878de3339a69f4dc7b8.zip
chromium_src-dc993e3cc843429dd2664878de3339a69f4dc7b8.tar.gz
chromium_src-dc993e3cc843429dd2664878de3339a69f4dc7b8.tar.bz2
Fix single-process ui test failures from my previous change. The problem was that the wrong pid was being sent to RDH from RMF. It needs to be the fake pid for the in-process renderer.
BUG=8890 Review URL: http://codereview.chromium.org/42366 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12040 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/memory_details.cc2
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host.cc8
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc8
-rw-r--r--chrome/browser/renderer_host/resource_message_filter.h1
-rw-r--r--chrome/browser/task_manager_resource_providers.cc2
-rw-r--r--chrome/common/child_process_info.h4
6 files changed, 13 insertions, 12 deletions
diff --git a/chrome/browser/memory_details.cc b/chrome/browser/memory_details.cc
index 6a64dd2..dfae8a2 100644
--- a/chrome/browser/memory_details.cc
+++ b/chrome/browser/memory_details.cc
@@ -70,7 +70,7 @@ void MemoryDetails::CollectChildInfoOnIOThread() {
// Collect the list of child processes.
for (ChildProcessHost::Iterator iter; !iter.Done(); ++iter) {
ProcessMemoryInformation info;
- info.pid = iter->pid();
+ info.pid = iter->GetProcessId();
if (!info.pid)
continue;
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc
index 9d608ec..a57b9c2 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc
@@ -264,7 +264,7 @@ void ResourceDispatcherHost::BeginRequest(
IPC::Message* sync_result, // only valid for sync
int route_id) {
ChildProcessInfo::ProcessType process_type = receiver_->type();
- int process_id = receiver_->pid();
+ int process_id = receiver_->GetProcessId();
URLRequestContext* context =
receiver_->GetRequestContext(request_id, request_data);
if (!context)
@@ -384,7 +384,7 @@ void ResourceDispatcherHost::BeginRequest(
}
void ResourceDispatcherHost::OnDataReceivedACK(int request_id) {
- DataReceivedACK(receiver_->pid(), request_id);
+ DataReceivedACK(receiver_->GetProcessId(), request_id);
}
void ResourceDispatcherHost::DataReceivedACK(int process_id, int request_id) {
@@ -414,7 +414,7 @@ void ResourceDispatcherHost::OnDownloadProgressACK(int request_id) {
}
void ResourceDispatcherHost::OnUploadProgressACK(int request_id) {
- int process_id = receiver_->pid();
+ int process_id = receiver_->GetProcessId();
PendingRequestList::iterator i = pending_requests_.find(
GlobalRequestID(process_id, request_id));
if (i == pending_requests_.end())
@@ -425,7 +425,7 @@ void ResourceDispatcherHost::OnUploadProgressACK(int request_id) {
}
void ResourceDispatcherHost::OnCancelRequest(int request_id) {
- CancelRequest(receiver_->pid(), request_id, true, true);
+ CancelRequest(receiver_->GetProcessId(), request_id, true, true);
}
void ResourceDispatcherHost::OnClosePageACK(int new_render_process_host_id,
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc b/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc
index a8831e4..7c389d5 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc
@@ -88,7 +88,7 @@ class ResourceDispatcherHostTest : public testing::Test,
public ResourceDispatcherHost::Receiver {
public:
ResourceDispatcherHostTest()
- : Receiver(ChildProcessInfo::RENDER_PROCESS), host_(NULL) {
+ : Receiver(ChildProcessInfo::RENDER_PROCESS), host_(NULL), pid_(-1) {
set_handle(base::GetCurrentProcessHandle());
}
// ResourceDispatcherHost::Receiver implementation
@@ -104,6 +104,8 @@ class ResourceDispatcherHostTest : public testing::Test,
return NULL;
}
+ virtual int GetProcessId() const { return pid_; }
+
protected:
// testing::Test
virtual void SetUp() {
@@ -146,6 +148,7 @@ class ResourceDispatcherHostTest : public testing::Test,
MessageLoopForIO message_loop_;
ResourceDispatcherHost host_;
ResourceIPCAccumulator accum_;
+ int pid_;
};
// Spin up the message loop to kick off the request.
@@ -166,14 +169,13 @@ void ResourceDispatcherHostTest::MakeTestRequest(
int render_view_id,
int request_id,
const GURL& url) {
- int old_pid = pid();
pid_ = render_process_id;
ViewHostMsg_Resource_Request request = CreateResourceRequest("GET", url);
ViewHostMsg_RequestResource msg(render_view_id, request_id, request);
bool msg_was_ok;
host_.OnMessageReceived(msg, receiver, &msg_was_ok);
KickOffRequest();
- pid_ = old_pid;
+ pid_ = -1;
}
void ResourceDispatcherHostTest::MakeCancelRequest(int request_id) {
diff --git a/chrome/browser/renderer_host/resource_message_filter.h b/chrome/browser/renderer_host/resource_message_filter.h
index f29e7ec..7f05d85 100644
--- a/chrome/browser/renderer_host/resource_message_filter.h
+++ b/chrome/browser/renderer_host/resource_message_filter.h
@@ -86,6 +86,7 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter,
virtual URLRequestContext* GetRequestContext(
uint32 request_id,
const ViewHostMsg_Resource_Request& request_data);
+ virtual int GetProcessId() const { return render_process_id_; }
SpellChecker* spellchecker() { return spellchecker_.get(); }
ResourceDispatcherHost* resource_dispatcher_host() {
diff --git a/chrome/browser/task_manager_resource_providers.cc b/chrome/browser/task_manager_resource_providers.cc
index fbc340c..24a8f9a 100644
--- a/chrome/browser/task_manager_resource_providers.cc
+++ b/chrome/browser/task_manager_resource_providers.cc
@@ -264,7 +264,7 @@ TaskManagerChildProcessResource::TaskManagerChildProcessResource(
network_usage_support_(false) {
// We cache the process id because it's not cheap to calculate, and it won't
// be available when we get the plugin disconnected notification.
- pid_ = child_proc.pid();
+ pid_ = child_proc.GetProcessId();
if (!default_icon_) {
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
default_icon_ = rb.GetBitmapNamed(IDR_PLUGIN);
diff --git a/chrome/common/child_process_info.h b/chrome/common/child_process_info.h
index 2af3e10..dc37d41 100644
--- a/chrome/common/child_process_info.h
+++ b/chrome/common/child_process_info.h
@@ -30,7 +30,7 @@ class ChildProcessInfo {
// Getter to the process handle.
base::ProcessHandle handle() const { return process_.handle(); }
- int pid() const {
+ virtual int GetProcessId() const {
if (pid_ != -1)
return pid_;
@@ -95,8 +95,6 @@ class ChildProcessInfo {
ChildProcessInfo(ProcessType type);
private:
- friend class ResourceDispatcherHostTest;
-
ProcessType type_;
std::wstring name_;
mutable int pid_; // Cache of the process id.