From: Enrico Granata Date: Thu, 8 Nov 2012 19:16:03 +0000 (+0000) Subject: Minor cleanups to the new ModuleList notification APIs: passing in the ModuleList... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=efe637d440cb706d93ab665e0180efbe0908084a;p=platform%2Fupstream%2Fllvm.git Minor cleanups to the new ModuleList notification APIs: passing in the ModuleList as part of the callbacks, and not copying the notifier as part of copy constructing and assigning llvm-svn: 167592 --- diff --git a/lldb/include/lldb/Core/ModuleList.h b/lldb/include/lldb/Core/ModuleList.h index 7c9f493..8d13ed5 100644 --- a/lldb/include/lldb/Core/ModuleList.h +++ b/lldb/include/lldb/Core/ModuleList.h @@ -32,14 +32,14 @@ public: { public: virtual void - ModuleAdded (const lldb::ModuleSP& module_sp) = 0; + ModuleAdded (const ModuleList& module_list, const lldb::ModuleSP& module_sp) = 0; virtual void - ModuleRemoved (const lldb::ModuleSP& module_sp) = 0; + ModuleRemoved (const ModuleList& module_list, const lldb::ModuleSP& module_sp) = 0; virtual void - ModuleUpdated (const lldb::ModuleSP& old_module_sp, + ModuleUpdated (const ModuleList& module_list, const lldb::ModuleSP& old_module_sp, const lldb::ModuleSP& new_module_sp) = 0; virtual void - WillClearList () = 0; + WillClearList (const ModuleList& module_list) = 0; virtual ~Notifier () diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h index 851ca3b..e19b910 100644 --- a/lldb/include/lldb/Target/Target.h +++ b/lldb/include/lldb/Target/Target.h @@ -621,16 +621,17 @@ protected: //------------------------------------------------------------------ virtual void - ModuleAdded (const lldb::ModuleSP& module_sp); + ModuleAdded (const ModuleList& module_list, const lldb::ModuleSP& module_sp); virtual void - ModuleRemoved (const lldb::ModuleSP& module_sp); + ModuleRemoved (const ModuleList& module_list, const lldb::ModuleSP& module_sp); virtual void - ModuleUpdated (const lldb::ModuleSP& old_module_sp, + ModuleUpdated (const ModuleList& module_list, + const lldb::ModuleSP& old_module_sp, const lldb::ModuleSP& new_module_sp); virtual void - WillClearList (); + WillClearList (const ModuleList& module_list); public: diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp index c7f7484..f2f3920 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -45,7 +45,6 @@ ModuleList::ModuleList(const ModuleList& rhs) : Mutex::Locker lhs_locker(m_modules_mutex); Mutex::Locker rhs_locker(rhs.m_modules_mutex); m_modules = rhs.m_modules; - m_notifier = rhs.m_notifier; } ModuleList::ModuleList (ModuleList::Notifier* notifier) : @@ -66,7 +65,6 @@ ModuleList::operator= (const ModuleList& rhs) Mutex::Locker lhs_locker(m_modules_mutex); Mutex::Locker rhs_locker(rhs.m_modules_mutex); m_modules = rhs.m_modules; - m_notifier = rhs.m_notifier; } return *this; } @@ -86,7 +84,7 @@ ModuleList::AppendImpl (const ModuleSP &module_sp, bool use_notifier) Mutex::Locker locker(m_modules_mutex); m_modules.push_back(module_sp); if (use_notifier && m_notifier) - m_notifier->ModuleAdded(module_sp); + m_notifier->ModuleAdded(*this, module_sp); } } @@ -170,7 +168,7 @@ ModuleList::RemoveImpl (const ModuleSP &module_sp, bool use_notifier) { m_modules.erase (pos); if (use_notifier && m_notifier) - m_notifier->ModuleRemoved(module_sp); + m_notifier->ModuleRemoved(*this, module_sp); return true; } } @@ -184,7 +182,7 @@ ModuleList::RemoveImpl (ModuleList::collection::iterator pos, bool use_notifier) ModuleSP module_sp(*pos); collection::iterator retval = m_modules.erase(pos); if (use_notifier && m_notifier) - m_notifier->ModuleRemoved(module_sp); + m_notifier->ModuleRemoved(*this, module_sp); return retval; } @@ -201,7 +199,7 @@ ModuleList::ReplaceModule (const lldb::ModuleSP &old_module_sp, const lldb::Modu return false; AppendImpl (new_module_sp, false); if (m_notifier) - m_notifier->ModuleUpdated(old_module_sp,new_module_sp); + m_notifier->ModuleUpdated(*this, old_module_sp,new_module_sp); return true; } @@ -293,7 +291,7 @@ ModuleList::ClearImpl (bool use_notifier) { Mutex::Locker locker(m_modules_mutex); if (use_notifier && m_notifier) - m_notifier->WillClearList(); + m_notifier->WillClearList(*this); m_modules.clear(); } diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index b961603..ec88710 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -1059,31 +1059,31 @@ Target::SetArchitecture (const ArchSpec &arch_spec) } void -Target::WillClearList () +Target::WillClearList (const ModuleList& module_list) { } void -Target::ModuleAdded (const ModuleSP &module_sp) +Target::ModuleAdded (const ModuleList& module_list, const ModuleSP &module_sp) { // A module is being added to this target for the first time - ModuleList module_list; - module_list.Append(module_sp); + ModuleList my_module_list; + my_module_list.Append(module_sp); LoadScriptingResourceForModule(module_sp, this); - ModulesDidLoad (module_list); + ModulesDidLoad (my_module_list); } void -Target::ModuleRemoved (const ModuleSP &module_sp) +Target::ModuleRemoved (const ModuleList& module_list, const ModuleSP &module_sp) { // A module is being added to this target for the first time - ModuleList module_list; - module_list.Append(module_sp); - ModulesDidUnload (module_list); + ModuleList my_module_list; + my_module_list.Append(module_sp); + ModulesDidUnload (my_module_list); } void -Target::ModuleUpdated (const ModuleSP &old_module_sp, const ModuleSP &new_module_sp) +Target::ModuleUpdated (const ModuleList& module_list, const ModuleSP &old_module_sp, const ModuleSP &new_module_sp) { // A module is replacing an already added module m_breakpoint_list.UpdateBreakpointsWhenModuleIsReplaced(old_module_sp, new_module_sp);