Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: content/public/test/mock_render_process_host.cc

Issue 651253002: Enforce handle ownership in base::Process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add empty line Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/public/test/mock_render_process_host.h" 5 #include "content/public/test/mock_render_process_host.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/process/process_handle.h"
9 #include "base/time/time.h" 10 #include "base/time/time.h"
10 #include "content/browser/child_process_security_policy_impl.h" 11 #include "content/browser/child_process_security_policy_impl.h"
11 #include "content/browser/renderer_host/render_process_host_impl.h" 12 #include "content/browser/renderer_host/render_process_host_impl.h"
12 #include "content/browser/renderer_host/render_view_host_impl.h" 13 #include "content/browser/renderer_host/render_view_host_impl.h"
13 #include "content/browser/renderer_host/render_widget_host_impl.h" 14 #include "content/browser/renderer_host/render_widget_host_impl.h"
14 #include "content/common/child_process_host_impl.h" 15 #include "content/common/child_process_host_impl.h"
15 #include "content/public/browser/global_request_id.h" 16 #include "content/public/browser/global_request_id.h"
16 #include "content/public/browser/render_widget_host_iterator.h" 17 #include "content/public/browser/render_widget_host_iterator.h"
17 #include "content/public/browser/storage_partition.h" 18 #include "content/public/browser/storage_partition.h"
18 19
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 } 118 }
118 119
119 void MockRenderProcessHost::DumpHandles() { 120 void MockRenderProcessHost::DumpHandles() {
120 } 121 }
121 122
122 base::ProcessHandle MockRenderProcessHost::GetHandle() const { 123 base::ProcessHandle MockRenderProcessHost::GetHandle() const {
123 // Return the current-process handle for the IPC::GetFileHandleForProcess 124 // Return the current-process handle for the IPC::GetFileHandleForProcess
124 // function. 125 // function.
125 if (process_handle) 126 if (process_handle)
126 return *process_handle; 127 return *process_handle;
127 return base::Process::Current().handle(); 128 return base::GetCurrentProcessHandle();
128 } 129 }
129 130
130 bool MockRenderProcessHost::Send(IPC::Message* msg) { 131 bool MockRenderProcessHost::Send(IPC::Message* msg) {
131 // Save the message in the sink. 132 // Save the message in the sink.
132 sink_.OnMessageReceived(*msg); 133 sink_.OnMessageReceived(*msg);
133 delete msg; 134 delete msg;
134 return true; 135 return true;
135 } 136 }
136 137
137 int MockRenderProcessHost::GetID() const { 138 int MockRenderProcessHost::GetID() const {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); 286 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin();
286 it != processes_.end(); ++it) { 287 it != processes_.end(); ++it) {
287 if (*it == host) { 288 if (*it == host) {
288 processes_.weak_erase(it); 289 processes_.weak_erase(it);
289 break; 290 break;
290 } 291 }
291 } 292 }
292 } 293 }
293 294
294 } // content 295 } // content
OLDNEW
« no previous file with comments | « content/common/gpu/media/video_encode_accelerator_unittest.cc ('k') | content/renderer/devtools/devtools_agent.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698