Commit 73429ca3 authored by teravest@chromium.org's avatar teravest@chromium.org

Add RenderThread::GetShutdownEvent().

This change adds RenderThread::GetShutdownEvent() to the public content API.
This is required for code outside of content/ that wants to safely use
interfaces like SyncChannel.

BUG=

Review URL: https://codereview.chromium.org/186973002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255275 0039d316-1c4b-4281-b951-d872f2087c98
parent 3d15fd89
......@@ -77,8 +77,6 @@ typedef std::map<PP_Instance, nacl::TrustedPluginChannel*>
base::LazyInstance<InstanceTrustedChannelMap> g_channel_map =
LAZY_INSTANCE_INITIALIZER;
base::WaitableEvent* g_shutdown_event;
void HistogramEnumerate(const std::string& name,
int32_t sample,
int32_t boundary_value) {
......@@ -195,10 +193,9 @@ void LaunchSelLdr(PP_Instance instance,
invalid_handle = (launch_result.trusted_ipc_channel_handle.socket.fd == -1);
#endif
if (!invalid_handle) {
if (g_shutdown_event == NULL)
g_shutdown_event = new base::WaitableEvent(true, false);
g_channel_map.Get()[instance] = new nacl::TrustedPluginChannel(
launch_result.trusted_ipc_channel_handle, callback, g_shutdown_event);
launch_result.trusted_ipc_channel_handle, callback,
content::RenderThread::Get()->GetShutdownEvent());
}
*(static_cast<NaClHandle*>(imc_handle)) =
......
......@@ -22,6 +22,7 @@ class GURL;
namespace base {
class MessageLoop;
class MessageLoopProxy;
class WaitableEvent;
}
namespace IPC {
......@@ -121,6 +122,9 @@ class CONTENT_EXPORT RenderThread : public IPC::Sender {
// proxy servers.
virtual bool ResolveProxy(const GURL& url, std::string* proxy_list) = 0;
// Gets the shutdown event for the process.
virtual base::WaitableEvent* GetShutdownEvent() = 0;
#if defined(OS_WIN)
// Request that the given font be loaded by the browser so it's cached by the
// OS. Please see ChildProcessHost::PreCacheFont for details.
......
......@@ -185,6 +185,10 @@ bool MockRenderThread::ResolveProxy(const GURL& url, std::string* proxy_list) {
return false;
}
base::WaitableEvent* MockRenderThread::GetShutdownEvent() {
return NULL;
}
#if defined(OS_WIN)
void MockRenderThread::PreCacheFont(const LOGFONT& log_font) {
}
......
......@@ -69,6 +69,7 @@ class MockRenderThread : public RenderThread {
virtual void UpdateHistograms(int sequence_number) OVERRIDE;
virtual int PostTaskToAllWebWorkers(const base::Closure& closure) OVERRIDE;
virtual bool ResolveProxy(const GURL& url, std::string* proxy_list) OVERRIDE;
virtual base::WaitableEvent* GetShutdownEvent() OVERRIDE;
#if defined(OS_WIN)
virtual void PreCacheFont(const LOGFONT& log_font) OVERRIDE;
virtual void ReleaseCachedFonts() OVERRIDE;
......
......@@ -1023,6 +1023,10 @@ media::AudioHardwareConfig* RenderThreadImpl::GetAudioHardwareConfig() {
return audio_hardware_config_.get();
}
base::WaitableEvent* RenderThreadImpl::GetShutdownEvent() {
return ChildProcess::current()->GetShutDownEvent();
}
#if defined(OS_WIN)
void RenderThreadImpl::PreCacheFontCharacters(const LOGFONT& log_font,
const base::string16& str) {
......
......@@ -151,6 +151,7 @@ class CONTENT_EXPORT RenderThreadImpl : public RenderThread,
virtual void UpdateHistograms(int sequence_number) OVERRIDE;
virtual int PostTaskToAllWebWorkers(const base::Closure& closure) OVERRIDE;
virtual bool ResolveProxy(const GURL& url, std::string* proxy_list) OVERRIDE;
virtual base::WaitableEvent* GetShutdownEvent() OVERRIDE;
#if defined(OS_WIN)
virtual void PreCacheFont(const LOGFONT& log_font) OVERRIDE;
virtual void ReleaseCachedFonts() OVERRIDE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment