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

Side by Side Diff: android_webview/browser/gpu_memory_buffer_factory_impl.cc

Issue 255713008: Change glimage to accept a type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "android_webview/browser/gpu_memory_buffer_factory_impl.h" 5 #include "android_webview/browser/gpu_memory_buffer_factory_impl.h"
6 6
7 #include "android_webview/public/browser/draw_gl.h" 7 #include "android_webview/public/browser/draw_gl.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "ui/gfx/gpu_memory_buffer.h" 9 #include "ui/gfx/gpu_memory_buffer.h"
10 #include "ui/gfx/size.h" 10 #include "ui/gfx/size.h"
(...skipping 13 matching lines...) Expand all
24 size_(size), 24 size_(size),
25 mapped_(false) { 25 mapped_(false) {
26 DCHECK(buffer_id_); 26 DCHECK(buffer_id_);
27 } 27 }
28 28
29 virtual ~GpuMemoryBufferImpl() { 29 virtual ~GpuMemoryBufferImpl() {
30 g_gl_draw_functions->release_graphic_buffer(buffer_id_); 30 g_gl_draw_functions->release_graphic_buffer(buffer_id_);
31 } 31 }
32 32
33 // Overridden from gfx::GpuMemoryBuffer: 33 // Overridden from gfx::GpuMemoryBuffer:
34 virtual void* Map(gfx::GpuMemoryBuffer::AccessMode mode) OVERRIDE { 34 virtual void* Map() OVERRIDE {
35 AwMapMode map_mode = MAP_READ_ONLY;
36 switch (mode) {
37 case GpuMemoryBuffer::READ_ONLY:
38 map_mode = MAP_READ_ONLY;
39 break;
40 case GpuMemoryBuffer::WRITE_ONLY:
41 map_mode = MAP_WRITE_ONLY;
42 break;
43 case GpuMemoryBuffer::READ_WRITE:
44 map_mode = MAP_READ_WRITE;
45 break;
46 default:
47 LOG(DFATAL) << "Unknown map mode: " << mode;
48 }
49 void* vaddr = NULL; 35 void* vaddr = NULL;
50 int err = g_gl_draw_functions->map(buffer_id_, map_mode, &vaddr); 36 int err = g_gl_draw_functions->map(buffer_id_, MAP_READ_WRITE, &vaddr);
alexst (slow to review) 2014/05/01 17:45:07 This seems to be mapped into the function ptr tabl
reveman 2014/05/01 18:07:33 Yes. FYI, we're planning to move this GpuMemoryBuf
51 DCHECK(!err); 37 DCHECK(!err);
52 mapped_ = true; 38 mapped_ = true;
53 return vaddr; 39 return vaddr;
54 } 40 }
55 virtual void Unmap() OVERRIDE { 41 virtual void Unmap() OVERRIDE {
56 int err = g_gl_draw_functions->unmap(buffer_id_); 42 int err = g_gl_draw_functions->unmap(buffer_id_);
57 DCHECK(!err); 43 DCHECK(!err);
58 mapped_ = false; 44 mapped_ = false;
59 } 45 }
60 virtual bool IsMapped() const OVERRIDE { return mapped_; } 46 virtual bool IsMapped() const OVERRIDE { return mapped_; }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 return new GpuMemoryBufferImpl(buffer_id, gfx::Size(width, height)); 85 return new GpuMemoryBufferImpl(buffer_id, gfx::Size(width, height));
100 } 86 }
101 87
102 // static 88 // static
103 void GpuMemoryBufferFactoryImpl::SetAwDrawGLFunctionTable( 89 void GpuMemoryBufferFactoryImpl::SetAwDrawGLFunctionTable(
104 AwDrawGLFunctionTable* table) { 90 AwDrawGLFunctionTable* table) {
105 g_gl_draw_functions = table; 91 g_gl_draw_functions = table;
106 } 92 }
107 93
108 } // namespace android_webview 94 } // namespace android_webview
OLDNEW
« no previous file with comments | « no previous file | cc/resources/raster_worker_pool_perftest.cc » ('j') | content/common/gpu/client/gpu_memory_buffer_impl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698