diff options
author | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-13 01:12:13 +0000 |
---|---|---|
committer | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-13 01:12:13 +0000 |
commit | fb79aa28389554bcb6e64242f982f76aabe287b4 (patch) | |
tree | 9166a1669bf7773d83831409662d6bd5317387d6 /content/public | |
parent | 29a65f3f6921d1e16377e340c45191bfac43a499 (diff) | |
download | chromium_src-fb79aa28389554bcb6e64242f982f76aabe287b4.zip chromium_src-fb79aa28389554bcb6e64242f982f76aabe287b4.tar.gz chromium_src-fb79aa28389554bcb6e64242f982f76aabe287b4.tar.bz2 |
Renderer process can allocate anonymous shared memory without help from browser process on Windows.
The browser process IO thread can be busy at startup time. This saves about 20ms to allocate the first command buffer.
Refactored so PepperPluginDelegateImpl and PrintWebViewHelper use the same function to allocate shared memory.
BUG=163215
Review URL: https://codereview.chromium.org/11469015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172748 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/public')
-rw-r--r-- | content/public/renderer/render_thread.h | 4 | ||||
-rw-r--r-- | content/public/test/mock_render_thread.cc | 16 | ||||
-rw-r--r-- | content/public/test/mock_render_thread.h | 2 |
3 files changed, 11 insertions, 11 deletions
diff --git a/content/public/renderer/render_thread.h b/content/public/renderer/render_thread.h index f6a7816..353d38a 100644 --- a/content/public/renderer/render_thread.h +++ b/content/public/renderer/render_thread.h @@ -82,8 +82,8 @@ class CONTENT_EXPORT RenderThread : public IPC::Sender { virtual void RecordUserMetrics(const std::string& action) = 0; // Asks the host to create a block of shared memory for the renderer. - // The shared memory handle allocated by the host is returned back. - virtual base::SharedMemoryHandle HostAllocateSharedMemoryBuffer( + // The shared memory allocated by the host is returned back. + virtual scoped_ptr<base::SharedMemory> HostAllocateSharedMemoryBuffer( uint32 buffer_size) = 0; // Registers the given V8 extension with WebKit. diff --git a/content/public/test/mock_render_thread.cc b/content/public/test/mock_render_thread.cc index b6171c3..b532f39 100644 --- a/content/public/test/mock_render_thread.cc +++ b/content/public/test/mock_render_thread.cc @@ -141,16 +141,16 @@ void MockRenderThread::EnsureWebKitInitialized() { void MockRenderThread::RecordUserMetrics(const std::string& action) { } -base::SharedMemoryHandle MockRenderThread::HostAllocateSharedMemoryBuffer( - uint32 buffer_size) { - base::SharedMemory shared_buf; - if (!shared_buf.CreateAndMapAnonymous(buffer_size)) { +scoped_ptr<base::SharedMemory> + MockRenderThread::HostAllocateSharedMemoryBuffer( + uint32 buffer_size) { + scoped_ptr<base::SharedMemory> shared_buf(new base::SharedMemory); + if (!shared_buf->CreateAndMapAnonymous(buffer_size)) { NOTREACHED() << "Cannot map shared memory buffer"; - return base::SharedMemory::NULLHandle(); + return scoped_ptr<base::SharedMemory>(); } - base::SharedMemoryHandle handle; - shared_buf.GiveToProcess(base::GetCurrentProcessHandle(), &handle); - return handle; + + return scoped_ptr<base::SharedMemory>(shared_buf.release()); } void MockRenderThread::RegisterExtension(v8::Extension* extension) { diff --git a/content/public/test/mock_render_thread.h b/content/public/test/mock_render_thread.h index 298f71f..a241ff0 100644 --- a/content/public/test/mock_render_thread.h +++ b/content/public/test/mock_render_thread.h @@ -59,7 +59,7 @@ class MockRenderThread : public RenderThread { virtual void WidgetRestored() OVERRIDE; virtual void EnsureWebKitInitialized() OVERRIDE; virtual void RecordUserMetrics(const std::string& action) OVERRIDE; - virtual base::SharedMemoryHandle HostAllocateSharedMemoryBuffer( + virtual scoped_ptr<base::SharedMemory> HostAllocateSharedMemoryBuffer( uint32 buffer_size) OVERRIDE; virtual void RegisterExtension(v8::Extension* extension) OVERRIDE; virtual void ScheduleIdleHandler(int64 initial_delay_ms) OVERRIDE; |