Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: src/plugin/PluginMutex.cpp

Issue 5750789393874944: [IE] First round of ATL removal (Closed)
Left Patch Set: Created June 20, 2014, 9:22 p.m.
Right Patch Set: Defect corrections Created June 26, 2014, 3:18 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | src/plugin/Wrapper.h » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 #include "PluginMutex.h" 3 #include "PluginMutex.h"
4 #include "PluginClient.h" 4 #include "PluginClient.h"
5 #include "sddl.h" 5 #include "sddl.h"
6 6
7 7
8 CPluginMutex::CPluginMutex(const std::wstring & name, int errorSubidBase) 8 CPluginMutex::CPluginMutex(const std::wstring & name, int errorSubidBase)
9 : m_isLocked(false), m_errorSubidBase(errorSubidBase), mutex_name( L"Global\\A dblockPlus" + name ) 9 : m_isLocked(false), m_errorSubidBase(errorSubidBase), mutex_name( L"Global\\A dblockPlus" + name )
10 { 10 {
11 if (m_errorSubidBase != PLUGIN_ERROR_MUTEX_DEBUG_FILE) 11 if (m_errorSubidBase != PLUGIN_ERROR_MUTEX_DEBUG_FILE)
12 { 12 {
13 DEBUG_MUTEX( "Mutex::Create name:" + mutex_name ) 13 DEBUG_MUTEX( "Mutex::Create name:" + mutex_name )
14 } 14 }
15 m_hMutex = ::CreateMutexW( NULL, FALSE, mutex_name.c_str() ); 15 m_hMutex = ::CreateMutexW( NULL, FALSE, mutex_name.c_str() );
16 if (m_hMutex == NULL) 16 if (m_hMutex == NULL)
17 { 17 {
18 DWORD error = GetLastError(); 18 DWORD error = GetLastError();
19 m_hMutex = OpenMutexW( MUTEX_ALL_ACCESS, FALSE, mutex_name.c_str() ); 19 m_hMutex = OpenMutexW( MUTEX_ALL_ACCESS, FALSE, mutex_name.c_str() );
20 if (m_hMutex == NULL) 20 if (m_hMutex == NULL)
21 { 21 {
22 mutex_name = L"Local\\AdblockPlus" + name;
22 m_hMutex = ::CreateMutexW( NULL, FALSE, mutex_name.c_str() ); 23 m_hMutex = ::CreateMutexW( NULL, FALSE, mutex_name.c_str() );
Oleksandr 2014/06/26 00:48:43 We should try to open a mutex in Local namespace i
Eric 2014/06/26 15:13:56 This a defect I introduced. I don't think I notice
23 if (m_hMutex == NULL) 24 if (m_hMutex == NULL)
24 { 25 {
25 m_hMutex = OpenMutexW( NULL, FALSE, mutex_name.c_str() ); 26 m_hMutex = OpenMutexW( NULL, FALSE, mutex_name.c_str() );
26 if (m_hMutex == NULL) 27 if (m_hMutex == NULL)
27 { 28 {
28 DWORD error = GetLastError(); 29 DWORD error = GetLastError();
29 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_MUTEX, PLUGIN_ERROR_MUT EX_CREATE + m_errorSubidBase, L"Mutex::CreateMutex"); 30 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_MUTEX, PLUGIN_ERROR_MUT EX_CREATE + m_errorSubidBase, L"Mutex::CreateMutex");
30 } 31 }
31 } 32 }
32 else 33 else
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } 93 }
93 } 94 }
94 95
95 m_hMutex = NULL; 96 m_hMutex = NULL;
96 } 97 }
97 98
98 bool CPluginMutex::IsLocked() const 99 bool CPluginMutex::IsLocked() const
99 { 100 {
100 return m_isLocked; 101 return m_isLocked;
101 } 102 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld