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

Unified Diff: chrome/common/child_process_logging_win.cc

Issue 313009: Added a static function pointer to cache the SetActiveURL pointer.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 2 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: chrome/common/child_process_logging_win.cc
===================================================================
--- chrome/common/child_process_logging_win.cc (revision 29531)
+++ chrome/common/child_process_logging_win.cc (working copy)
@@ -11,20 +11,22 @@
#include "googleurl/src/gurl.h"
namespace child_process_logging {
-
+// exported in breakpad_win.cc: void __declspec(dllexport) __cdecl SetActiveURL.
typedef void (__cdecl *MainSetActiveURL)(const wchar_t*);
void SetActiveURL(const GURL& url) {
- HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName);
- if (!exe_module)
- return;
+ static MainSetActiveURL set_active_url = NULL;
+ // note: benign race condition on set_active_url.
+ if (!set_active_url) {
+ HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName);
+ if (!exe_module)
+ return;
+ set_active_url = reinterpret_cast<MainSetActiveURL>(
+ GetProcAddress(exe_module, "SetActiveURL"));
+ if (!set_active_url)
+ return;
+ }
- MainSetActiveURL set_active_url =
- reinterpret_cast<MainSetActiveURL>(
- GetProcAddress(exe_module, "SetActiveURL"));
- if (!set_active_url)
- return;
-
(set_active_url)(UTF8ToWide(url.possibly_invalid_spec()).c_str());
}
« 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