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

Unified Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 247263005: Remove TransportDIB methods from RenderProcess(Host) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_process_host_impl.cc
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 2b6ebf180a7e2bfd21fbfa1e196148216e51a1d4..d3c015ccf7ba8ee8f0b854df357062ddce3644eb 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -394,10 +394,6 @@ RenderProcessHostImpl::RenderProcessHostImpl(
pending_views_(0),
visible_widgets_(0),
backgrounded_(true),
- cached_dibs_cleaner_(FROM_HERE,
- base::TimeDelta::FromSeconds(5),
- this,
- &RenderProcessHostImpl::ClearTransportDIBCache),
is_initialized_(false),
id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()),
browser_context_(browser_context),
@@ -491,7 +487,6 @@ RenderProcessHostImpl::~RenderProcessHostImpl() {
queued_messages_.pop();
}
- ClearTransportDIBCache();
UnregisterHost(GetID());
if (!CommandLine::ForCurrentProcess()->HasSwitch(
@@ -1262,69 +1257,6 @@ void RenderProcessHostImpl::DumpHandles() {
#endif
}
-// This is a platform specific function for mapping a transport DIB given its id
-TransportDIB* RenderProcessHostImpl::MapTransportDIB(
- TransportDIB::Id dib_id) {
-#if defined(OS_WIN)
- // On Windows we need to duplicate the handle from the remote process
- HANDLE section;
- DuplicateHandle(GetHandle(), dib_id.handle, GetCurrentProcess(), &section,
- FILE_MAP_READ | FILE_MAP_WRITE,
- FALSE, 0);
- return TransportDIB::Map(section);
-#elif defined(OS_ANDROID)
- return TransportDIB::Map(dib_id);
-#else
- // On POSIX, the browser allocates all DIBs and keeps a file descriptor around
- // for each.
- return widget_helper_->MapTransportDIB(dib_id);
-#endif
-}
-
-TransportDIB* RenderProcessHostImpl::GetTransportDIB(
- TransportDIB::Id dib_id) {
- if (!TransportDIB::is_valid_id(dib_id))
- return NULL;
-
- const std::map<TransportDIB::Id, TransportDIB*>::iterator
- i = cached_dibs_.find(dib_id);
- if (i != cached_dibs_.end()) {
- cached_dibs_cleaner_.Reset();
- return i->second;
- }
-
- TransportDIB* dib = MapTransportDIB(dib_id);
- if (!dib)
- return NULL;
-
- if (cached_dibs_.size() >= MAX_MAPPED_TRANSPORT_DIBS) {
- // Clean a single entry from the cache
- std::map<TransportDIB::Id, TransportDIB*>::iterator smallest_iterator;
- size_t smallest_size = std::numeric_limits<size_t>::max();
-
- for (std::map<TransportDIB::Id, TransportDIB*>::iterator
- i = cached_dibs_.begin(); i != cached_dibs_.end(); ++i) {
- if (i->second->size() <= smallest_size) {
- smallest_iterator = i;
- smallest_size = i->second->size();
- }
- }
-
- delete smallest_iterator->second;
- cached_dibs_.erase(smallest_iterator);
- }
-
- cached_dibs_[dib_id] = dib;
- cached_dibs_cleaner_.Reset();
- return dib;
-}
-
-void RenderProcessHostImpl::ClearTransportDIBCache() {
- STLDeleteContainerPairSecondPointers(
- cached_dibs_.begin(), cached_dibs_.end());
- cached_dibs_.clear();
-}
-
bool RenderProcessHostImpl::Send(IPC::Message* msg) {
TRACE_EVENT0("renderer_host", "RenderProcessHostImpl::Send");
if (!channel_) {
@@ -1895,8 +1827,6 @@ void RenderProcessHostImpl::ProcessDied(bool already_dead) {
iter.Advance();
}
- ClearTransportDIBCache();
-
render_process_host_mojo_.reset();
// It's possible that one of the calls out to the observers might have caused
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.h ('k') | content/browser/renderer_host/render_widget_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698