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

Side by Side Diff: chrome_frame/pin_module.cc

Issue 12521002: Start and stop crash reporting outside of the loader lock. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: unit test Created 7 years, 9 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
« no previous file with comments | « chrome_frame/pin_module.h ('k') | chrome_frame/scoped_initialization_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome_frame/pin_module.h"
6
7 #include <windows.h>
8
9 #include "base/logging.h"
10 #include "chrome_frame/utils.h"
11
12 extern "C" IMAGE_DOS_HEADER __ImageBase;
13
14 namespace chrome_frame {
15
16 namespace {
17
18 PinModuleCallbackFn g_pin_module_callback = NULL;
19
20 } // namespace
21
22 void SetPinModuleCallback(PinModuleCallbackFn callback) {
23 g_pin_module_callback = callback;
24 }
25
26 void PinModule() {
27 static bool s_pinned = false;
28 if (!s_pinned && !IsUnpinnedMode()) {
29 wchar_t system_buffer[MAX_PATH];
30 HMODULE this_module = reinterpret_cast<HMODULE>(&__ImageBase);
31 system_buffer[0] = 0;
32 if (GetModuleFileName(this_module, system_buffer,
33 arraysize(system_buffer)) != 0) {
34 HMODULE unused;
35 if (!GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_PIN, system_buffer,
36 &unused)) {
37 DPLOG(FATAL) << "Failed to pin module " << system_buffer;
38 } else {
39 s_pinned = true;
40 if (g_pin_module_callback)
41 g_pin_module_callback();
42 }
43 } else {
44 DPLOG(FATAL) << "Could not get module path.";
45 }
46 }
47 }
48
49 } // namespace chrome_frame
OLDNEW
« no previous file with comments | « chrome_frame/pin_module.h ('k') | chrome_frame/scoped_initialization_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698