Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 13582008: Simplify the transport dib situation across our various platforms, as a (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/surface/surface.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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(), &section, 1006 DuplicateHandle(GetHandle(), dib_id.handle, GetCurrentProcess(), &section,
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(OS_MACOSX) 1010 #elif defined(TOOLKIT_GTK) || (defined(OS_LINUX) && defined(USE_AURA))
1011 // On OSX, the browser allocates all DIBs and keeps a file descriptor around 1011 return TransportDIB::Map(dib_id.shmkey);
1012 #elif defined(OS_ANDROID)
1013 return TransportDIB::Map(dib_id);
1014 #else
1015 // On POSIX, the browser allocates all DIBs and keeps a file descriptor around
1012 // for each. 1016 // for each.
1013 return widget_helper_->MapTransportDIB(dib_id); 1017 return widget_helper_->MapTransportDIB(dib_id);
1014 #elif defined(OS_ANDROID) 1018 #endif
1015 return TransportDIB::Map(dib_id);
1016 #elif defined(OS_POSIX)
1017 return TransportDIB::Map(dib_id.shmkey);
1018 #endif // defined(OS_POSIX)
1019 } 1019 }
1020 1020
1021 TransportDIB* RenderProcessHostImpl::GetTransportDIB( 1021 TransportDIB* RenderProcessHostImpl::GetTransportDIB(
1022 TransportDIB::Id dib_id) { 1022 TransportDIB::Id dib_id) {
1023 if (!TransportDIB::is_valid_id(dib_id)) 1023 if (!TransportDIB::is_valid_id(dib_id))
1024 return NULL; 1024 return NULL;
1025 1025
1026 const std::map<TransportDIB::Id, TransportDIB*>::iterator 1026 const std::map<TransportDIB::Id, TransportDIB*>::iterator
1027 i = cached_dibs_.find(dib_id); 1027 i = cached_dibs_.find(dib_id);
1028 if (i != cached_dibs_.end()) { 1028 if (i != cached_dibs_.end()) {
(...skipping 11 matching lines...) Expand all
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(USE_X11) 1050 #if defined(TOOLKIT_GTK) || (defined(OS_LINUX) && defined(USE_AURA))
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(USE_X11) 1064 #if defined(TOOLKIT_GTK) || (defined(OS_LINUX) && defined(USE_AURA))
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
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
OLDNEW
« no previous file with comments | « no previous file | ui/surface/surface.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698