Skip to content

Commit

Permalink
Move a bunch of code in content\common (as well as a few left in rend…
Browse files Browse the repository at this point in the history
…erer) to the content namespace.

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163359 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
jam@chromium.org committed Oct 22, 2012
1 parent f6b218e commit eb39819
Show file tree
Hide file tree
Showing 131 changed files with 558 additions and 210 deletions.
4 changes: 2 additions & 2 deletions base/threading/thread_restrictions.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
class AcceleratedPresenter;
class BrowserProcessImpl;
class HistogramSynchronizer;
class GpuChannelHost;
class MetricsService;
class NativeBackendKWallet;
class ScopedAllowWaitForLegacyWebViewApi;
Expand All @@ -45,6 +44,7 @@ class Predictor;
namespace content {
class BrowserGpuChannelHostFactory;
class GLHelper;
class GpuChannelHost;
class RenderWidgetHelper;
}
namespace dbus {
Expand Down Expand Up @@ -189,6 +189,7 @@ class BASE_EXPORT ThreadRestrictions {
friend class
content::BrowserGpuChannelHostFactory; // http://crbug.com/125248
friend class content::GLHelper; // http://crbug.com/125415
friend class content::GpuChannelHost; // http://crbug.com/125264
friend class dbus::Bus; // http://crbug.com/125222
friend class disk_cache::BackendImpl; // http://crbug.com/74623
friend class disk_cache::InFlightIO; // http://crbug.com/74623
Expand All @@ -198,7 +199,6 @@ class BASE_EXPORT ThreadRestrictions {
friend class net::NetworkManagerApi; // http://crbug.com/125097
friend class ::AcceleratedPresenter; // http://crbug.com/125391
friend class ::BrowserProcessImpl; // http://crbug.com/125207
friend class ::GpuChannelHost; // http://crbug.com/125264
friend class ::MetricsService; // http://crbug.com/124954
friend class ::TextInputClientMac; // http://crbug.com/121917
friend class ::NativeBackendKWallet; // http://crbug.com/125331
Expand Down
2 changes: 1 addition & 1 deletion content/app/content_main_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ int tc_set_new_mode(int mode);
}
#endif

extern int GpuMain(const content::MainFunctionParams&);
namespace content {
extern int GpuMain(const content::MainFunctionParams&);
extern int PluginMain(const content::MainFunctionParams&);
extern int PpapiPluginMain(const MainFunctionParams&);
extern int PpapiBrokerMain(const MainFunctionParams&);
Expand Down
2 changes: 2 additions & 0 deletions content/browser/browser_main_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

bool g_exited_main_message_loop = false;

using content::ChildProcess;

namespace {

class BrowserMainRunnerImpl : public content::BrowserMainRunner {
Expand Down
2 changes: 2 additions & 0 deletions content/browser/gpu/gpu_process_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@

using content::BrowserThread;
using content::ChildProcessHost;
using content::GpuChildThread;
using content::GpuProcess;
using content::RenderProcessHost;
using content::RenderWidgetHelper;
using content::RenderWidgetHost;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h"
#include "webkit/glue/webkit_glue.h"

using content::GpuChannelHostFactory;

BrowserWebKitPlatformSupportImpl::BrowserWebKitPlatformSupportImpl() {
file_utilities_.set_sandbox_enabled(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class BrowserWebKitPlatformSupportImpl :
bool sync_dir);

protected:
virtual GpuChannelHostFactory* GetGpuChannelHostFactory() OVERRIDE;
virtual content::GpuChannelHostFactory* GetGpuChannelHostFactory() OVERRIDE;

private:
webkit_glue::WebFileUtilitiesImpl file_utilities_;
Expand Down
3 changes: 3 additions & 0 deletions content/browser/renderer_host/image_transport_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@

using content::BrowserGpuChannelHostFactory;
using content::GLHelper;
using content::GpuChannelHostFactory;
using content::WebGraphicsContext3DCommandBufferImpl;
using content::WebGraphicsContext3DSwapBuffersClient;

namespace {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
#include "base/memory/scoped_ptr.h"
#include "ui/gfx/native_widget_types.h"

class WebGraphicsContext3DCommandBufferImpl;

namespace content {
class WebGraphicsContext3DCommandBufferImpl;

class ImageTransportFactoryAndroid {
public:
Expand Down
4 changes: 4 additions & 0 deletions content/common/appcache/appcache_backend_proxy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#include "content/common/appcache_messages.h"

namespace content {

void AppCacheBackendProxy::RegisterHost(int host_id) {
sender_->Send(new AppCacheHostMsg_RegisterHost(host_id));
}
Expand Down Expand Up @@ -74,3 +76,5 @@ void AppCacheBackendProxy::GetResourceList(
int host_id, std::vector<appcache::AppCacheResourceInfo>* resource_infos) {
sender_->Send(new AppCacheHostMsg_GetResourceList(host_id, resource_infos));
}

} // namespace content
4 changes: 4 additions & 0 deletions content/common/appcache/appcache_backend_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include "ipc/ipc_sender.h"
#include "webkit/appcache/appcache_interfaces.h"

namespace content {

// Sends appcache related messages to the main process.
class AppCacheBackendProxy : public appcache::AppCacheBackend {
public:
Expand Down Expand Up @@ -45,4 +47,6 @@ class AppCacheBackendProxy : public appcache::AppCacheBackend {
IPC::Sender* sender_;
};

} // namespace content

#endif // CONTENT_COMMON_APPCACHE_APPCACHE_BACKEND_PROXY_H_
4 changes: 4 additions & 0 deletions content/common/appcache/appcache_dispatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include "content/common/appcache_messages.h"
#include "webkit/appcache/web_application_cache_host_impl.h"

namespace content {

bool AppCacheDispatcher::OnMessageReceived(const IPC::Message& msg) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(AppCacheDispatcher, msg)
Expand Down Expand Up @@ -59,3 +61,5 @@ void AppCacheDispatcher::OnContentBlocked(int host_id,
const GURL& manifest_url) {
frontend_impl_.OnContentBlocked(host_id, manifest_url);
}

} // namespace content
4 changes: 4 additions & 0 deletions content/common/appcache/appcache_dispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include "ipc/ipc_listener.h"
#include "webkit/appcache/appcache_frontend_impl.h"

namespace content {

// Dispatches appcache related messages sent to a child process from the
// main browser process. There is one instance per child process. Messages
// are dispatched on the main child thread. The ChildThread base class
Expand Down Expand Up @@ -44,4 +46,6 @@ class AppCacheDispatcher : public IPC::Listener {
appcache::AppCacheFrontendImpl frontend_impl_;
};

} // namespace content

#endif // CONTENT_COMMON_APPCACHE_APPCACHE_DISPATCHER_H_
4 changes: 4 additions & 0 deletions content/common/child_process.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
static void SigUSR1Handler(int signal) { }
#endif

namespace content {

ChildProcess* ChildProcess::child_process_;

ChildProcess::ChildProcess()
Expand Down Expand Up @@ -124,3 +126,5 @@ void ChildProcess::WaitForDebugger(const std::string& label) {
#endif // defined(OS_ANDROID)
#endif // defined(OS_POSIX)
}

} // namespace content
3 changes: 3 additions & 0 deletions content/common/child_process.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "base/synchronization/waitable_event.h"
#include "content/common/content_export.h"

namespace content {
class ChildThread;

// Base class for child processes of the browser process (i.e. renderer and
Expand Down Expand Up @@ -76,4 +77,6 @@ class CONTENT_EXPORT ChildProcess {
DISALLOW_COPY_AND_ASSIGN(ChildProcess);
};

} // namespace content

#endif // CONTENT_COMMON_CHILD_PROCESS_H_
10 changes: 6 additions & 4 deletions content/common/child_thread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
#include "content/common/handle_enumerator_win.h"
#endif

using content::ResourceDispatcher;
using tracked_objects::ThreadData;

namespace content {
namespace {

// How long to wait for a connection to the browser process before giving up.
Expand Down Expand Up @@ -111,7 +111,7 @@ void ChildThread::Init() {

sync_message_filter_ =
new IPC::SyncMessageFilter(ChildProcess::current()->GetShutDownEvent());
histogram_message_filter_ = new content::ChildHistogramMessageFilter();
histogram_message_filter_ = new ChildHistogramMessageFilter();

channel_->AddFilter(histogram_message_filter_.get());
channel_->AddFilter(sync_message_filter_.get());
Expand Down Expand Up @@ -306,8 +306,8 @@ void ChildThread::OnGetChildProfilerData(int sequence_number) {

void ChildThread::OnDumpHandles() {
#if defined(OS_WIN)
scoped_refptr<content::HandleEnumerator> handle_enum(
new content::HandleEnumerator(
scoped_refptr<HandleEnumerator> handle_enum(
new HandleEnumerator(
CommandLine::ForCurrentProcess()->HasSwitch(
switches::kAuditAllHandles)));
handle_enum->EnumerateHandles();
Expand Down Expand Up @@ -356,3 +356,5 @@ void ChildThread::EnsureConnected() {
LOG(INFO) << "ChildThread::EnsureConnected()";
base::KillProcess(base::GetCurrentProcessHandle(), 0, false);
}

} // namespace content
25 changes: 13 additions & 12 deletions content/common/child_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,7 @@
#include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED.
#include "webkit/glue/resource_loader_bridge.h"

class FileSystemDispatcher;
class MessageLoop;
class QuotaDispatcher;
class SocketStreamDispatcher;

namespace content {
class ChildHistogramMessageFilter;
class ResourceDispatcher;
}

namespace IPC {
class SyncChannel;
Expand All @@ -34,6 +26,13 @@ namespace WebKit {
class WebFrame;
}

namespace content {
class ChildHistogramMessageFilter;
class FileSystemDispatcher;
class QuotaDispatcher;
class ResourceDispatcher;
class SocketStreamDispatcher;

// The main thread of a child process derives from this class.
class CONTENT_EXPORT ChildThread : public IPC::Listener, public IPC::Sender {
public:
Expand Down Expand Up @@ -65,7 +64,7 @@ class CONTENT_EXPORT ChildThread : public IPC::Listener, public IPC::Sender {
// but on windows the child process directly allocates the block.
base::SharedMemory* AllocateSharedMemory(size_t buf_size);

content::ResourceDispatcher* resource_dispatcher();
ResourceDispatcher* resource_dispatcher();

SocketStreamDispatcher* socket_stream_dispatcher() {
return socket_stream_dispatcher_.get();
Expand All @@ -83,7 +82,7 @@ class CONTENT_EXPORT ChildThread : public IPC::Listener, public IPC::Sender {
// lifetime is less than the main thread.
IPC::SyncMessageFilter* sync_message_filter();

content::ChildHistogramMessageFilter* child_histogram_message_filter() const {
ChildHistogramMessageFilter* child_histogram_message_filter() const {
return histogram_message_filter_.get();
}

Expand Down Expand Up @@ -138,7 +137,7 @@ class CONTENT_EXPORT ChildThread : public IPC::Listener, public IPC::Sender {
MessageRouter router_;

// Handles resource loads for this process.
scoped_ptr<content::ResourceDispatcher> resource_dispatcher_;
scoped_ptr<ResourceDispatcher> resource_dispatcher_;

// Handles SocketStream for this process.
scoped_ptr<SocketStreamDispatcher> socket_stream_dispatcher_;
Expand All @@ -153,11 +152,13 @@ class CONTENT_EXPORT ChildThread : public IPC::Listener, public IPC::Sender {

scoped_ptr<QuotaDispatcher> quota_dispatcher_;

scoped_refptr<content::ChildHistogramMessageFilter> histogram_message_filter_;
scoped_refptr<ChildHistogramMessageFilter> histogram_message_filter_;

base::WeakPtrFactory<ChildThread> channel_connected_factory_;

DISALLOW_COPY_AND_ASSIGN(ChildThread);
};

} // namespace content

#endif // CONTENT_COMMON_CHILD_THREAD_H_
4 changes: 4 additions & 0 deletions content/common/child_trace_message_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

using base::debug::TraceLog;

namespace content {

ChildTraceMessageFilter::ChildTraceMessageFilter() : channel_(NULL) {}

void ChildTraceMessageFilter::OnFilterAdded(IPC::Channel* channel) {
Expand Down Expand Up @@ -103,3 +105,5 @@ void ChildTraceMessageFilter::OnTraceNotification(int notification) {

channel_->Send(new ChildProcessHostMsg_TraceNotification(notification));
}

} // namespace content
4 changes: 3 additions & 1 deletion content/common/child_trace_message_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include "base/process.h"
#include "ipc/ipc_channel_proxy.h"

namespace content {

// This class sends and receives trace messages on child processes.
class ChildTraceMessageFilter : public IPC::ChannelProxy::MessageFilter {
public:
Expand Down Expand Up @@ -44,6 +46,6 @@ class ChildTraceMessageFilter : public IPC::ChannelProxy::MessageFilter {
DISALLOW_COPY_AND_ASSIGN(ChildTraceMessageFilter);
};

} // namespace content

#endif // CONTENT_COMMON_CHILD_TRACE_MESSAGE_FILTER_H_

4 changes: 4 additions & 0 deletions content/common/database_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
using WebKit::WebKitPlatformSupport;
using WebKit::WebString;

namespace content {

WebKitPlatformSupport::FileHandle DatabaseUtil::DatabaseOpenFile(
const WebString& vfs_file_name, int desired_flags) {
IPC::PlatformFileForTransit file_handle =
Expand Down Expand Up @@ -60,3 +62,5 @@ long long DatabaseUtil::DatabaseGetSpaceAvailable(
filter->Send(new DatabaseHostMsg_GetSpaceAvailable(origin_identifier, &rv));
return rv;
}

} // namespace content
3 changes: 3 additions & 0 deletions content/common/database_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include "webkit/glue/webkitplatformsupport_impl.h"

namespace content {
// A class of utility functions used by RendererWebKitPlatformSupportImpl and
// WorkerWebKitPlatformSupportImpl to handle database file accesses.
class DatabaseUtil {
Expand All @@ -23,4 +24,6 @@ class DatabaseUtil {
const WebKit::WebString& origin_identifier);
};

} // namespace content

#endif // CONTENT_COMMON_DATABASE_UTIL_H_
4 changes: 4 additions & 0 deletions content/common/fileapi/file_system_dispatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include "content/common/child_thread.h"
#include "content/common/fileapi/file_system_messages.h"

namespace content {

FileSystemDispatcher::FileSystemDispatcher() {
}

Expand Down Expand Up @@ -329,3 +331,5 @@ void FileSystemDispatcher::OnDidOpenFile(
dispatcher->DidOpenFile(IPC::PlatformFileForTransitToPlatformFile(file));
dispatchers_.Remove(request_id);
}

} // namespace content
4 changes: 4 additions & 0 deletions content/common/fileapi/file_system_dispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ struct PlatformFileInfo;
class FilePath;
class GURL;

namespace content {

// Dispatches and sends file system related messages sent to/from a child
// process from/to the main browser process. There is one instance
// per child process. Messages are dispatched on the main child thread.
Expand Down Expand Up @@ -116,4 +118,6 @@ class FileSystemDispatcher : public IPC::Listener {
DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcher);
};

} // namespace content

#endif // CONTENT_COMMON_FILEAPI_FILE_SYSTEM_DISPATCHER_H_
Loading

0 comments on commit eb39819

Please sign in to comment.