diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-04 22:28:16 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-04 22:28:16 +0000 |
commit | 9a3a293b332de07fe81522061fadd8883789ec4a (patch) | |
tree | 39e2c276c3a7ef8668884bd02c590c8eccb51aa9 /chrome/browser | |
parent | bb050c16657599d3cdee43c8d377ebcca0da64eb (diff) | |
download | chromium_src-9a3a293b332de07fe81522061fadd8883789ec4a.zip chromium_src-9a3a293b332de07fe81522061fadd8883789ec4a.tar.gz chromium_src-9a3a293b332de07fe81522061fadd8883789ec4a.tar.bz2 |
ipc: use strings, not wstrings for channel ids.
They're ASCII anyway.
TEST=covered by existing tests
Review URL: http://codereview.chromium.org/119131
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17682 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rwxr-xr-x | chrome/browser/automation/automation_provider.cc | 2 | ||||
-rw-r--r-- | chrome/browser/automation/automation_provider.h | 2 | ||||
-rw-r--r-- | chrome/browser/browser_init.cc | 10 | ||||
-rw-r--r-- | chrome/browser/browser_init.h | 2 | ||||
-rw-r--r-- | chrome/browser/plugin_process_host.cc | 11 | ||||
-rw-r--r-- | chrome/browser/plugin_process_host.h | 4 | ||||
-rw-r--r-- | chrome/browser/plugin_service.cc | 2 | ||||
-rw-r--r-- | chrome/browser/renderer_host/browser_render_process_host.cc | 8 | ||||
-rw-r--r-- | chrome/browser/utility_process_host.cc | 3 | ||||
-rw-r--r-- | chrome/browser/views/about_ipc_dialog.cc | 3 | ||||
-rw-r--r-- | chrome/browser/worker_host/worker_process_host.cc | 3 |
11 files changed, 27 insertions, 23 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc index e61882d..61f204a 100755 --- a/chrome/browser/automation/automation_provider.cc +++ b/chrome/browser/automation/automation_provider.cc @@ -826,7 +826,7 @@ AutomationProvider::~AutomationProvider() { delete observer; } -void AutomationProvider::ConnectToChannel(const std::wstring& channel_id) { +void AutomationProvider::ConnectToChannel(const std::string& channel_id) { channel_.reset( new IPC::SyncChannel(channel_id, IPC::Channel::MODE_CLIENT, this, NULL, g_browser_process->io_thread()->message_loop(), diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h index 04a6bd8..174faff 100644 --- a/chrome/browser/automation/automation_provider.h +++ b/chrome/browser/automation/automation_provider.h @@ -60,7 +60,7 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, // Establishes a connection to an automation client, if present. // An AutomationProxy should be established (probably in a different process) // before calling this. - void ConnectToChannel(const std::wstring& channel_id); + void ConnectToChannel(const std::string& channel_id); // Sets the number of tabs that we expect; when this number of tabs has // loaded, an AutomationMsg_InitialLoadsComplete message is sent. diff --git a/chrome/browser/browser_init.cc b/chrome/browser/browser_init.cc index 9a1760d..91483dc 100644 --- a/chrome/browser/browser_init.cc +++ b/chrome/browser/browser_init.cc @@ -658,8 +658,8 @@ bool BrowserInit::ProcessCmdLineImpl(const CommandLine& command_line, // Look for the testing channel ID ONLY during process startup if (command_line.HasSwitch(switches::kTestingChannelID)) { - std::wstring testing_channel_id = - command_line.GetSwitchValue(switches::kTestingChannelID); + std::string testing_channel_id = WideToASCII( + command_line.GetSwitchValue(switches::kTestingChannelID)); // TODO(sanjeevr) Check if we need to make this a singleton for // compatibility with the old testing code // If there are any loose parameters, we expect each one to generate a @@ -686,8 +686,8 @@ bool BrowserInit::ProcessCmdLineImpl(const CommandLine& command_line, bool silent_launch = false; if (command_line.HasSwitch(switches::kAutomationClientChannelID)) { - std::wstring automation_channel_id = - command_line.GetSwitchValue(switches::kAutomationClientChannelID); + std::string automation_channel_id = WideToASCII( + command_line.GetSwitchValue(switches::kAutomationClientChannelID)); // If there are any loose parameters, we expect each one to generate a // new tab; if there are none then we have no tabs size_t expected_tabs = @@ -728,7 +728,7 @@ bool BrowserInit::ProcessCmdLineImpl(const CommandLine& command_line, } template <class AutomationProviderClass> -void BrowserInit::CreateAutomationProvider(const std::wstring& channel_id, +void BrowserInit::CreateAutomationProvider(const std::string& channel_id, Profile* profile, size_t expected_tabs) { scoped_refptr<AutomationProviderClass> automation = diff --git a/chrome/browser/browser_init.h b/chrome/browser/browser_init.h index f688692..9d8be57 100644 --- a/chrome/browser/browser_init.h +++ b/chrome/browser/browser_init.h @@ -54,7 +54,7 @@ class BrowserInit { } template <class AutomationProviderClass> - static void CreateAutomationProvider(const std::wstring& channel_id, + static void CreateAutomationProvider(const std::string& channel_id, Profile* profile, size_t expected_tabs); diff --git a/chrome/browser/plugin_process_host.cc b/chrome/browser/plugin_process_host.cc index 53dfe47..39ec81d 100644 --- a/chrome/browser/plugin_process_host.cc +++ b/chrome/browser/plugin_process_host.cc @@ -380,7 +380,8 @@ bool PluginProcessHost::Init(const WebPluginInfo& info, cmd_line.AppendSwitchWithValue(switches::kProcessType, switches::kPluginProcess); - cmd_line.AppendSwitchWithValue(switches::kProcessChannelID, channel_id()); + cmd_line.AppendSwitchWithValue(switches::kProcessChannelID, + ASCIIToWide(channel_id())); cmd_line.AppendSwitchWithValue(switches::kPluginPath, info.path.ToWStringHack()); @@ -449,7 +450,7 @@ void PluginProcessHost::OnChannelConnected(int32 peer_pid) { void PluginProcessHost::OnChannelError() { for (size_t i = 0; i < pending_requests_.size(); ++i) { ReplyToRenderer(pending_requests_[i].renderer_message_filter_.get(), - std::wstring(), + std::string(), FilePath(), pending_requests_[i].reply_msg); } @@ -501,7 +502,7 @@ void PluginProcessHost::OnResolveProxyCompleted(IPC::Message* reply_msg, void PluginProcessHost::ReplyToRenderer( ResourceMessageFilter* renderer_message_filter, - const std::wstring& channel, const FilePath& plugin_path, + const std::string& channel, const FilePath& plugin_path, IPC::Message* reply_msg) { ViewHostMsg_OpenChannelToPlugin::WriteReplyParams(reply_msg, channel, plugin_path); @@ -529,12 +530,12 @@ void PluginProcessHost::RequestPluginChannel( sent_requests_.push(ChannelRequest( renderer_message_filter, mime_type, reply_msg)); } else { - ReplyToRenderer(renderer_message_filter, std::wstring(), FilePath(), + ReplyToRenderer(renderer_message_filter, std::string(), FilePath(), reply_msg); } } -void PluginProcessHost::OnChannelCreated(const std::wstring& channel_name) { +void PluginProcessHost::OnChannelCreated(const std::string& channel_name) { ReplyToRenderer(sent_requests_.front().renderer_message_filter_.get(), channel_name, info_.path, diff --git a/chrome/browser/plugin_process_host.h b/chrome/browser/plugin_process_host.h index 46d5e74..56004f6 100644 --- a/chrome/browser/plugin_process_host.h +++ b/chrome/browser/plugin_process_host.h @@ -65,7 +65,7 @@ class PluginProcessHost : public ChildProcessHost, // Sends the reply to an open channel request to the renderer with the given // channel name. static void ReplyToRenderer(ResourceMessageFilter* renderer_message_filter, - const std::wstring& channel, + const std::string& channel, const FilePath& plugin_path, IPC::Message* reply_msg); @@ -96,7 +96,7 @@ class PluginProcessHost : public ChildProcessHost, const std::string& mime_type, IPC::Message* reply_msg); // Message handlers. - void OnChannelCreated(const std::wstring& channel_name); + void OnChannelCreated(const std::string& channel_name); void OnGetPluginFinderUrl(std::string* plugin_finder_url); void OnGetCookies(uint32 request_context, const GURL& url, std::string* cookies); diff --git a/chrome/browser/plugin_service.cc b/chrome/browser/plugin_service.cc index 86e2a42..10a56f5 100644 --- a/chrome/browser/plugin_service.cc +++ b/chrome/browser/plugin_service.cc @@ -164,7 +164,7 @@ void PluginService::OpenChannelToPlugin( plugin_host->OpenChannelToPlugin(renderer_msg_filter, mime_type, reply_msg); } else { PluginProcessHost::ReplyToRenderer(renderer_msg_filter, - std::wstring(), + std::string(), FilePath(), reply_msg); } diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc index 8cee7ae..59c52cf 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.cc +++ b/chrome/browser/renderer_host/browser_render_process_host.cc @@ -79,7 +79,7 @@ using WebKit::WebCache; // single-process mode. It's not used in multi-process mode. class RendererMainThread : public base::Thread { public: - explicit RendererMainThread(const std::wstring& channel_id) + explicit RendererMainThread(const std::string& channel_id) : base::Thread("Chrome_InProcRendererThread"), channel_id_(channel_id), render_process_(NULL) { @@ -113,7 +113,7 @@ class RendererMainThread : public base::Thread { } private: - std::wstring channel_id_; + std::string channel_id_; // Deleted in CleanUp() on the renderer thread, so don't use a smart pointer. RenderProcess* render_process_; }; @@ -200,7 +200,7 @@ bool BrowserRenderProcessHost::Init() { const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); // setup IPC channel - const std::wstring channel_id = + const std::string channel_id = ChildProcessInfo::GenerateRandomChannelID(this); channel_.reset( new IPC::SyncChannel(channel_id, IPC::Channel::MODE_SERVER, this, @@ -304,7 +304,7 @@ bool BrowserRenderProcessHost::Init() { switches::kRendererProcess); cmd_line.AppendSwitchWithValue(switches::kProcessChannelID, - channel_id); + ASCIIToWide(channel_id)); const std::wstring& profile_path = browser_command_line.GetSwitchValue(switches::kUserDataDir); diff --git a/chrome/browser/utility_process_host.cc b/chrome/browser/utility_process_host.cc index 4c3d83b..2be419e 100644 --- a/chrome/browser/utility_process_host.cc +++ b/chrome/browser/utility_process_host.cc @@ -48,7 +48,8 @@ bool UtilityProcessHost::StartProcess(const FilePath& exposed_dir) { CommandLine cmd_line(exe_path); cmd_line.AppendSwitchWithValue(switches::kProcessType, switches::kUtilityProcess); - cmd_line.AppendSwitchWithValue(switches::kProcessChannelID, channel_id()); + cmd_line.AppendSwitchWithValue(switches::kProcessChannelID, + ASCIIToWide(channel_id())); base::ProcessHandle process; #if defined(OS_WIN) diff --git a/chrome/browser/views/about_ipc_dialog.cc b/chrome/browser/views/about_ipc_dialog.cc index cb21069..f616855 100644 --- a/chrome/browser/views/about_ipc_dialog.cc +++ b/chrome/browser/views/about_ipc_dialog.cc @@ -402,7 +402,8 @@ void AboutIPCDialog::Log(const IPC::LogData& data) { int index = message_list_.InsertItem(count, sent_str.c_str()); message_list_.SetItemText(index, kTimeColumn, sent_str.c_str()); - message_list_.SetItemText(index, kChannelColumn, data.channel.c_str()); + message_list_.SetItemText(index, kChannelColumn, + ASCIIToWide(data.channel).c_str()); std::wstring message_name; IPC::Logging::GetMessageText(data.type, &message_name, NULL, NULL); diff --git a/chrome/browser/worker_host/worker_process_host.cc b/chrome/browser/worker_host/worker_process_host.cc index 4849fb1..d720cff 100644 --- a/chrome/browser/worker_host/worker_process_host.cc +++ b/chrome/browser/worker_host/worker_process_host.cc @@ -75,7 +75,8 @@ bool WorkerProcessHost::Init() { CommandLine cmd_line(exe_path); cmd_line.AppendSwitchWithValue(switches::kProcessType, switches::kWorkerProcess); - cmd_line.AppendSwitchWithValue(switches::kProcessChannelID, channel_id()); + cmd_line.AppendSwitchWithValue(switches::kProcessChannelID, + ASCIIToWide(channel_id())); if (CommandLine::ForCurrentProcess()->HasSwitch( switches::kWebWorkerShareProcesses)) { |