summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authormpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-21 23:52:48 +0000
committermpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-21 23:52:48 +0000
commitd9db9154512aa5966215592069490d1d39e88c9e (patch)
treef6daa03d71cf73fc92f3a45a5a5b58325b84148d /chrome
parenta6df511aec98ab84faaa1b238335a4640bba940f (diff)
downloadchromium_src-d9db9154512aa5966215592069490d1d39e88c9e.zip
chromium_src-d9db9154512aa5966215592069490d1d39e88c9e.tar.gz
chromium_src-d9db9154512aa5966215592069490d1d39e88c9e.tar.bz2
Fix a timing issue that caused gears to fail to load sometimes.
BUG=http://b/issue?id=1559007 BUG=http://code.google.com/p/chromium/issues/detail?id=4219 Review URL: http://codereview.chromium.org/18604 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8417 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/plugin_process_host.cc11
-rw-r--r--chrome/browser/plugin_process_host.h1
-rw-r--r--chrome/common/chrome_switches.cc4
-rw-r--r--chrome/common/chrome_switches.h1
-rw-r--r--chrome/common/plugin_messages_internal.h5
-rw-r--r--chrome/plugin/chrome_plugin_host.cc8
6 files changed, 15 insertions, 15 deletions
diff --git a/chrome/browser/plugin_process_host.cc b/chrome/browser/plugin_process_host.cc
index 9da52d2..0362423 100644
--- a/chrome/browser/plugin_process_host.cc
+++ b/chrome/browser/plugin_process_host.cc
@@ -511,6 +511,11 @@ bool PluginProcessHost::Init(const FilePath& plugin_path,
cmd_line.AppendSwitchWithValue(switches::kLang, locale);
}
+ // Gears requires the data dir to be available on startup.
+ std::wstring data_dir = plugin_service_->GetChromePluginDataDir();;
+ DCHECK(!data_dir.empty());
+ cmd_line.AppendSwitchWithValue(switches::kPluginDataDir, data_dir);
+
cmd_line.AppendSwitchWithValue(switches::kProcessType,
switches::kPluginProcess);
@@ -650,8 +655,6 @@ void PluginProcessHost::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(PluginProcessHostMsg_ShutdownRequest,
OnPluginShutdownRequest)
IPC_MESSAGE_HANDLER(PluginProcessHostMsg_PluginMessage, OnPluginMessage)
- IPC_MESSAGE_HANDLER(PluginProcessHostMsg_GetPluginDataDir,
- OnGetPluginDataDir)
IPC_MESSAGE_HANDLER(ViewHostMsg_RequestResource, OnRequestResource)
IPC_MESSAGE_HANDLER(ViewHostMsg_CancelRequest, OnCancelRequest)
IPC_MESSAGE_HANDLER(ViewHostMsg_DataReceived_ACK, OnDataReceivedACK)
@@ -918,10 +921,6 @@ void PluginProcessHost::OnPluginMessage(
}
}
-void PluginProcessHost::OnGetPluginDataDir(std::wstring* retval) {
- *retval = plugin_service_->GetChromePluginDataDir();
-}
-
void PluginProcessHost::OnCreateWindow(HWND parent, IPC::Message* reply_msg) {
// Need to create this window on the UI thread.
plugin_service_->main_message_loop()->PostTask(FROM_HERE,
diff --git a/chrome/browser/plugin_process_host.h b/chrome/browser/plugin_process_host.h
index 24737fc..a4e390c 100644
--- a/chrome/browser/plugin_process_host.h
+++ b/chrome/browser/plugin_process_host.h
@@ -113,7 +113,6 @@ class PluginProcessHost : public IPC::Channel::Listener,
void OnResolveProxy(const GURL& url, IPC::Message* reply_msg);
void OnPluginShutdownRequest();
void OnPluginMessage(const std::vector<uint8>& data);
- void OnGetPluginDataDir(std::wstring* retval);
void OnCreateWindow(HWND parent, IPC::Message* reply_msg);
void OnDestroyWindow(HWND window);
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 046b7ea..a156748 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -112,6 +112,10 @@ const wchar_t kTestSandbox[] = L"test-sandbox";
// for all of its state.
const wchar_t kUserDataDir[] = L"user-data-dir";
+// Specifies the plugin data directory, which is where plugins (Gears
+// specifically) will store its state.
+const wchar_t kPluginDataDir[] = L"plugin-data-dir";
+
// Specifies the path to the user data folder for the parent profile.
const wchar_t kParentProfile[] = L"parent-profile";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index e712596..65a7e00 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -39,6 +39,7 @@ extern const wchar_t kSafePlugins[];
extern const wchar_t kTrustedPlugins[];
extern const wchar_t kTestSandbox[];
extern const wchar_t kUserDataDir[];
+extern const wchar_t kPluginDataDir[];
extern const wchar_t kParentProfile[];
extern const wchar_t kApp[];
extern const wchar_t kAppUploadFile[];
diff --git a/chrome/common/plugin_messages_internal.h b/chrome/common/plugin_messages_internal.h
index 1d9380c..c806bf0 100644
--- a/chrome/common/plugin_messages_internal.h
+++ b/chrome/common/plugin_messages_internal.h
@@ -62,11 +62,6 @@ IPC_BEGIN_MESSAGES(PluginProcessHost, 4)
std::vector<uint8> /* opaque data */,
std::vector<uint8> /* opaque data response */)
- // Retrieve the given type of info that is associated with the given
- // CPBrowsingContext. Returns the result in a string.
- IPC_SYNC_MESSAGE_CONTROL0_1(PluginProcessHostMsg_GetPluginDataDir,
- std::wstring /* data_dir_retval */)
-
// Used to get cookies for the given URL. The request_context is a
// CPBrowsingContext, but is passed as int32 to avoid compilation errors.
IPC_SYNC_MESSAGE_CONTROL2_1(PluginProcessHostMsg_GetCookies,
diff --git a/chrome/plugin/chrome_plugin_host.cc b/chrome/plugin/chrome_plugin_host.cc
index 2002fa90..42d15ef 100644
--- a/chrome/plugin/chrome_plugin_host.cc
+++ b/chrome/plugin/chrome_plugin_host.cc
@@ -4,11 +4,13 @@
#include "chrome/plugin/chrome_plugin_host.h"
+#include "base/command_line.h"
#include "base/file_util.h"
#include "base/message_loop.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_plugin_lib.h"
#include "chrome/common/chrome_plugin_util.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/plugin/plugin_process.h"
#include "chrome/plugin/plugin_thread.h"
#include "chrome/plugin/webplugin_proxy.h"
@@ -334,9 +336,9 @@ int STDCALL CPB_GetBrowsingContextInfo(
if (buf_size < sizeof(char*))
return sizeof(char*);
- std::wstring wretval;
- PluginThread::GetPluginThread()->Send(
- new PluginProcessHostMsg_GetPluginDataDir(&wretval));
+ std::wstring wretval = CommandLine::ForCurrentProcess()->
+ GetSwitchValue(switches::kPluginDataDir);
+ DCHECK(!wretval.empty());
file_util::AppendToPath(&wretval, chrome::kChromePluginDataDirname);
*static_cast<char**>(buf) = CPB_StringDup(CPB_Alloc, WideToUTF8(wretval));
return CPERR_SUCCESS;