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/browser/renderer_host/mock_render_process_host.h" | 5 #include "content/browser/renderer_host/mock_render_process_host.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "content/browser/child_process_security_policy.h" | 10 #include "content/browser/child_process_security_policy.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 return transport_dib_; | 111 return transport_dib_; |
112 #if defined(OS_WIN) | 112 #if defined(OS_WIN) |
113 HANDLE duped; | 113 HANDLE duped; |
114 DuplicateHandle(GetCurrentProcess(), dib_id.handle, GetCurrentProcess(), | 114 DuplicateHandle(GetCurrentProcess(), dib_id.handle, GetCurrentProcess(), |
115 &duped, 0, TRUE, DUPLICATE_SAME_ACCESS); | 115 &duped, 0, TRUE, DUPLICATE_SAME_ACCESS); |
116 transport_dib_ = TransportDIB::Map(duped); | 116 transport_dib_ = TransportDIB::Map(duped); |
117 #elif defined(OS_MACOSX) | 117 #elif defined(OS_MACOSX) |
118 // On Mac, TransportDIBs are always created in the browser, so we cannot map | 118 // On Mac, TransportDIBs are always created in the browser, so we cannot map |
119 // one from a dib_id. | 119 // one from a dib_id. |
120 transport_dib_ = TransportDIB::Create(100 * 100 * 4, 0); | 120 transport_dib_ = TransportDIB::Create(100 * 100 * 4, 0); |
| 121 #elif defined(OS_ANDROID) |
| 122 // On Android, Handles and Ids are the same underlying type. |
| 123 transport_dib_ = TransportDIB::Map(dib_id); |
121 #elif defined(OS_POSIX) | 124 #elif defined(OS_POSIX) |
122 transport_dib_ = TransportDIB::Map(dib_id.shmkey); | 125 transport_dib_ = TransportDIB::Map(dib_id.shmkey); |
123 #endif | 126 #endif |
124 | 127 |
125 return transport_dib_; | 128 return transport_dib_; |
126 } | 129 } |
127 | 130 |
128 int MockRenderProcessHost::GetID() const { | 131 int MockRenderProcessHost::GetID() const { |
129 return id_; | 132 return id_; |
130 } | 133 } |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 240 |
238 void MockRenderProcessHostFactory::Remove(MockRenderProcessHost* host) const { | 241 void MockRenderProcessHostFactory::Remove(MockRenderProcessHost* host) const { |
239 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); | 242 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); |
240 it != processes_.end(); ++it) { | 243 it != processes_.end(); ++it) { |
241 if (*it == host) { | 244 if (*it == host) { |
242 processes_.weak_erase(it); | 245 processes_.weak_erase(it); |
243 break; | 246 break; |
244 } | 247 } |
245 } | 248 } |
246 } | 249 } |
OLD | NEW |