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

Unified Diff: content/common/sandbox_policy.cc

Issue 7648035: Make PrependWindowsSessionPath thread safe (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/sandbox_policy.cc
===================================================================
--- content/common/sandbox_policy.cc (revision 96778)
+++ content/common/sandbox_policy.cc (working copy)
@@ -198,22 +198,20 @@
// Returns the object path prepended with the current logon session.
string16 PrependWindowsSessionPath(const char16* object) {
// Cache this because it can't change after process creation.
- static string16* session_prefix = NULL;
- if (!session_prefix) {
+ uintptr_t s_session_id = 0;
+ if (s_session_id == 0) {
HANDLE token;
- DWORD session_id;
DWORD session_id_length;
+ DWORD session_id = 0;
CHECK(::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &token));
CHECK(::GetTokenInformation(token, TokenSessionId, &session_id,
sizeof(session_id), &session_id_length));
CloseHandle(token);
-
- session_prefix = new string16(base::StringPrintf(L"\\Sessions\\%d",
- session_id));
+ s_session_id = session_id;
}
- return *session_prefix + object;
+ return base::StringPrintf(L"\\Sessions\\%d%ls", s_session_id, object);
}
// Closes handles that are opened at process creation and initialization.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698