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

Unified Diff: ceee/ie/broker/executors_manager.cc

Issue 5595005: Revert 68298 - Make sure we don't keep tab id - handles mapping when a dread ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years 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
« no previous file with comments | « ceee/ie/broker/executors_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ceee/ie/broker/executors_manager.cc
===================================================================
--- ceee/ie/broker/executors_manager.cc (revision 68298)
+++ ceee/ie/broker/executors_manager.cc (working copy)
@@ -8,7 +8,6 @@
#include "base/logging.h"
#include "ceee/ie/broker/broker_module_util.h"
-#include "ceee/ie/broker/chrome_postman.h"
#include "ceee/ie/broker/common_api_module.h"
#include "ceee/common/com_utils.h"
@@ -193,7 +192,6 @@
HRESULT ExecutorsManager::GetExecutor(ThreadId thread_id, HWND window,
REFIID riid, void** executor) {
- VLOG(1) << "Thread: " << thread_id << ", window: " << window;
DCHECK(executor != NULL);
// We may need to wait for either a currently pending
// or own newly created registration of a new executor.
@@ -412,11 +410,9 @@
AutoLock lock(lock_);
{
HandleMap::iterator handle_it = handle_map_.find(handle);
- // Don't DCHECK, we may be called more than once, but it's fine,
- // we just ignore subsequent calls.
+ DCHECK(handle_map_.end() != handle_it);
if (handle_map_.end() != handle_it) {
TabIdMap::iterator tab_id_it = tab_id_map_.find(handle_it->second);
- // But if we have it in one map, we must have it in the reverse map.
DCHECK(tab_id_map_.end() != tab_id_it);
if (tab_id_map_.end() != tab_id_it) {
#ifdef DEBUG
@@ -478,31 +474,6 @@
windows_events_funnel().OnRemoved(frame_window);
}
-// This is for using CleanupMapsForThread() into a runnable object without
-// the need to AddRef/Release the ExecutorsManager which is a Singleton.
-DISABLE_RUNNABLE_METHOD_REFCOUNT(ExecutorsManager);
-
-void ExecutorsManager::CleanupMapsForThread(DWORD thread_id) {
- // We collect the tab handles to remove so that we can do it outside of lock.
- // This is because 1) it's not trivial to do it while we loop through the map,
- // since there are multiple maps to deal with and the DeleteHandle takes care
- // of that for us, and 2) we can't call DeleteHandle from within a lock.
- std::vector<HWND> tab_handles_to_remove;
- {
- AutoLock lock(lock_);
- HandleMap::iterator handle_it = handle_map_.begin();
- for (; handle_it != handle_map_.end(); ++ handle_it) {
- if (::GetWindowThreadProcessId(handle_it->first, NULL) == thread_id)
- tab_handles_to_remove.push_back(handle_it->first);
- }
- } // AutoLock end
-
- std::vector<HWND>::iterator tab_handle_it = tab_handles_to_remove.begin();
- for (; tab_handle_it != tab_handles_to_remove.end(); ++tab_handle_it) {
- DeleteTabHandle(*tab_handle_it);
- }
-}
-
bool ExecutorsManager::IsTabIdValid(int tab_id) {
AutoLock lock(lock_);
TabIdMap::const_iterator it = tab_id_map_.find(tab_id);
@@ -636,21 +607,7 @@
} else if (result >= WAIT_OBJECT_0 &&
result < WAIT_OBJECT_0 + num_threads) {
// One of our threads have died, cleanup time.
- DWORD thread_id = thread_ids[result - WAIT_OBJECT_0];
- VLOG(1) << "Thread: " << thread_id << " is dying on us!";
- me->RemoveExecutor(thread_id);
- // We must asynchronously post this change in case there are pending
- // asynchronous notifications (e.g., tabs.onRemoved) that would still
- // need the handle to tab id mapping.
- // NOTE: No need to worry about the lifespan of the executors manager
- // referred by the me variable since it's a singleton released at exit.
- ChromePostman* single_instance = ChromePostman::GetInstance();
- // This is not intialized in unittests yet.
- if (single_instance) {
- single_instance->QueueApiInvocationThreadTask(
- NewRunnableMethod(me, &ExecutorsManager::CleanupMapsForThread,
- thread_id));
- }
+ me->RemoveExecutor(thread_ids[result - WAIT_OBJECT_0]);
} else if (result == WAIT_OBJECT_0 + num_threads +
kTerminationHandleIndexOffset) {
// we are being terminated, break the cycle.
« no previous file with comments | « ceee/ie/broker/executors_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698