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

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

Issue 1139903005: Add PERSISTENT_MAP usage for GpuMemoryBuffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: persistentmap: fixmandolinebetter Created 5 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/compositor/gpu_process_transport_factory.h" 5 #include "content/browser/compositor/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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 ImageTransportFactoryObserver, observer_list_, OnLostResources()); 394 ImageTransportFactoryObserver, observer_list_, OnLostResources());
395 395
396 helper.reset(); 396 helper.reset();
397 DCHECK(!gl_helper_) << "Destroying the GLHelper should not cause a new " 397 DCHECK(!gl_helper_) << "Destroying the GLHelper should not cause a new "
398 "GLHelper to be created."; 398 "GLHelper to be created.";
399 } 399 }
400 } 400 }
401 401
402 bool GpuProcessTransportFactory::DoesCreateTestContexts() { return false; } 402 bool GpuProcessTransportFactory::DoesCreateTestContexts() { return false; }
403 403
404 uint32 GpuProcessTransportFactory::GetImageTextureTarget() { 404 uint32 GpuProcessTransportFactory::GetMapImageTextureTarget() {
405 return BrowserGpuChannelHostFactory::GetImageTextureTarget(); 405 // TODO(reveman): We currently assume that the compositor will use BGRA_8888
406 // if it's able to, and RGBA_8888 otherwise. Since we don't know what it will
407 // use we hardcode BGRA_8888 here for now. We should instead move decisions
408 // about GpuMemoryBuffer format to the browser embedder so we know it here,
409 // and pass that decision to the compositor.
410 gfx::GpuMemoryBuffer::Format format = gfx::GpuMemoryBuffer::BGRA_8888;
411 return BrowserGpuChannelHostFactory::GetImageTextureTarget(
412 format, gfx::GpuMemoryBuffer::MAP);
413 }
414
415 uint32 GpuProcessTransportFactory::GetPersistentMapImageTextureTarget() {
416 // TODO(reveman): We currently assume that the compositor will use BGRA_8888
417 // if it's able to, and RGBA_8888 otherwise. Since we don't know what it will
418 // use we hardcode BGRA_8888 here for now. We should instead move decisions
419 // about GpuMemoryBuffer format to the browser embedder so we know it here,
420 // and pass that decision to the compositor.
421 gfx::GpuMemoryBuffer::Format format = gfx::GpuMemoryBuffer::BGRA_8888;
422 return BrowserGpuChannelHostFactory::GetImageTextureTarget(
423 format, gfx::GpuMemoryBuffer::PERSISTENT_MAP);
406 } 424 }
407 425
408 cc::SharedBitmapManager* GpuProcessTransportFactory::GetSharedBitmapManager() { 426 cc::SharedBitmapManager* GpuProcessTransportFactory::GetSharedBitmapManager() {
409 return HostSharedBitmapManager::current(); 427 return HostSharedBitmapManager::current();
410 } 428 }
411 429
412 gpu::GpuMemoryBufferManager* 430 gpu::GpuMemoryBufferManager*
413 GpuProcessTransportFactory::GetGpuMemoryBufferManager() { 431 GpuProcessTransportFactory::GetGpuMemoryBufferManager() {
414 return BrowserGpuMemoryBufferManager::current(); 432 return BrowserGpuMemoryBufferManager::current();
415 } 433 }
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, 621 FOR_EACH_OBSERVER(ImageTransportFactoryObserver,
604 observer_list_, 622 observer_list_,
605 OnLostResources()); 623 OnLostResources());
606 624
607 // Kill things that use the shared context before killing the shared context. 625 // Kill things that use the shared context before killing the shared context.
608 lost_gl_helper.reset(); 626 lost_gl_helper.reset();
609 lost_shared_main_thread_contexts = NULL; 627 lost_shared_main_thread_contexts = NULL;
610 } 628 }
611 629
612 } // namespace content 630 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698