#include "content/browser/gpu/gpu_surface_tracker.h"
#include "content/browser/renderer_host/render_widget_helper.h"
#include "content/common/gpu/gpu_messages.h"
-#include "content/port/browser/render_widget_host_view_frame_subscriber.h"
+#include "content/public/browser/render_widget_host_view_frame_subscriber.h"
#include "content/public/common/content_switches.h"
#include "gpu/command_buffer/service/gpu_switches.h"
: BrowserMessageFilter(GpuMsgStart),
gpu_process_id_(0),
render_process_id_(render_process_id),
- share_contexts_(false),
render_widget_helper_(render_widget_helper),
weak_ptr_factory_(this) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
-#if defined(USE_AURA) || defined(OS_ANDROID)
- // We use the GPU process for UI on Aura, and we need to share renderer GL
- // contexts with the compositor context.
- share_contexts_ = true;
-#else
- // Share contexts when compositing webview plugin or using share groups
- // for asynchronous texture uploads.
- if (!CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kDisableBrowserPluginCompositing) ||
- CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableShareGroupAsyncTextureUpload))
- share_contexts_ = true;
-#endif
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
}
GpuMessageFilter::~GpuMessageFilter() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
EndAllFrameSubscriptions();
}
void GpuMessageFilter::BeginFrameSubscription(
int route_id,
scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
linked_ptr<FrameSubscription> subscription(
new FrameSubscription(route_id, subscriber.Pass()));
BeginFrameSubscriptionInternal(subscription);
}
void GpuMessageFilter::EndFrameSubscription(int route_id) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
FrameSubscriptionList frame_subscription_list;
frame_subscription_list.swap(frame_subscription_list_);
for (FrameSubscriptionList::iterator it = frame_subscription_list.begin();
void GpuMessageFilter::OnEstablishGpuChannel(
CauseForGpuLaunch cause_for_gpu_launch,
IPC::Message* reply_ptr) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
scoped_ptr<IPC::Message> reply(reply_ptr);
// TODO(apatrick): Eventually, this will return the route ID of a
BeginAllFrameSubscriptions();
}
+ bool share_contexts = true;
host->EstablishGpuChannel(
render_process_id_,
- share_contexts_,
+ share_contexts,
base::Bind(&GpuMessageFilter::EstablishChannelCallback,
weak_ptr_factory_.GetWeakPtr(),
base::Passed(&reply)));
void GpuMessageFilter::OnCreateViewCommandBuffer(
int32 surface_id,
const GPUCreateCommandBufferConfig& init_params,
+ int32 route_id,
IPC::Message* reply_ptr) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
scoped_ptr<IPC::Message> reply(reply_ptr);
GpuSurfaceTracker* surface_tracker = GpuSurfaceTracker::Get();
surface_id,
render_process_id_,
init_params,
+ route_id,
base::Bind(&GpuMessageFilter::CreateCommandBufferCallback,
weak_ptr_factory_.GetWeakPtr(),
base::Passed(&reply)));
scoped_ptr<IPC::Message> reply,
const IPC::ChannelHandle& channel,
const gpu::GPUInfo& gpu_info) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
GpuHostMsg_EstablishGpuChannel::WriteReplyParams(
reply.get(), render_process_id_, channel, gpu_info);
}
void GpuMessageFilter::CreateCommandBufferCallback(
- scoped_ptr<IPC::Message> reply, int32 route_id) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- GpuHostMsg_CreateViewCommandBuffer::WriteReplyParams(reply.get(), route_id);
+ scoped_ptr<IPC::Message> reply, bool succeeded) {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ GpuHostMsg_CreateViewCommandBuffer::WriteReplyParams(reply.get(), succeeded);
Send(reply.release());
}