| 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 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
| 6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
| 7 | 7 |
| 8 #include "content/browser/renderer_host/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1038 // This is a platform specific function for mapping a transport DIB given its id | 1038 // This is a platform specific function for mapping a transport DIB given its id |
| 1039 TransportDIB* RenderProcessHostImpl::MapTransportDIB( | 1039 TransportDIB* RenderProcessHostImpl::MapTransportDIB( |
| 1040 TransportDIB::Id dib_id) { | 1040 TransportDIB::Id dib_id) { |
| 1041 #if defined(OS_WIN) | 1041 #if defined(OS_WIN) |
| 1042 // On Windows we need to duplicate the handle from the remote process | 1042 // On Windows we need to duplicate the handle from the remote process |
| 1043 HANDLE section; | 1043 HANDLE section; |
| 1044 DuplicateHandle(GetHandle(), dib_id.handle, GetCurrentProcess(), §ion, | 1044 DuplicateHandle(GetHandle(), dib_id.handle, GetCurrentProcess(), §ion, |
| 1045 STANDARD_RIGHTS_REQUIRED | FILE_MAP_READ | FILE_MAP_WRITE, | 1045 STANDARD_RIGHTS_REQUIRED | FILE_MAP_READ | FILE_MAP_WRITE, |
| 1046 FALSE, 0); | 1046 FALSE, 0); |
| 1047 return TransportDIB::Map(section); | 1047 return TransportDIB::Map(section); |
| 1048 #elif defined(TOOLKIT_GTK) || (defined(OS_LINUX) && defined(USE_AURA)) | 1048 #elif defined(TOOLKIT_GTK) |
| 1049 return TransportDIB::Map(dib_id.shmkey); | 1049 return TransportDIB::Map(dib_id.shmkey); |
| 1050 #elif defined(OS_ANDROID) | 1050 #elif defined(OS_ANDROID) |
| 1051 return TransportDIB::Map(dib_id); | 1051 return TransportDIB::Map(dib_id); |
| 1052 #else | 1052 #else |
| 1053 // On POSIX, the browser allocates all DIBs and keeps a file descriptor around | 1053 // On POSIX, the browser allocates all DIBs and keeps a file descriptor around |
| 1054 // for each. | 1054 // for each. |
| 1055 return widget_helper_->MapTransportDIB(dib_id); | 1055 return widget_helper_->MapTransportDIB(dib_id); |
| 1056 #endif | 1056 #endif |
| 1057 } | 1057 } |
| 1058 | 1058 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1078 size_t smallest_size = std::numeric_limits<size_t>::max(); | 1078 size_t smallest_size = std::numeric_limits<size_t>::max(); |
| 1079 | 1079 |
| 1080 for (std::map<TransportDIB::Id, TransportDIB*>::iterator | 1080 for (std::map<TransportDIB::Id, TransportDIB*>::iterator |
| 1081 i = cached_dibs_.begin(); i != cached_dibs_.end(); ++i) { | 1081 i = cached_dibs_.begin(); i != cached_dibs_.end(); ++i) { |
| 1082 if (i->second->size() <= smallest_size) { | 1082 if (i->second->size() <= smallest_size) { |
| 1083 smallest_iterator = i; | 1083 smallest_iterator = i; |
| 1084 smallest_size = i->second->size(); | 1084 smallest_size = i->second->size(); |
| 1085 } | 1085 } |
| 1086 } | 1086 } |
| 1087 | 1087 |
| 1088 #if defined(TOOLKIT_GTK) || (defined(OS_LINUX) && defined(USE_AURA)) | 1088 #if defined(TOOLKIT_GTK) |
| 1089 smallest_iterator->second->Detach(); | 1089 smallest_iterator->second->Detach(); |
| 1090 #else | 1090 #else |
| 1091 delete smallest_iterator->second; | 1091 delete smallest_iterator->second; |
| 1092 #endif | 1092 #endif |
| 1093 cached_dibs_.erase(smallest_iterator); | 1093 cached_dibs_.erase(smallest_iterator); |
| 1094 } | 1094 } |
| 1095 | 1095 |
| 1096 cached_dibs_[dib_id] = dib; | 1096 cached_dibs_[dib_id] = dib; |
| 1097 cached_dibs_cleaner_.Reset(); | 1097 cached_dibs_cleaner_.Reset(); |
| 1098 return dib; | 1098 return dib; |
| 1099 } | 1099 } |
| 1100 | 1100 |
| 1101 void RenderProcessHostImpl::ClearTransportDIBCache() { | 1101 void RenderProcessHostImpl::ClearTransportDIBCache() { |
| 1102 #if defined(TOOLKIT_GTK) || (defined(OS_LINUX) && defined(USE_AURA)) | 1102 #if defined(TOOLKIT_GTK) |
| 1103 std::map<TransportDIB::Id, TransportDIB*>::const_iterator dib = | 1103 std::map<TransportDIB::Id, TransportDIB*>::const_iterator dib = |
| 1104 cached_dibs_.begin(); | 1104 cached_dibs_.begin(); |
| 1105 for (; dib != cached_dibs_.end(); ++dib) | 1105 for (; dib != cached_dibs_.end(); ++dib) |
| 1106 dib->second->Detach(); | 1106 dib->second->Detach(); |
| 1107 #else | 1107 #else |
| 1108 STLDeleteContainerPairSecondPointers( | 1108 STLDeleteContainerPairSecondPointers( |
| 1109 cached_dibs_.begin(), cached_dibs_.end()); | 1109 cached_dibs_.begin(), cached_dibs_.end()); |
| 1110 #endif | 1110 #endif |
| 1111 cached_dibs_.clear(); | 1111 cached_dibs_.clear(); |
| 1112 } | 1112 } |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1755 TRACE_EVENT0("renderer_host", | 1755 TRACE_EVENT0("renderer_host", |
| 1756 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); | 1756 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); |
| 1757 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; | 1757 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |
| 1758 ack_params.sync_point = 0; | 1758 ack_params.sync_point = 0; |
| 1759 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, | 1759 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, |
| 1760 gpu_process_host_id, | 1760 gpu_process_host_id, |
| 1761 ack_params); | 1761 ack_params); |
| 1762 } | 1762 } |
| 1763 | 1763 |
| 1764 } // namespace content | 1764 } // namespace content |
| OLD | NEW |