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

Side by Side Diff: chrome/browser/process_singleton_win.cc

Issue 6126002: Remove base/scoped_handle_win.h stub and fix up all callers to use the new location and namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 9 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/process_singleton.h" 5 #include "chrome/browser/process_singleton.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/win/hwnd_util.h" 8 #include "app/win/hwnd_util.h"
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/process_util.h" 13 #include "base/process_util.h"
14 #include "base/scoped_handle.h"
15 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
15 #include "base/win/scoped_handle.h"
16 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/extensions/extensions_startup.h" 17 #include "chrome/browser/extensions/extensions_startup.h"
18 #include "chrome/browser/platform_util.h" 18 #include "chrome/browser/platform_util.h"
19 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/profiles/profile_manager.h" 20 #include "chrome/browser/profiles/profile_manager.h"
21 #include "chrome/browser/ui/browser_init.h" 21 #include "chrome/browser/ui/browser_init.h"
22 #include "chrome/common/chrome_constants.h" 22 #include "chrome/common/chrome_constants.h"
23 #include "chrome/common/chrome_paths.h" 23 #include "chrome/common/chrome_paths.h"
24 #include "chrome/common/chrome_switches.h" 24 #include "chrome/common/chrome_switches.h"
25 #include "chrome/common/result_codes.h" 25 #include "chrome/common/result_codes.h"
(...skipping 20 matching lines...) Expand all
46 remote_window_ = FindWindowEx(HWND_MESSAGE, NULL, 46 remote_window_ = FindWindowEx(HWND_MESSAGE, NULL,
47 chrome::kMessageWindowClass, 47 chrome::kMessageWindowClass,
48 user_data_dir_str.c_str()); 48 user_data_dir_str.c_str());
49 if (!remote_window_) { 49 if (!remote_window_) {
50 // Make sure we will be the one and only process creating the window. 50 // Make sure we will be the one and only process creating the window.
51 // We use a named Mutex since we are protecting against multi-process 51 // We use a named Mutex since we are protecting against multi-process
52 // access. As documented, it's clearer to NOT request ownership on creation 52 // access. As documented, it's clearer to NOT request ownership on creation
53 // since it isn't guaranteed we will get it. It is better to create it 53 // since it isn't guaranteed we will get it. It is better to create it
54 // without ownership and explicitly get the ownership afterward. 54 // without ownership and explicitly get the ownership afterward.
55 std::wstring mutex_name(L"Local\\ChromeProcessSingletonStartup!"); 55 std::wstring mutex_name(L"Local\\ChromeProcessSingletonStartup!");
56 ScopedHandle only_me(CreateMutex(NULL, FALSE, mutex_name.c_str())); 56 base::win::ScopedHandle only_me(
57 CreateMutex(NULL, FALSE, mutex_name.c_str()));
57 DCHECK(only_me.Get() != NULL) << "GetLastError = " << GetLastError(); 58 DCHECK(only_me.Get() != NULL) << "GetLastError = " << GetLastError();
58 59
59 // This is how we acquire the mutex (as opposed to the initial ownership). 60 // This is how we acquire the mutex (as opposed to the initial ownership).
60 DWORD result = WaitForSingleObject(only_me, INFINITE); 61 DWORD result = WaitForSingleObject(only_me, INFINITE);
61 DCHECK(result == WAIT_OBJECT_0) << "Result = " << result << 62 DCHECK(result == WAIT_OBJECT_0) << "Result = " << result <<
62 "GetLastError = " << GetLastError(); 63 "GetLastError = " << GetLastError();
63 64
64 // We now own the mutex so we are the only process that can create the 65 // We now own the mutex so we are the only process that can create the
65 // window at this time, but we must still check if someone created it 66 // window at this time, but we must still check if someone created it
66 // between the time where we looked for it above and the time the mutex 67 // between the time where we looked for it above and the time the mutex
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 switch (message) { 305 switch (message) {
305 case WM_COPYDATA: 306 case WM_COPYDATA:
306 return OnCopyData(reinterpret_cast<HWND>(wparam), 307 return OnCopyData(reinterpret_cast<HWND>(wparam),
307 reinterpret_cast<COPYDATASTRUCT*>(lparam)); 308 reinterpret_cast<COPYDATASTRUCT*>(lparam));
308 default: 309 default:
309 break; 310 break;
310 } 311 }
311 312
312 return ::DefWindowProc(hwnd, message, wparam, lparam); 313 return ::DefWindowProc(hwnd, message, wparam, lparam);
313 } 314 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698