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

Unified Diff: chrome/common/child_process_logging_win.cc

Issue 10411059: Don't pass class types across EXE/DLL boundaries for SetCommandLine() and SetExperimentList(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add a comment Created 8 years, 7 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 | « chrome/app/breakpad_win.cc ('k') | 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
diff --git a/chrome/common/child_process_logging_win.cc b/chrome/common/child_process_logging_win.cc
index 56088f42fb1e16e5da78101bc4b7358f6334303a..19b3f7881867e1e3184bef862ccd361313621ecc 100644
--- a/chrome/common/child_process_logging_win.cc
+++ b/chrome/common/child_process_logging_win.cc
@@ -17,6 +17,9 @@
#include "googleurl/src/gurl.h"
namespace child_process_logging {
+
+namespace {
+
// exported in breakpad_win.cc: void __declspec(dllexport) __cdecl SetActiveURL.
typedef void (__cdecl *MainSetActiveURL)(const wchar_t*);
@@ -46,11 +49,22 @@ typedef void (__cdecl *MainSetNumberOfViews)(int);
// exported in breakpad_win.cc:
// void __declspec(dllexport) __cdecl SetCommandLine
-typedef void (__cdecl *MainSetCommandLine)(const CommandLine*);
+typedef void (__cdecl *MainSetCommandLine)(const wchar_t**, size_t);
// exported in breakpad_field_trial_win.cc:
// void __declspec(dllexport) __cdecl SetExperimentList
-typedef void (__cdecl *MainSetExperimentList)(const std::vector<string16>&);
+typedef void (__cdecl *MainSetExperimentList)(const wchar_t**, size_t);
+
+// Copied from breakpad_win.cc.
+void StringVectorToCStringVector(const std::vector<std::wstring>& wstrings,
+ std::vector<const wchar_t*>* cstrings) {
+ cstrings->clear();
+ cstrings->reserve(wstrings.size());
+ for (size_t i = 0; i < wstrings.size(); ++i)
+ cstrings->push_back(wstrings[i].c_str());
+}
+
+} // namespace
void SetActiveURL(const GURL& url) {
static MainSetActiveURL set_active_url = NULL;
@@ -189,7 +203,10 @@ void SetCommandLine(const CommandLine* command_line) {
if (!set_command_line)
return;
}
- (set_command_line)(command_line);
+
+ std::vector<const wchar_t*> cstrings;
+ StringVectorToCStringVector(command_line->argv(), &cstrings);
+ (set_command_line)(&cstrings[0], cstrings.size());
}
void SetExperimentList(const std::vector<string16>& state) {
@@ -204,7 +221,10 @@ void SetExperimentList(const std::vector<string16>& state) {
if (!set_experiment_list)
return;
}
- (set_experiment_list)(state);
+
+ std::vector<const wchar_t*> cstrings;
+ StringVectorToCStringVector(state, &cstrings);
+ (set_experiment_list)(&cstrings[0], cstrings.size());
}
void SetNumberOfViews(int number_of_views) {
« no previous file with comments | « chrome/app/breakpad_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698