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

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

Issue 21052007: aura: Clean up compositor initialization/destruction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanupcompositor: All work maybe? Created 7 years, 4 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 | Annotate | Revision Log
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"
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 return; 312 return;
313 PerCompositorData* data = it->second; 313 PerCompositorData* data = it->second;
314 DCHECK(data); 314 DCHECK(data);
315 GpuSurfaceTracker::Get()->RemoveSurface(data->surface_id); 315 GpuSurfaceTracker::Get()->RemoveSurface(data->surface_id);
316 delete data; 316 delete data;
317 per_compositor_data_.erase(it); 317 per_compositor_data_.erase(it);
318 if (per_compositor_data_.empty()) 318 if (per_compositor_data_.empty())
319 gl_helper_.reset(); 319 gl_helper_.reset();
320 } 320 }
321 321
322 bool GpuProcessTransportFactory::UsesTestContexts() { return false; }
323
322 ui::ContextFactory* GpuProcessTransportFactory::AsContextFactory() { 324 ui::ContextFactory* GpuProcessTransportFactory::AsContextFactory() {
323 return this; 325 return this;
324 } 326 }
325 327
326 gfx::GLSurfaceHandle GpuProcessTransportFactory::CreateSharedSurfaceHandle() { 328 gfx::GLSurfaceHandle GpuProcessTransportFactory::CreateSharedSurfaceHandle() {
327 CreateSharedContextLazy(); 329 CreateSharedContextLazy();
328 if (!shared_contexts_main_thread_ || 330 if (!shared_contexts_main_thread_ ||
329 !shared_contexts_main_thread_->Context3d()) 331 !shared_contexts_main_thread_->Context3d())
330 return gfx::GLSurfaceHandle(); 332 return gfx::GLSurfaceHandle();
331 gfx::GLSurfaceHandle handle = gfx::GLSurfaceHandle( 333 gfx::GLSurfaceHandle handle = gfx::GLSurfaceHandle(
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 } 400 }
399 401
400 scoped_refptr<cc::ContextProvider> 402 scoped_refptr<cc::ContextProvider>
401 GpuProcessTransportFactory::OffscreenContextProviderForMainThread() { 403 GpuProcessTransportFactory::OffscreenContextProviderForMainThread() {
402 if (!shared_contexts_main_thread_.get() || 404 if (!shared_contexts_main_thread_.get() ||
403 shared_contexts_main_thread_->DestroyedOnMainThread()) { 405 shared_contexts_main_thread_->DestroyedOnMainThread()) {
404 shared_contexts_main_thread_ = ContextProviderCommandBuffer::Create( 406 shared_contexts_main_thread_ = ContextProviderCommandBuffer::Create(
405 base::Bind(&GpuProcessTransportFactory:: 407 base::Bind(&GpuProcessTransportFactory::
406 CreateOffscreenCommandBufferContext, 408 CreateOffscreenCommandBufferContext,
407 base::Unretained(this))); 409 base::Unretained(this)));
408 shared_contexts_main_thread_->SetLostContextCallback(base::Bind( 410 if (shared_contexts_main_thread_) {
409 &GpuProcessTransportFactory:: 411 shared_contexts_main_thread_->SetLostContextCallback(base::Bind(
410 OnLostMainThreadSharedContextInsideCallback, 412 &GpuProcessTransportFactory::
411 callback_factory_.GetWeakPtr())); 413 OnLostMainThreadSharedContextInsideCallback,
414 callback_factory_.GetWeakPtr()));
412 415
413 if (shared_contexts_main_thread_.get() && 416 if (!shared_contexts_main_thread_->BindToCurrentThread())
414 !shared_contexts_main_thread_->BindToCurrentThread()) 417 shared_contexts_main_thread_ = NULL;
415 shared_contexts_main_thread_ = NULL; 418 }
416 } 419 }
417 return shared_contexts_main_thread_; 420 return shared_contexts_main_thread_;
418 } 421 }
419 422
420 scoped_refptr<cc::ContextProvider> 423 scoped_refptr<cc::ContextProvider>
421 GpuProcessTransportFactory::OffscreenContextProviderForCompositorThread() { 424 GpuProcessTransportFactory::OffscreenContextProviderForCompositorThread() {
422 if (!shared_contexts_compositor_thread_.get() || 425 if (!shared_contexts_compositor_thread_.get() ||
423 shared_contexts_compositor_thread_->DestroyedOnMainThread()) { 426 shared_contexts_compositor_thread_->DestroyedOnMainThread()) {
424 shared_contexts_compositor_thread_ = ContextProviderCommandBuffer::Create( 427 shared_contexts_compositor_thread_ = ContextProviderCommandBuffer::Create(
425 base::Bind(&GpuProcessTransportFactory:: 428 base::Bind(&GpuProcessTransportFactory::
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 shared_contexts_main_thread_ = NULL; 519 shared_contexts_main_thread_ = NULL;
517 520
518 scoped_ptr<GLHelper> old_helper(gl_helper_.release()); 521 scoped_ptr<GLHelper> old_helper(gl_helper_.release());
519 522
520 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, 523 FOR_EACH_OBSERVER(ImageTransportFactoryObserver,
521 observer_list_, 524 observer_list_,
522 OnLostResources()); 525 OnLostResources());
523 } 526 }
524 527
525 } // namespace content 528 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698