| 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.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_impl.h" | 10 #include "content/browser/child_process_security_policy_impl.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 } | 116 } |
| 117 | 117 |
| 118 TransportDIB* MockRenderProcessHost::GetTransportDIB(TransportDIB::Id dib_id) { | 118 TransportDIB* MockRenderProcessHost::GetTransportDIB(TransportDIB::Id dib_id) { |
| 119 if (transport_dib_) | 119 if (transport_dib_) |
| 120 return transport_dib_; | 120 return transport_dib_; |
| 121 #if defined(OS_WIN) | 121 #if defined(OS_WIN) |
| 122 HANDLE duped; | 122 HANDLE duped; |
| 123 DuplicateHandle(GetCurrentProcess(), dib_id.handle, GetCurrentProcess(), | 123 DuplicateHandle(GetCurrentProcess(), dib_id.handle, GetCurrentProcess(), |
| 124 &duped, 0, TRUE, DUPLICATE_SAME_ACCESS); | 124 &duped, 0, TRUE, DUPLICATE_SAME_ACCESS); |
| 125 transport_dib_ = TransportDIB::Map(duped); | 125 transport_dib_ = TransportDIB::Map(duped); |
| 126 #elif defined(OS_MACOSX) | 126 #elif defined(TOOLKIT_GTK) |
| 127 // On Mac, TransportDIBs are always created in the browser, so we cannot map | 127 transport_dib_ = TransportDIB::Map(dib_id.shmkey); |
| 128 // one from a dib_id. | |
| 129 transport_dib_ = TransportDIB::Create(100 * 100 * 4, 0); | |
| 130 #elif defined(OS_ANDROID) | 128 #elif defined(OS_ANDROID) |
| 131 // On Android, Handles and Ids are the same underlying type. | 129 // On Android, Handles and Ids are the same underlying type. |
| 132 transport_dib_ = TransportDIB::Map(dib_id); | 130 transport_dib_ = TransportDIB::Map(dib_id); |
| 133 #elif defined(OS_POSIX) | 131 #else |
| 134 transport_dib_ = TransportDIB::Map(dib_id.shmkey); | 132 // On POSIX, TransportDIBs are always created in the browser, so we cannot map |
| 133 // one from a dib_id. |
| 134 transport_dib_ = TransportDIB::Create(100 * 100 * 4, 0); |
| 135 #endif | 135 #endif |
| 136 | 136 |
| 137 return transport_dib_; | 137 return transport_dib_; |
| 138 } | 138 } |
| 139 | 139 |
| 140 int MockRenderProcessHost::GetID() const { | 140 int MockRenderProcessHost::GetID() const { |
| 141 return id_; | 141 return id_; |
| 142 } | 142 } |
| 143 | 143 |
| 144 bool MockRenderProcessHost::HasConnection() const { | 144 bool MockRenderProcessHost::HasConnection() const { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); | 258 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); |
| 259 it != processes_.end(); ++it) { | 259 it != processes_.end(); ++it) { |
| 260 if (*it == host) { | 260 if (*it == host) { |
| 261 processes_.weak_erase(it); | 261 processes_.weak_erase(it); |
| 262 break; | 262 break; |
| 263 } | 263 } |
| 264 } | 264 } |
| 265 } | 265 } |
| 266 | 266 |
| 267 } // content | 267 } // content |
| OLD | NEW |