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

Side by Side Diff: chrome/common/child_process_logging_win.cc

Issue 457028: Ok, here is a different approach at this change. (Closed)
Patch Set: Be even more paranoid Created 11 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/common/child_process_logging.h" 5 #include "chrome/common/child_process_logging.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "chrome/app/breakpad_win.h"
10 #include "chrome/common/chrome_constants.h" 11 #include "chrome/common/chrome_constants.h"
11 #include "chrome/installer/util/google_update_settings.h" 12 #include "chrome/installer/util/google_update_settings.h"
12 #include "googleurl/src/gurl.h" 13 #include "googleurl/src/gurl.h"
13 14
14 namespace child_process_logging { 15 namespace child_process_logging {
15 // exported in breakpad_win.cc: void __declspec(dllexport) __cdecl SetActiveURL. 16 // exported in breakpad_win.cc: void __declspec(dllexport) __cdecl SetActiveURL.
16 typedef void (__cdecl *MainSetActiveURL)(const wchar_t*); 17 typedef void (__cdecl *MainSetActiveURL)(const wchar_t*);
17 18
18 // exported in breakpad_win.cc: void __declspec(dllexport) __cdecl SetClientId. 19 // exported in breakpad_win.cc: void __declspec(dllexport) __cdecl SetClientId.
19 typedef void (__cdecl *MainSetClientId)(const wchar_t*); 20 typedef void (__cdecl *MainSetClientId)(const wchar_t*);
20 21
22 // exported in breakpad_win.cc:
23 // void __declspec(dllexport) __cdecl SetExtensionID.
24 typedef void (__cdecl *MainSetExtensionID)(size_t, const wchar_t*);
25
21 void SetActiveURL(const GURL& url) { 26 void SetActiveURL(const GURL& url) {
22 static MainSetActiveURL set_active_url = NULL; 27 static MainSetActiveURL set_active_url = NULL;
23 // note: benign race condition on set_active_url. 28 // note: benign race condition on set_active_url.
24 if (!set_active_url) { 29 if (!set_active_url) {
25 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); 30 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName);
26 if (!exe_module) 31 if (!exe_module)
27 return; 32 return;
28 set_active_url = reinterpret_cast<MainSetActiveURL>( 33 set_active_url = reinterpret_cast<MainSetActiveURL>(
29 GetProcAddress(exe_module, "SetActiveURL")); 34 GetProcAddress(exe_module, "SetActiveURL"));
30 if (!set_active_url) 35 if (!set_active_url)
(...skipping 23 matching lines...) Expand all
54 if (!exe_module) 59 if (!exe_module)
55 return; 60 return;
56 set_client_id = reinterpret_cast<MainSetClientId>( 61 set_client_id = reinterpret_cast<MainSetClientId>(
57 GetProcAddress(exe_module, "SetClientId")); 62 GetProcAddress(exe_module, "SetClientId"));
58 if (!set_client_id) 63 if (!set_client_id)
59 return; 64 return;
60 } 65 }
61 (set_client_id)(wstr.c_str()); 66 (set_client_id)(wstr.c_str());
62 } 67 }
63 68
69 void SetActiveExtensions(const std::vector<std::string>& extension_ids) {
70 static MainSetExtensionID set_extension_id = NULL;
71 if (!set_extension_id) {
72 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName);
73 if (!exe_module)
74 return;
75 set_extension_id = reinterpret_cast<MainSetExtensionID>(
76 GetProcAddress(exe_module, "SetExtensionID"));
77 if (!set_extension_id)
78 return;
79 }
80
81 for (size_t i = 0; i < kMaxReportedActiveExtensions; ++i) {
82 if (i < extension_ids.size())
83 (set_extension_id)(i, ASCIIToWide(extension_ids[i].c_str()).c_str());
84 else
85 (set_extension_id)(i, L"");
86 }
87 }
88
64 } // namespace child_process_logging 89 } // namespace child_process_logging
OLDNEW
« no previous file with comments | « chrome/common/child_process_logging_mac.mm ('k') | chrome/renderer/extensions/extension_process_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698