Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(437)

Side by Side Diff: content/browser/aura/gpu_process_transport_factory.cc

Issue 23726015: All together now (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@screencast_cap
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/aura/gpu_process_transport_factory.h" 5 #include "content/browser/aura/gpu_process_transport_factory.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "cc/output/compositor_frame.h" 13 #include "cc/output/compositor_frame.h"
14 #include "cc/output/output_surface.h" 14 #include "cc/output/output_surface.h"
15 #include "content/browser/aura/browser_compositor_output_surface.h" 15 #include "content/browser/aura/browser_compositor_output_surface.h"
16 #include "content/browser/aura/browser_compositor_output_surface_capturer.h"
16 #include "content/browser/aura/browser_compositor_output_surface_proxy.h" 17 #include "content/browser/aura/browser_compositor_output_surface_proxy.h"
17 #include "content/browser/aura/reflector_impl.h" 18 #include "content/browser/aura/reflector_impl.h"
18 #include "content/browser/aura/software_browser_compositor_output_surface.h" 19 #include "content/browser/aura/software_browser_compositor_output_surface.h"
19 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" 20 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
20 #include "content/browser/gpu/gpu_data_manager_impl.h" 21 #include "content/browser/gpu/gpu_data_manager_impl.h"
21 #include "content/browser/gpu/gpu_surface_tracker.h" 22 #include "content/browser/gpu/gpu_surface_tracker.h"
22 #include "content/browser/renderer_host/render_widget_host_impl.h" 23 #include "content/browser/renderer_host/render_widget_host_impl.h"
23 #include "content/common/gpu/client/context_provider_command_buffer.h" 24 #include "content/common/gpu/client/context_provider_command_buffer.h"
24 #include "content/common/gpu/client/gl_helper.h" 25 #include "content/common/gpu/client/gl_helper.h"
25 #include "content/common/gpu/client/gpu_channel_host.h" 26 #include "content/common/gpu/client/gpu_channel_host.h"
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 ui::Compositor::GetCompositorMessageLoop(); 245 ui::Compositor::GetCompositorMessageLoop();
245 if (!compositor_thread_task_runner.get()) 246 if (!compositor_thread_task_runner.get())
246 compositor_thread_task_runner = base::MessageLoopProxy::current(); 247 compositor_thread_task_runner = base::MessageLoopProxy::current();
247 248
248 // Here we know the GpuProcessHost has been set up, because we created a 249 // Here we know the GpuProcessHost has been set up, because we created a
249 // context. 250 // context.
250 output_surface_proxy_->ConnectToGpuProcessHost( 251 output_surface_proxy_->ConnectToGpuProcessHost(
251 compositor_thread_task_runner.get()); 252 compositor_thread_task_runner.get());
252 253
253 scoped_ptr<BrowserCompositorOutputSurface> surface( 254 scoped_ptr<BrowserCompositorOutputSurface> surface(
254 new BrowserCompositorOutputSurface( 255 new BrowserCompositorOutputSurface(context_provider,
255 context_provider, 256 data->surface_id,
256 per_compositor_data_[compositor]->surface_id, 257 &output_surface_map_,
257 &output_surface_map_, 258 base::MessageLoopProxy::current(),
258 base::MessageLoopProxy::current().get(), 259 compositor->AsWeakPtr()));
259 compositor->AsWeakPtr()));
260 if (data->reflector.get()) { 260 if (data->reflector.get()) {
261 data->reflector->CreateSharedTexture(); 261 data->reflector->CreateSharedTexture();
262 data->reflector->AttachToOutputSurface(surface.get()); 262 data->reflector->AttachToOutputSurface(surface.get());
263 } 263 }
264 264
265 return surface.PassAs<cc::OutputSurface>(); 265 return surface.PassAs<cc::OutputSurface>();
266 } 266 }
267 267
268 scoped_refptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( 268 scoped_refptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector(
269 ui::Compositor* source, 269 ui::Compositor* source,
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 if (!shared_contexts_main_thread_.get()) 346 if (!shared_contexts_main_thread_.get())
347 return NULL; 347 return NULL;
348 scoped_refptr<OwnedTexture> image(new OwnedTexture( 348 scoped_refptr<OwnedTexture> image(new OwnedTexture(
349 shared_contexts_main_thread_->Context3d(), 349 shared_contexts_main_thread_->Context3d(),
350 size, 350 size,
351 device_scale_factor, 351 device_scale_factor,
352 texture_id)); 352 texture_id));
353 return image; 353 return image;
354 } 354 }
355 355
356 scoped_ptr<SurfaceCapturer>
357 GpuProcessTransportFactory::CreateOutputSurfaceCapturer(
358 ui::Compositor* compositor,
359 SurfaceCapturer::Client* client) {
360 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor);
361 if (it == per_compositor_data_.end())
362 return scoped_ptr<SurfaceCapturer>();
363 PerCompositorData* data = it->second;
364 DCHECK(data);
365 return scoped_ptr<SurfaceCapturer>(new BrowserCompositorOutputSurfaceCapturer(
366 &output_surface_map_, data->surface_id, client));
367 }
368
356 GLHelper* GpuProcessTransportFactory::GetGLHelper() { 369 GLHelper* GpuProcessTransportFactory::GetGLHelper() {
357 if (!gl_helper_) { 370 if (!gl_helper_) {
358 CreateSharedContextLazy(); 371 CreateSharedContextLazy();
359 WebGraphicsContext3DCommandBufferImpl* context_for_main_thread = 372 WebGraphicsContext3DCommandBufferImpl* context_for_main_thread =
360 shared_contexts_main_thread_->Context3d(); 373 shared_contexts_main_thread_->Context3d();
361 gl_helper_.reset(new GLHelper(context_for_main_thread)); 374 gl_helper_.reset(new GLHelper(context_for_main_thread));
362 } 375 }
363 return gl_helper_.get(); 376 return gl_helper_.get();
364 } 377 }
365 378
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 observer_list_, 530 observer_list_,
518 OnLostResources()); 531 OnLostResources());
519 532
520 // Kill things that use the shared context before killing the shared context. 533 // Kill things that use the shared context before killing the shared context.
521 lost_gl_helper.reset(); 534 lost_gl_helper.reset();
522 lost_shared_contexts_main_thread = NULL; 535 lost_shared_contexts_main_thread = NULL;
523 lost_shared_contexts_compositor_thread = NULL; 536 lost_shared_contexts_compositor_thread = NULL;
524 } 537 }
525 538
526 } // namespace content 539 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/aura/gpu_process_transport_factory.h ('k') | content/browser/aura/image_transport_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698