 Chromium Code Reviews
 Chromium Code Reviews Issue 23130004:
  Enforce a memory limit on MappedMemoryManager  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 23130004:
  Enforce a memory limit on MappedMemoryManager  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| Index: gpu/command_buffer/client/gles2_implementation.cc | 
| diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc | 
| index 9285b6d82ef1721de747ec98f02f3bc47acedf21..3987a2e83f659bcbefbfb4bdda046c1b8f3c6940 100644 | 
| --- a/gpu/command_buffer/client/gles2_implementation.cc | 
| +++ b/gpu/command_buffer/client/gles2_implementation.cc | 
| @@ -24,6 +24,11 @@ | 
| #include "gpu/command_buffer/client/vertex_array_object_manager.h" | 
| #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 
| #include "gpu/command_buffer/common/trace_event.h" | 
| + | 
| +#if defined(OS_ANDROID) | 
| +#include "ui/gfx/android/device_display_info.h" | 
| +#endif | 
| + | 
| #include "ui/gfx/gpu_memory_buffer.h" | 
| #if defined(__native_client__) && !defined(GLES2_SUPPORT_CLIENT_SIDE_ARRAYS) | 
| @@ -148,8 +153,20 @@ bool GLES2Implementation::Initialize( | 
| return false; | 
| } | 
| +#if defined(OS_ANDROID) | 
| 
no sievers
2013/08/15 01:07:15
there is an ifdef android in a different place now
 
kaanb
2013/08/15 01:21:05
If we need to base this on the screen size of the
 
piman
2013/08/15 02:49:03
Agreed with Daniel, please inject this value inste
 
kaanb
2013/08/16 22:50:44
Done.
 | 
| + static const size_t kBytesPerPixel = 4; | 
| + gfx::DeviceDisplayInfo display_info; | 
| + size_t full_screen_texture_size_in_bytes = | 
| + display_info.GetDisplayHeight() * | 
| + display_info.GetDisplayWidth() * | 
| + kBytesPerPixel; | 
| + mapped_memory_.reset( | 
| + new MappedMemoryManager(helper_, | 
| + 2 * full_screen_texture_size_in_bytes)); | 
| +#else | 
| mapped_memory_.reset(new MappedMemoryManager(helper_)); | 
| - SetSharedMemoryChunkSizeMultiple(1024 * 1024 * 2); | 
| +#endif | 
| + mapped_memory_->set_chunk_size_multiple(2 * 1024 * 1024); | 
| if (!QueryAndCacheStaticState()) | 
| return false; | 
| @@ -289,11 +306,6 @@ uint32 GLES2Implementation::GetResultShmOffset() { | 
| return transfer_buffer_->GetResultOffset(); | 
| } | 
| -void GLES2Implementation::SetSharedMemoryChunkSizeMultiple( | 
| - unsigned int multiple) { | 
| - mapped_memory_->set_chunk_size_multiple(multiple); | 
| -} | 
| - | 
| void GLES2Implementation::FreeUnusedSharedMemory() { | 
| mapped_memory_->FreeUnused(); | 
| } |