summaryrefslogtreecommitdiffstats
path: root/content/public
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-06 20:34:06 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-06 20:34:06 +0000
commit52647690519017787e65b22941cbd7dd57b42b5f (patch)
treee32377afde4ad1e590123b26fb695cf6f610e6b5 /content/public
parent37d75b246580a34cdcba5430a4df05c1243fd51b (diff)
downloadchromium_src-52647690519017787e65b22941cbd7dd57b42b5f.zip
chromium_src-52647690519017787e65b22941cbd7dd57b42b5f.tar.gz
chromium_src-52647690519017787e65b22941cbd7dd57b42b5f.tar.bz2
Create content::RenderThread interface and make code in chrome use that.
BUG=98716,98375,10837 Review URL: http://codereview.chromium.org/8165013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104358 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/public')
-rw-r--r--content/public/renderer/render_thread.cc8
-rw-r--r--content/public/renderer/render_thread.h101
2 files changed, 109 insertions, 0 deletions
diff --git a/content/public/renderer/render_thread.cc b/content/public/renderer/render_thread.cc
new file mode 100644
index 0000000..3dc536f
--- /dev/null
+++ b/content/public/renderer/render_thread.cc
@@ -0,0 +1,8 @@
+// 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 "content/public/renderer/render_thread.h"
+
+#include "base/lazy_instance.h"
+
diff --git a/content/public/renderer/render_thread.h b/content/public/renderer/render_thread.h
new file mode 100644
index 0000000..3f1e964
--- /dev/null
+++ b/content/public/renderer/render_thread.h
@@ -0,0 +1,101 @@
+// 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.
+
+#ifndef CONTENT_PUBLIC_RENDERER_RENDER_THREAD_H_
+#define CONTENT_PUBLIC_RENDERER_RENDER_THREAD_H_
+
+#include "base/basictypes.h"
+#include "content/common/content_export.h"
+#include "ipc/ipc_channel_proxy.h"
+
+#if defined(OS_WIN)
+#include <windows.h>
+#endif
+
+class MessageLoop;
+class ResourceDispatcher;
+
+namespace IPC {
+class SyncChannel;
+}
+
+namespace v8 {
+class Extension;
+}
+
+namespace content {
+
+class RenderProcessObserver;
+
+class CONTENT_EXPORT RenderThread : public IPC::Message::Sender {
+ public:
+ // Returns the one render thread for this process. Note that this can only
+ // be accessed when running on the render thread itself.
+ static RenderThread* Get();
+
+ RenderThread();
+ virtual ~RenderThread();
+
+ virtual MessageLoop* GetMessageLoop() = 0;
+ virtual IPC::SyncChannel* GetChannel() = 0;
+ virtual ResourceDispatcher* GetResourceDispatcher() = 0;
+ virtual std::string GetLocale() = 0;
+
+ // Called to add or remove a listener for a particular message routing ID.
+ // These methods normally get delegated to a MessageRouter.
+ virtual void AddRoute(int32 routing_id, IPC::Channel::Listener* listener) = 0;
+ virtual void RemoveRoute(int32 routing_id) = 0;
+
+ // These map to IPC::ChannelProxy methods.
+ virtual void AddFilter(IPC::ChannelProxy::MessageFilter* filter) = 0;
+ virtual void RemoveFilter(IPC::ChannelProxy::MessageFilter* filter) = 0;
+ virtual void SetOutgoingMessageFilter(
+ IPC::ChannelProxy::OutgoingMessageFilter* filter) = 0;
+
+ // Add/remove observers for the process.
+ virtual void AddObserver(content::RenderProcessObserver* observer) = 0;
+ virtual void RemoveObserver(content::RenderProcessObserver* observer) = 0;
+
+ // Called by a RenderWidget when it is hidden or restored.
+ virtual void WidgetHidden() = 0;
+ virtual void WidgetRestored() = 0;
+
+ // We initialize WebKit as late as possible. Call this to force
+ // initialization.
+ virtual void EnsureWebKitInitialized() = 0;
+
+ // Helper function to send over a string to be recorded by user metrics
+ virtual void RecordUserMetrics(const std::string& action) = 0;
+
+ // Registers the given V8 extension with WebKit.
+ virtual void RegisterExtension(v8::Extension* extension) = 0;
+
+ // Returns true iff the extension is registered.
+ virtual bool IsRegisteredExtension(
+ const std::string& v8_extension_name) const = 0;
+
+ // Schedule a call to IdleHandler with the given initial delay.
+ virtual void ScheduleIdleHandler(double initial_delay_s) = 0;
+
+ // A task we invoke periodically to assist with idle cleanup.
+ virtual void IdleHandler() = 0;
+
+ // Get/Set the delay for how often the idle handler is called.
+ virtual double GetIdleNotificationDelayInS() const = 0;
+ virtual void SetIdleNotificationDelayInS(
+ double idle_notification_delay_in_s) = 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.
+ virtual void PreCacheFont(const LOGFONT& log_font) = 0;
+
+ // Release cached font.
+ virtual void ReleaseCachedFonts() = 0;
+#endif
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_RENDERER_RENDER_THREAD_H_