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