OLD | NEW |
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/time/time.h" | 9 #include "base/time/time.h" |
10 #include "content/browser/child_process_security_policy_impl.h" | 10 #include "content/browser/child_process_security_policy_impl.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 TransportDIB* MockRenderProcessHost::MapTransportDIB(TransportDIB::Id dib_id) { | 144 TransportDIB* MockRenderProcessHost::MapTransportDIB(TransportDIB::Id dib_id) { |
145 #if defined(OS_WIN) | 145 #if defined(OS_WIN) |
146 // NULL should be used here instead of INVALID_HANDLE_VALUE (or pseudo-handle) | 146 // NULL should be used here instead of INVALID_HANDLE_VALUE (or pseudo-handle) |
147 // except for when dealing with the small number of Win16-derived APIs | 147 // except for when dealing with the small number of Win16-derived APIs |
148 // that require INVALID_HANDLE_VALUE (e.g. CreateFile and friends). | 148 // that require INVALID_HANDLE_VALUE (e.g. CreateFile and friends). |
149 HANDLE duped = NULL; | 149 HANDLE duped = NULL; |
150 if (!DuplicateHandle(GetCurrentProcess(), dib_id.handle, GetCurrentProcess(), | 150 if (!DuplicateHandle(GetCurrentProcess(), dib_id.handle, GetCurrentProcess(), |
151 &duped, 0, TRUE, DUPLICATE_SAME_ACCESS)) | 151 &duped, 0, TRUE, DUPLICATE_SAME_ACCESS)) |
152 duped = NULL; | 152 duped = NULL; |
153 return TransportDIB::Map(duped); | 153 return TransportDIB::Map(duped); |
154 #elif defined(TOOLKIT_GTK) | |
155 return TransportDIB::Map(dib_id.shmkey); | |
156 #elif defined(OS_ANDROID) | 154 #elif defined(OS_ANDROID) |
157 // On Android, Handles and Ids are the same underlying type. | 155 // On Android, Handles and Ids are the same underlying type. |
158 return TransportDIB::Map(dib_id); | 156 return TransportDIB::Map(dib_id); |
159 #else | 157 #else |
160 // On POSIX, TransportDIBs are always created in the browser, so we cannot map | 158 // On POSIX, TransportDIBs are always created in the browser, so we cannot map |
161 // one from a dib_id. | 159 // one from a dib_id. |
162 return TransportDIB::Create(100 * 100 * 4, 0); | 160 return TransportDIB::Create(100 * 100 * 4, 0); |
163 #endif | 161 #endif |
164 } | 162 } |
165 | 163 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); | 308 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); |
311 it != processes_.end(); ++it) { | 309 it != processes_.end(); ++it) { |
312 if (*it == host) { | 310 if (*it == host) { |
313 processes_.weak_erase(it); | 311 processes_.weak_erase(it); |
314 break; | 312 break; |
315 } | 313 } |
316 } | 314 } |
317 } | 315 } |
318 | 316 |
319 } // content | 317 } // content |
OLD | NEW |