summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-15 00:30:05 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-15 00:30:05 +0000
commit8704f89ba45ee9419201a3f32d5be9abeedca164 (patch)
tree1db86fe7b36607d3db0ffc1a6c3e42787b4cec1a /chrome/renderer
parentf9861ac25d3fad3635e8104d9ae661729183d97f (diff)
downloadchromium_src-8704f89ba45ee9419201a3f32d5be9abeedca164.zip
chromium_src-8704f89ba45ee9419201a3f32d5be9abeedca164.tar.gz
chromium_src-8704f89ba45ee9419201a3f32d5be9abeedca164.tar.bz2
Move RenderProcess to content.
TBR=avi Review URL: http://codereview.chromium.org/6864001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81681 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/DEPS1
-rw-r--r--chrome/renderer/autofill/autofill_agent.cc1
-rw-r--r--chrome/renderer/chrome_content_renderer_client.cc1
-rw-r--r--chrome/renderer/chrome_render_observer.cc2
-rw-r--r--chrome/renderer/devtools_agent.cc1
-rw-r--r--chrome/renderer/devtools_client.cc1
-rw-r--r--chrome/renderer/extensions/event_bindings.cc1
-rw-r--r--chrome/renderer/mock_render_process.h2
-rw-r--r--chrome/renderer/render_process.h64
-rw-r--r--chrome/renderer/render_process_impl.cc347
-rw-r--r--chrome/renderer/render_process_impl.h76
-rw-r--r--chrome/renderer/render_process_unittest.cc57
-rw-r--r--chrome/renderer/renderer_glue.cc1
-rw-r--r--chrome/renderer/renderer_histogram_snapshots.cc1
-rw-r--r--chrome/renderer/renderer_main.cc2
-rw-r--r--chrome/renderer/translate_helper.cc1
16 files changed, 10 insertions, 549 deletions
diff --git a/chrome/renderer/DEPS b/chrome/renderer/DEPS
index f928926..f1fd26d 100644
--- a/chrome/renderer/DEPS
+++ b/chrome/renderer/DEPS
@@ -21,6 +21,5 @@ include_rules = [
"+third_party/mach_override",
"+third_party/npapi/bindings",
"+third_party/sqlite",
- "+third_party/tcmalloc",
]
diff --git a/chrome/renderer/autofill/autofill_agent.cc b/chrome/renderer/autofill/autofill_agent.cc
index e874e52..ba88fa3 100644
--- a/chrome/renderer/autofill/autofill_agent.cc
+++ b/chrome/renderer/autofill/autofill_agent.cc
@@ -4,6 +4,7 @@
#include "chrome/renderer/autofill/autofill_agent.h"
+#include "base/message_loop.h"
#include "base/utf_string_conversions.h"
#include "chrome/common/autofill_messages.h"
#include "chrome/common/chrome_constants.h"
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc
index d677e5f..e523d39 100644
--- a/chrome/renderer/chrome_content_renderer_client.cc
+++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -7,6 +7,7 @@
#include <string>
#include "base/command_line.h"
+#include "base/message_loop.h"
#include "base/metrics/histogram.h"
#include "base/values.h"
#include "chrome/common/child_process_logging.h"
diff --git a/chrome/renderer/chrome_render_observer.cc b/chrome/renderer/chrome_render_observer.cc
index ef89792..3f4ff6b 100644
--- a/chrome/renderer/chrome_render_observer.cc
+++ b/chrome/renderer/chrome_render_observer.cc
@@ -5,6 +5,7 @@
#include "chrome/renderer/chrome_render_observer.h"
#include "base/command_line.h"
+#include "base/message_loop.h"
#include "base/metrics/histogram.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/render_messages.h"
@@ -15,6 +16,7 @@
#include "content/renderer/render_view.h"
#include "skia/ext/bitmap_platform_device.h"
#include "skia/ext/image_operations.h"
+#include "skia/ext/platform_canvas.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h"
diff --git a/chrome/renderer/devtools_agent.cc b/chrome/renderer/devtools_agent.cc
index 11b8fd8..ba27dba 100644
--- a/chrome/renderer/devtools_agent.cc
+++ b/chrome/renderer/devtools_agent.cc
@@ -7,6 +7,7 @@
#include <map>
#include "base/command_line.h"
+#include "base/message_loop.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/devtools_messages.h"
#include "chrome/renderer/devtools_agent_filter.h"
diff --git a/chrome/renderer/devtools_client.cc b/chrome/renderer/devtools_client.cc
index 46b1a8f..32f101a 100644
--- a/chrome/renderer/devtools_client.cc
+++ b/chrome/renderer/devtools_client.cc
@@ -5,6 +5,7 @@
#include "chrome/renderer/devtools_client.h"
#include "base/command_line.h"
+#include "base/message_loop.h"
#include "base/utf_string_conversions.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/devtools_messages.h"
diff --git a/chrome/renderer/extensions/event_bindings.cc b/chrome/renderer/extensions/event_bindings.cc
index 7361d392..db26ed7 100644
--- a/chrome/renderer/extensions/event_bindings.cc
+++ b/chrome/renderer/extensions/event_bindings.cc
@@ -6,6 +6,7 @@
#include "base/basictypes.h"
#include "base/lazy_instance.h"
+#include "base/message_loop.h"
#include "chrome/common/extensions/extension_messages.h"
#include "chrome/common/extensions/extension_set.h"
#include "chrome/common/url_constants.h"
diff --git a/chrome/renderer/mock_render_process.h b/chrome/renderer/mock_render_process.h
index 1939b2b..9ee7127 100644
--- a/chrome/renderer/mock_render_process.h
+++ b/chrome/renderer/mock_render_process.h
@@ -6,7 +6,7 @@
#define CHROME_RENDERER_MOCK_RENDER_PROCESS_H_
#pragma once
-#include "chrome/renderer/render_process.h"
+#include "content/renderer/render_process.h"
// This class is a mock of the child process singleton which we use during
// running of the RenderView unit tests.
diff --git a/chrome/renderer/render_process.h b/chrome/renderer/render_process.h
deleted file mode 100644
index 5cc7999..0000000
--- a/chrome/renderer/render_process.h
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_RENDERER_RENDER_PROCESS_H_
-#define CHROME_RENDERER_RENDER_PROCESS_H_
-#pragma once
-
-#include "content/common/child_process.h"
-#include "skia/ext/platform_canvas.h"
-
-class TransportDIB;
-
-namespace gfx {
-class Rect;
-}
-
-namespace skia {
-class PlatformCanvas;
-}
-
-// A abstract interface representing the renderer end of the browser<->renderer
-// connection. The opposite end is the RenderProcessHost. This is a singleton
-// object for each renderer.
-//
-// RenderProcessImpl implements this interface for the regular browser.
-// MockRenderProcess implements this interface for certain tests, especially
-// ones derived from RenderViewTest.
-class RenderProcess : public ChildProcess {
- public:
- RenderProcess() {}
- virtual ~RenderProcess() {}
-
- // Get a canvas suitable for drawing and transporting to the browser
- // memory: (output) the transport DIB memory
- // rect: the rectangle which will be painted, use for sizing the canvas
- // returns: NULL on error
- //
- // When no longer needed, you should pass the TransportDIB to
- // ReleaseTransportDIB so that it can be recycled.
- virtual skia::PlatformCanvas* GetDrawingCanvas(TransportDIB** memory,
- const gfx::Rect& rect) = 0;
-
- // Frees shared memory allocated by AllocSharedMemory. You should only use
- // this function to free the SharedMemory object.
- virtual void ReleaseTransportDIB(TransportDIB* memory) = 0;
-
- // Returns true if plugisn should be loaded in-process.
- virtual bool UseInProcessPlugins() const = 0;
-
- virtual bool HasInitializedMediaLibrary() const = 0;
-
- // Returns a pointer to the RenderProcess singleton instance. Assuming that
- // we're actually a renderer or a renderer test, this static cast will
- // be correct.
- static RenderProcess* current() {
- return static_cast<RenderProcess*>(ChildProcess::current());
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(RenderProcess);
-};
-
-#endif // CHROME_RENDERER_RENDER_PROCESS_H_
diff --git a/chrome/renderer/render_process_impl.cc b/chrome/renderer/render_process_impl.cc
deleted file mode 100644
index deb67b1..0000000
--- a/chrome/renderer/render_process_impl.cc
+++ /dev/null
@@ -1,347 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "build/build_config.h"
-
-#if defined(OS_WIN)
-#include <windows.h>
-#include <objidl.h>
-#include <mlang.h>
-#endif
-
-#include "chrome/renderer/render_process_impl.h"
-
-#include "base/basictypes.h"
-#include "base/command_line.h"
-#include "base/compiler_specific.h"
-#include "base/file_util.h"
-#include "base/message_loop.h"
-#include "base/metrics/histogram.h"
-#include "base/path_service.h"
-#include "base/sys_info.h"
-#include "base/utf_string_conversions.h"
-#include "crypto/nss_util.h"
-#include "chrome/common/chrome_switches.h"
-#include "chrome/common/chrome_paths.h"
-#include "chrome/common/render_messages.h"
-#include "content/common/view_messages.h"
-#include "content/renderer/render_thread.h"
-#include "content/renderer/render_view.h"
-#include "ipc/ipc_channel.h"
-#include "ipc/ipc_message_utils.h"
-#include "media/base/media.h"
-#include "media/base/media_switches.h"
-#include "skia/ext/platform_canvas.h"
-#include "ui/gfx/surface/transport_dib.h"
-#include "webkit/plugins/npapi/plugin_instance.h"
-#include "webkit/plugins/npapi/plugin_lib.h"
-#include "webkit/glue/webkit_glue.h"
-
-#if defined(OS_MACOSX)
-#include "base/mac/mac_util.h"
-#elif defined(OS_WIN)
-#include "app/win/iat_patch_function.h"
-#endif
-
-#if defined(OS_LINUX)
-#include "content/renderer/renderer_sandbox_support_linux.h"
-#endif
-
-#if defined(OS_WIN)
-
-static app::win::IATPatchFunction g_iat_patch_createdca;
-HDC WINAPI CreateDCAPatch(LPCSTR driver_name,
- LPCSTR device_name,
- LPCSTR output,
- const void* init_data) {
- DCHECK(std::string("DISPLAY") == std::string(driver_name));
- DCHECK(!device_name);
- DCHECK(!output);
- DCHECK(!init_data);
-
- // CreateDC fails behind the sandbox, but not CreateCompatibleDC.
- return CreateCompatibleDC(NULL);
-}
-
-static app::win::IATPatchFunction g_iat_patch_get_font_data;
-DWORD WINAPI GetFontDataPatch(HDC hdc,
- DWORD table,
- DWORD offset,
- LPVOID buffer,
- DWORD length) {
- int rv = GetFontData(hdc, table, offset, buffer, length);
- if (rv == GDI_ERROR && hdc) {
- HFONT font = static_cast<HFONT>(GetCurrentObject(hdc, OBJ_FONT));
-
- LOGFONT logfont;
- if (GetObject(font, sizeof(LOGFONT), &logfont)) {
- std::vector<char> font_data;
- if (RenderThread::current()->Send(new ViewHostMsg_PreCacheFont(logfont)))
- rv = GetFontData(hdc, table, offset, buffer, length);
- }
- }
- return rv;
-}
-
-#endif
-
-RenderProcessImpl::RenderProcessImpl()
- : ALLOW_THIS_IN_INITIALIZER_LIST(shared_mem_cache_cleaner_(
- base::TimeDelta::FromSeconds(5),
- this, &RenderProcessImpl::ClearTransportDIBCache)),
- transport_dib_next_sequence_number_(0) {
- in_process_plugins_ = InProcessPlugins();
- for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i)
- shared_mem_cache_[i] = NULL;
-
-#if defined(OS_WIN)
- // HACK: See http://b/issue?id=1024307 for rationale.
- if (GetModuleHandle(L"LPK.DLL") == NULL) {
- // Makes sure lpk.dll is loaded by gdi32 to make sure ExtTextOut() works
- // when buffering into a EMF buffer for printing.
- typedef BOOL (__stdcall *GdiInitializeLanguagePack)(int LoadedShapingDLLs);
- GdiInitializeLanguagePack gdi_init_lpk =
- reinterpret_cast<GdiInitializeLanguagePack>(GetProcAddress(
- GetModuleHandle(L"GDI32.DLL"),
- "GdiInitializeLanguagePack"));
- DCHECK(gdi_init_lpk);
- if (gdi_init_lpk) {
- gdi_init_lpk(0);
- }
- }
-#endif
-
- // Out of process dev tools rely upon auto break behavior.
- webkit_glue::SetJavaScriptFlags(
- "--debugger-auto-break"
- // Enable lazy in-memory profiling.
- " --prof --prof-lazy --logfile=*");
-
- const CommandLine& command_line = *CommandLine::ForCurrentProcess();
- if (command_line.HasSwitch(switches::kJavaScriptFlags)) {
- webkit_glue::SetJavaScriptFlags(
- command_line.GetSwitchValueASCII(switches::kJavaScriptFlags));
- }
-
- if (command_line.HasSwitch(switches::kEnableWatchdog)) {
- // TODO(JAR): Need to implement renderer IO msgloop watchdog.
- }
-
- if (command_line.HasSwitch(switches::kDumpHistogramsOnExit)) {
- base::StatisticsRecorder::set_dump_on_exit(true);
- }
-
- // Note that under Linux, the media library will normally already have
- // been initialized by the Zygote before this instance became a Renderer.
- FilePath media_path;
- if (PathService::Get(chrome::DIR_MEDIA_LIBS, &media_path))
- media::InitializeMediaLibrary(media_path);
-
-#if !defined(OS_MACOSX)
- // TODO(hclam): Add more checks here. Currently this is not used.
- if (media::IsMediaLibraryInitialized() &&
- CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableOpenMax)) {
- media::InitializeOpenMaxLibrary(media_path);
- }
-#endif
-
-#if defined(OS_WIN)
- // Need to patch a few functions for font loading to work correctly.
- FilePath pdf;
- if (PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf) &&
- file_util::PathExists(pdf)) {
- g_iat_patch_createdca.Patch(
- pdf.value().c_str(), "gdi32.dll", "CreateDCA", CreateDCAPatch);
- g_iat_patch_get_font_data.Patch(
- pdf.value().c_str(), "gdi32.dll", "GetFontData", GetFontDataPatch);
- }
-#endif
-
-#if defined(OS_LINUX)
- // Remoting requires NSS to function properly.
-
- if (!command_line.HasSwitch(switches::kSingleProcess) &&
- command_line.HasSwitch(switches::kEnableRemoting)) {
-#if defined(USE_NSS)
- // We are going to fork to engage the sandbox and we have not loaded
- // any security modules so it is safe to disable the fork check in NSS.
- crypto::DisableNSSForkCheck();
- crypto::ForceNSSNoDBInit();
- crypto::EnsureNSSInit();
-#else
- // TODO(bulach): implement openssl support.
- NOTREACHED() << "Remoting is not supported for openssl";
-#endif
- }
-#endif
-}
-
-RenderProcessImpl::~RenderProcessImpl() {
- // TODO(port): Try and limit what we pull in for our non-Win unit test bundle.
-#ifndef NDEBUG
- // log important leaked objects
- webkit_glue::CheckForLeaks();
-#endif
-
- GetShutDownEvent()->Signal();
- ClearTransportDIBCache();
-}
-
-bool RenderProcessImpl::InProcessPlugins() {
- const CommandLine& command_line = *CommandLine::ForCurrentProcess();
-#if defined(OS_LINUX)
- // Plugin processes require a UI message loop, and the Linux message loop
- // implementation only allows one UI loop per process.
- if (command_line.HasSwitch(switches::kInProcessPlugins))
- NOTIMPLEMENTED() << ": in process plugins not supported on Linux";
- return command_line.HasSwitch(switches::kInProcessPlugins);
-#else
- return command_line.HasSwitch(switches::kInProcessPlugins) ||
- command_line.HasSwitch(switches::kSingleProcess);
-#endif
-}
-
-// -----------------------------------------------------------------------------
-// Platform specific code for dealing with bitmap transport...
-
-TransportDIB* RenderProcessImpl::CreateTransportDIB(size_t size) {
-#if defined(OS_WIN) || defined(OS_LINUX)
- // Windows and Linux create transport DIBs inside the renderer
- return TransportDIB::Create(size, transport_dib_next_sequence_number_++);
-#elif defined(OS_MACOSX) // defined(OS_WIN) || defined(OS_LINUX)
- // Mac creates transport DIBs in the browser, so we need to do a sync IPC to
- // get one. The TransportDIB is cached in the browser.
- TransportDIB::Handle handle;
- IPC::Message* msg = new ViewHostMsg_AllocTransportDIB(size, true, &handle);
- if (!main_thread()->Send(msg))
- return NULL;
- if (handle.fd < 0)
- return NULL;
- return TransportDIB::Map(handle);
-#endif // defined(OS_MACOSX)
-}
-
-void RenderProcessImpl::FreeTransportDIB(TransportDIB* dib) {
- if (!dib)
- return;
-
-#if defined(OS_MACOSX)
- // On Mac we need to tell the browser that it can drop a reference to the
- // shared memory.
- IPC::Message* msg = new ViewHostMsg_FreeTransportDIB(dib->id());
- main_thread()->Send(msg);
-#endif
-
- delete dib;
-}
-
-// -----------------------------------------------------------------------------
-
-
-skia::PlatformCanvas* RenderProcessImpl::GetDrawingCanvas(
- TransportDIB** memory, const gfx::Rect& rect) {
- int width = rect.width();
- int height = rect.height();
- const size_t stride = skia::PlatformCanvas::StrideForWidth(rect.width());
-#if defined(OS_LINUX)
- const size_t max_size = base::SysInfo::MaxSharedMemorySize();
-#else
- const size_t max_size = 0;
-#endif
-
- // If the requested size is too big, reduce the height. Ideally we might like
- // to reduce the width as well to make the size reduction more "balanced", but
- // it rarely comes up in practice.
- if ((max_size != 0) && (height * stride > max_size))
- height = max_size / stride;
-
- const size_t size = height * stride;
-
- if (!GetTransportDIBFromCache(memory, size)) {
- *memory = CreateTransportDIB(size);
- if (!*memory)
- return NULL;
- }
-
- return (*memory)->GetPlatformCanvas(width, height);
-}
-
-void RenderProcessImpl::ReleaseTransportDIB(TransportDIB* mem) {
- if (PutSharedMemInCache(mem)) {
- shared_mem_cache_cleaner_.Reset();
- return;
- }
-
- FreeTransportDIB(mem);
-}
-
-bool RenderProcessImpl::UseInProcessPlugins() const {
- return in_process_plugins_;
-}
-
-bool RenderProcessImpl::HasInitializedMediaLibrary() const {
- return media::IsMediaLibraryInitialized();
-}
-
-bool RenderProcessImpl::GetTransportDIBFromCache(TransportDIB** mem,
- size_t size) {
- // look for a cached object that is suitable for the requested size.
- for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) {
- if (shared_mem_cache_[i] &&
- size <= shared_mem_cache_[i]->size()) {
- *mem = shared_mem_cache_[i];
- shared_mem_cache_[i] = NULL;
- return true;
- }
- }
-
- return false;
-}
-
-int RenderProcessImpl::FindFreeCacheSlot(size_t size) {
- // simple algorithm:
- // - look for an empty slot to store mem, or
- // - if full, then replace smallest entry which is smaller than |size|
- for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) {
- if (shared_mem_cache_[i] == NULL)
- return i;
- }
-
- size_t smallest_size = size;
- int smallest_index = -1;
-
- for (size_t i = 1; i < arraysize(shared_mem_cache_); ++i) {
- const size_t entry_size = shared_mem_cache_[i]->size();
- if (entry_size < smallest_size) {
- smallest_size = entry_size;
- smallest_index = i;
- }
- }
-
- if (smallest_index != -1) {
- FreeTransportDIB(shared_mem_cache_[smallest_index]);
- shared_mem_cache_[smallest_index] = NULL;
- }
-
- return smallest_index;
-}
-
-bool RenderProcessImpl::PutSharedMemInCache(TransportDIB* mem) {
- const int slot = FindFreeCacheSlot(mem->size());
- if (slot == -1)
- return false;
-
- shared_mem_cache_[slot] = mem;
- return true;
-}
-
-void RenderProcessImpl::ClearTransportDIBCache() {
- for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) {
- if (shared_mem_cache_[i]) {
- FreeTransportDIB(shared_mem_cache_[i]);
- shared_mem_cache_[i] = NULL;
- }
- }
-}
diff --git a/chrome/renderer/render_process_impl.h b/chrome/renderer/render_process_impl.h
deleted file mode 100644
index be53005..0000000
--- a/chrome/renderer/render_process_impl.h
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_RENDERER_RENDER_PROCESS_IMPL_H_
-#define CHROME_RENDERER_RENDER_PROCESS_IMPL_H_
-#pragma once
-
-#include "base/timer.h"
-#include "chrome/renderer/render_process.h"
-#include "native_client/src/shared/imc/nacl_imc.h"
-
-namespace skia {
-class PlatformCanvas;
-}
-
-// Implementation of the RenderProcess interface for the regular browser.
-// See also MockRenderProcess which implements the active "RenderProcess" when
-// running under certain unit tests.
-class RenderProcessImpl : public RenderProcess {
- public:
- RenderProcessImpl();
- ~RenderProcessImpl();
-
- // RenderProcess implementation.
- virtual skia::PlatformCanvas* GetDrawingCanvas(TransportDIB** memory,
- const gfx::Rect& rect);
- virtual void ReleaseTransportDIB(TransportDIB* memory);
- virtual bool UseInProcessPlugins() const;
- virtual bool HasInitializedMediaLibrary() const;
-
- // Like UseInProcessPlugins(), but called before RenderProcess is created
- // and does not allow overriding by tests. This just checks the command line
- // each time.
- static bool InProcessPlugins();
-
- private:
- // Look in the shared memory cache for a suitable object to reuse.
- // result: (output) the memory found
- // size: the resulting memory will be >= this size, in bytes
- // returns: false if a suitable DIB memory could not be found
- bool GetTransportDIBFromCache(TransportDIB** result, size_t size);
-
- // Maybe put the given shared memory into the shared memory cache. Returns
- // true if the SharedMemory object was stored in the cache; otherwise, false
- // is returned.
- bool PutSharedMemInCache(TransportDIB* memory);
-
- void ClearTransportDIBCache();
-
- // Return the index of a free cache slot in which to install a transport DIB
- // of the given size. If all entries in the cache are larger than the given
- // size, this doesn't free any slots and returns -1.
- int FindFreeCacheSlot(size_t size);
-
- // Create a new transport DIB of, at least, the given size. Return NULL on
- // error.
- TransportDIB* CreateTransportDIB(size_t size);
- void FreeTransportDIB(TransportDIB*);
-
- // A very simplistic and small cache. If an entry in this array is non-null,
- // then it points to a SharedMemory object that is available for reuse.
- TransportDIB* shared_mem_cache_[2];
-
- // This DelayTimer cleans up our cache 5 seconds after the last use.
- base::DelayTimer<RenderProcessImpl> shared_mem_cache_cleaner_;
-
- // TransportDIB sequence number
- uint32 transport_dib_next_sequence_number_;
-
- bool in_process_plugins_;
-
- DISALLOW_COPY_AND_ASSIGN(RenderProcessImpl);
-};
-
-#endif // CHROME_RENDERER_RENDER_PROCESS_IMPL_H_
diff --git a/chrome/renderer/render_process_unittest.cc b/chrome/renderer/render_process_unittest.cc
deleted file mode 100644
index 9e9a065..0000000
--- a/chrome/renderer/render_process_unittest.cc
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/sys_info.h"
-#include "base/string_util.h"
-#include "chrome/renderer/render_process_impl.h"
-#include "ipc/ipc_channel.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/gfx/rect.h"
-
-namespace {
-
-static const char kThreadName[] = "render_process_unittest";
-
-class RenderProcessTest : public testing::Test {
- public:
- virtual void SetUp() {
- // Need a MODE_SERVER to make MODE_CLIENTs (like a RenderThread) happy.
- channel_ = new IPC::Channel(kThreadName, IPC::Channel::MODE_SERVER, NULL);
- render_process_.reset(new RenderProcessImpl);
- }
-
- virtual void TearDown() {
- message_loop_.RunAllPending();
- render_process_.reset();
- // Need to fully destruct IPC::SyncChannel before the message loop goes
- // away.
- message_loop_.RunAllPending();
- // Delete the server channel after the RenderThread so that
- // IPC::SyncChannel's OnChannelError doesn't fire on the context and attempt
- // to use the listener thread which is now gone.
- delete channel_;
- }
-
- private:
- MessageLoopForIO message_loop_;
- scoped_ptr<RenderProcessImpl> render_process_;
- IPC::Channel *channel_;
-};
-
-
-TEST_F(RenderProcessTest, TestTransportDIBAllocation) {
- // On Mac, we allocate in the browser so this test is invalid.
-#if !defined(OS_MACOSX)
- const gfx::Rect rect(0, 0, 100, 100);
- TransportDIB* dib;
- skia::PlatformCanvas* canvas =
- RenderProcess::current()->GetDrawingCanvas(&dib, rect);
- ASSERT_TRUE(dib);
- ASSERT_TRUE(canvas);
- RenderProcess::current()->ReleaseTransportDIB(dib);
- delete canvas;
-#endif
-}
-
-} // namespace
diff --git a/chrome/renderer/renderer_glue.cc b/chrome/renderer/renderer_glue.cc
index 47e2304..67a53e7 100644
--- a/chrome/renderer/renderer_glue.cc
+++ b/chrome/renderer/renderer_glue.cc
@@ -20,7 +20,6 @@
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
-#include "chrome/renderer/render_process.h"
#include "content/common/clipboard_messages.h"
#include "content/common/socket_stream_dispatcher.h"
#include "content/common/view_messages.h"
diff --git a/chrome/renderer/renderer_histogram_snapshots.cc b/chrome/renderer/renderer_histogram_snapshots.cc
index 3eed2d2..feb9d64 100644
--- a/chrome/renderer/renderer_histogram_snapshots.cc
+++ b/chrome/renderer/renderer_histogram_snapshots.cc
@@ -10,7 +10,6 @@
#include "base/message_loop.h"
#include "base/metrics/histogram.h"
#include "chrome/common/render_messages.h"
-#include "chrome/renderer/render_process.h"
#include "content/renderer/render_thread.h"
// TODO(raman): Before renderer shuts down send final snapshot lists.
diff --git a/chrome/renderer/renderer_main.cc b/chrome/renderer/renderer_main.cc
index 8d4e51c..2066dc8e0 100644
--- a/chrome/renderer/renderer_main.cc
+++ b/chrome/renderer/renderer_main.cc
@@ -28,9 +28,9 @@
#include "chrome/common/net/net_resource_provider.h"
#include "chrome/common/pepper_plugin_registry.h"
#include "chrome/renderer/renderer_main_platform_delegate.h"
-#include "chrome/renderer/render_process_impl.h"
#include "content/common/main_function_params.h"
#include "content/common/hi_res_timer_manager.h"
+#include "content/renderer/render_process_impl.h"
#include "content/renderer/render_thread.h"
#include "grit/generated_resources.h"
#include "net/base/net_module.h"
diff --git a/chrome/renderer/translate_helper.cc b/chrome/renderer/translate_helper.cc
index 4d4fed1..e19c85a 100644
--- a/chrome/renderer/translate_helper.cc
+++ b/chrome/renderer/translate_helper.cc
@@ -5,6 +5,7 @@
#include "chrome/renderer/translate_helper.h"
#include "base/compiler_specific.h"
+#include "base/message_loop.h"
#include "base/metrics/histogram.h"
#include "base/utf_string_conversions.h"
#include "chrome/common/chrome_constants.h"