| 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 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1000 // This is a platform specific function for mapping a transport DIB given its id | 1000 // This is a platform specific function for mapping a transport DIB given its id |
| 1001 TransportDIB* RenderProcessHostImpl::MapTransportDIB( | 1001 TransportDIB* RenderProcessHostImpl::MapTransportDIB( |
| 1002 TransportDIB::Id dib_id) { | 1002 TransportDIB::Id dib_id) { |
| 1003 #if defined(OS_WIN) | 1003 #if defined(OS_WIN) |
| 1004 // On Windows we need to duplicate the handle from the remote process | 1004 // On Windows we need to duplicate the handle from the remote process |
| 1005 HANDLE section; | 1005 HANDLE section; |
| 1006 DuplicateHandle(GetHandle(), dib_id.handle, GetCurrentProcess(), §ion, | 1006 DuplicateHandle(GetHandle(), dib_id.handle, GetCurrentProcess(), §ion, |
| 1007 STANDARD_RIGHTS_REQUIRED | FILE_MAP_READ | FILE_MAP_WRITE, | 1007 STANDARD_RIGHTS_REQUIRED | FILE_MAP_READ | FILE_MAP_WRITE, |
| 1008 FALSE, 0); | 1008 FALSE, 0); |
| 1009 return TransportDIB::Map(section); | 1009 return TransportDIB::Map(section); |
| 1010 #elif defined(TOOLKIT_GTK) || (defined(OS_LINUX) && defined(USE_AURA)) | 1010 #elif defined(TOOLKIT_GTK) |
| 1011 return TransportDIB::Map(dib_id.shmkey); | 1011 return TransportDIB::Map(dib_id.shmkey); |
| 1012 #elif defined(OS_ANDROID) | 1012 #elif defined(OS_ANDROID) |
| 1013 return TransportDIB::Map(dib_id); | 1013 return TransportDIB::Map(dib_id); |
| 1014 #else | 1014 #else |
| 1015 // On POSIX, the browser allocates all DIBs and keeps a file descriptor around | 1015 // On POSIX, the browser allocates all DIBs and keeps a file descriptor around |
| 1016 // for each. | 1016 // for each. |
| 1017 return widget_helper_->MapTransportDIB(dib_id); | 1017 return widget_helper_->MapTransportDIB(dib_id); |
| 1018 #endif | 1018 #endif |
| 1019 } | 1019 } |
| 1020 | 1020 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1040 size_t smallest_size = std::numeric_limits<size_t>::max(); | 1040 size_t smallest_size = std::numeric_limits<size_t>::max(); |
| 1041 | 1041 |
| 1042 for (std::map<TransportDIB::Id, TransportDIB*>::iterator | 1042 for (std::map<TransportDIB::Id, TransportDIB*>::iterator |
| 1043 i = cached_dibs_.begin(); i != cached_dibs_.end(); ++i) { | 1043 i = cached_dibs_.begin(); i != cached_dibs_.end(); ++i) { |
| 1044 if (i->second->size() <= smallest_size) { | 1044 if (i->second->size() <= smallest_size) { |
| 1045 smallest_iterator = i; | 1045 smallest_iterator = i; |
| 1046 smallest_size = i->second->size(); | 1046 smallest_size = i->second->size(); |
| 1047 } | 1047 } |
| 1048 } | 1048 } |
| 1049 | 1049 |
| 1050 #if defined(TOOLKIT_GTK) || (defined(OS_LINUX) && defined(USE_AURA)) | 1050 #if defined(TOOLKIT_GTK) |
| 1051 smallest_iterator->second->Detach(); | 1051 smallest_iterator->second->Detach(); |
| 1052 #else | 1052 #else |
| 1053 delete smallest_iterator->second; | 1053 delete smallest_iterator->second; |
| 1054 #endif | 1054 #endif |
| 1055 cached_dibs_.erase(smallest_iterator); | 1055 cached_dibs_.erase(smallest_iterator); |
| 1056 } | 1056 } |
| 1057 | 1057 |
| 1058 cached_dibs_[dib_id] = dib; | 1058 cached_dibs_[dib_id] = dib; |
| 1059 cached_dibs_cleaner_.Reset(); | 1059 cached_dibs_cleaner_.Reset(); |
| 1060 return dib; | 1060 return dib; |
| 1061 } | 1061 } |
| 1062 | 1062 |
| 1063 void RenderProcessHostImpl::ClearTransportDIBCache() { | 1063 void RenderProcessHostImpl::ClearTransportDIBCache() { |
| 1064 #if defined(TOOLKIT_GTK) || (defined(OS_LINUX) && defined(USE_AURA)) | 1064 #if defined(TOOLKIT_GTK) |
| 1065 std::map<TransportDIB::Id, TransportDIB*>::const_iterator dib = | 1065 std::map<TransportDIB::Id, TransportDIB*>::const_iterator dib = |
| 1066 cached_dibs_.begin(); | 1066 cached_dibs_.begin(); |
| 1067 for (; dib != cached_dibs_.end(); ++dib) | 1067 for (; dib != cached_dibs_.end(); ++dib) |
| 1068 dib->second->Detach(); | 1068 dib->second->Detach(); |
| 1069 #else | 1069 #else |
| 1070 STLDeleteContainerPairSecondPointers( | 1070 STLDeleteContainerPairSecondPointers( |
| 1071 cached_dibs_.begin(), cached_dibs_.end()); | 1071 cached_dibs_.begin(), cached_dibs_.end()); |
| 1072 #endif | 1072 #endif |
| 1073 cached_dibs_.clear(); | 1073 cached_dibs_.clear(); |
| 1074 } | 1074 } |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1712 TRACE_EVENT0("renderer_host", | 1712 TRACE_EVENT0("renderer_host", |
| 1713 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); | 1713 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); |
| 1714 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; | 1714 AcceleratedSurfaceMsg_BufferPresented_Params ack_params; |
| 1715 ack_params.sync_point = 0; | 1715 ack_params.sync_point = 0; |
| 1716 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, | 1716 RenderWidgetHostImpl::AcknowledgeBufferPresent(route_id, |
| 1717 gpu_process_host_id, | 1717 gpu_process_host_id, |
| 1718 ack_params); | 1718 ack_params); |
| 1719 } | 1719 } |
| 1720 | 1720 |
| 1721 } // namespace content | 1721 } // namespace content |
| OLD | NEW |