OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/renderer_host/image_transport_factory.h" | 5 #include "content/browser/renderer_host/image_transport_factory.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 } | 248 } |
249 | 249 |
250 void AddSurface(BrowserCompositorOutputSurface* surface, int surface_id) { | 250 void AddSurface(BrowserCompositorOutputSurface* surface, int surface_id) { |
251 if (!message_handler_set_) { | 251 if (!message_handler_set_) { |
252 uint32 messages_to_filter[] = {GpuHostMsg_UpdateVSyncParameters::ID}; | 252 uint32 messages_to_filter[] = {GpuHostMsg_UpdateVSyncParameters::ID}; |
253 BrowserGpuChannelHostFactory::instance()->SetHandlerForControlMessages( | 253 BrowserGpuChannelHostFactory::instance()->SetHandlerForControlMessages( |
254 messages_to_filter, | 254 messages_to_filter, |
255 arraysize(messages_to_filter), | 255 arraysize(messages_to_filter), |
256 base::Bind(&BrowserCompositorOutputSurfaceProxy::OnMessageReceived, | 256 base::Bind(&BrowserCompositorOutputSurfaceProxy::OnMessageReceived, |
257 this), | 257 this), |
258 base::MessageLoop::current()->message_loop_proxy()); | 258 base::MessageLoop::current()->message_loop_proxy().get()); |
259 message_handler_set_ = true; | 259 message_handler_set_ = true; |
260 } | 260 } |
261 surface_map_.AddWithID(surface, surface_id); | 261 surface_map_.AddWithID(surface, surface_id); |
262 } | 262 } |
263 | 263 |
264 BrowserCompositorOutputSurface* GetOutputSurface(int surface_id) { | 264 BrowserCompositorOutputSurface* GetOutputSurface(int surface_id) { |
265 return surface_map_.Lookup(surface_id); | 265 return surface_map_.Lookup(surface_id); |
266 } | 266 } |
267 | 267 |
268 void RemoveSurface(int surface_id) { | 268 void RemoveSurface(int surface_id) { |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 PerCompositorData* data = per_compositor_data_[compositor]; | 636 PerCompositorData* data = per_compositor_data_[compositor]; |
637 if (!data) | 637 if (!data) |
638 data = CreatePerCompositorData(compositor); | 638 data = CreatePerCompositorData(compositor); |
639 BrowserCompositorOutputSurface* surface = | 639 BrowserCompositorOutputSurface* surface = |
640 new BrowserCompositorOutputSurface( | 640 new BrowserCompositorOutputSurface( |
641 CreateContextCommon(data->swap_client->AsWeakPtr(), | 641 CreateContextCommon(data->swap_client->AsWeakPtr(), |
642 data->surface_id) | 642 data->surface_id) |
643 .PassAs<WebKit::WebGraphicsContext3D>(), | 643 .PassAs<WebKit::WebGraphicsContext3D>(), |
644 per_compositor_data_[compositor]->surface_id, | 644 per_compositor_data_[compositor]->surface_id, |
645 output_surface_proxy_.get(), | 645 output_surface_proxy_.get(), |
646 base::MessageLoopProxy::current(), | 646 base::MessageLoopProxy::current().get(), |
647 compositor->AsWeakPtr()); | 647 compositor->AsWeakPtr()); |
648 if (data->reflector.get()) { | 648 if (data->reflector.get()) { |
649 data->reflector->CreateSharedTexture(); | 649 data->reflector->CreateSharedTexture(); |
650 data->reflector->AttachToOutputSurface(surface); | 650 data->reflector->AttachToOutputSurface(surface); |
651 } | 651 } |
652 return surface; | 652 return surface; |
653 } | 653 } |
654 | 654 |
655 virtual scoped_refptr<ui::Reflector> CreateReflector( | 655 virtual scoped_refptr<ui::Reflector> CreateReflector( |
656 ui::Compositor* source, | 656 ui::Compositor* source, |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1062 delete g_factory; | 1062 delete g_factory; |
1063 g_factory = NULL; | 1063 g_factory = NULL; |
1064 } | 1064 } |
1065 | 1065 |
1066 // static | 1066 // static |
1067 ImageTransportFactory* ImageTransportFactory::GetInstance() { | 1067 ImageTransportFactory* ImageTransportFactory::GetInstance() { |
1068 return g_factory; | 1068 return g_factory; |
1069 } | 1069 } |
1070 | 1070 |
1071 } // namespace content | 1071 } // namespace content |
OLD | NEW |