summaryrefslogtreecommitdiff
path: root/chromium/plat_support
diff options
context:
space:
mode:
authorBo Liu <boliu@google.com>2014-08-05 15:17:04 -0700
committerBo Liu <boliu@google.com>2014-08-06 08:32:20 -0700
commit4cb347aeb733d199418472de549c24a31d3e7477 (patch)
treeb18897af854a0f8489d4ead9cc6b874d7ade1551 /chromium/plat_support
parentcbaa791850e8a0f9a8a1cfc9c88aaecbd580d3ec (diff)
downloadwebview-4cb347aeb733d199418472de549c24a31d3e7477.tar.gz
Change function table assignment to allow new fields
Write the function table assignment statements to allow new fields to be added without modifying code here. Had to make the static structs non-const. Change-Id: I10d38caa9817f3835c4cf0e6e9418998a5452d10
Diffstat (limited to 'chromium/plat_support')
-rw-r--r--chromium/plat_support/graphics_utils.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/chromium/plat_support/graphics_utils.cpp b/chromium/plat_support/graphics_utils.cpp
index 8845111..866f0fe 100644
--- a/chromium/plat_support/graphics_utils.cpp
+++ b/chromium/plat_support/graphics_utils.cpp
@@ -82,22 +82,20 @@ void ReleasePixels(AwPixelInfo* pixels) {
}
jlong GetDrawSWFunctionTable(JNIEnv* env, jclass) {
- static const AwDrawSWFunctionTable function_table = {
- &GetPixels,
- &ReleasePixels,
- };
+ static AwDrawSWFunctionTable function_table;
+ function_table.access_pixels = &GetPixels;
+ function_table.release_pixels = &ReleasePixels;
return reinterpret_cast<intptr_t>(&function_table);
}
jlong GetDrawGLFunctionTable(JNIEnv* env, jclass) {
- static const AwDrawGLFunctionTable function_table = {
- &GraphicBufferImpl::Create,
- &GraphicBufferImpl::Release,
- &GraphicBufferImpl::MapStatic,
- &GraphicBufferImpl::UnmapStatic,
- &GraphicBufferImpl::GetNativeBufferStatic,
- &GraphicBufferImpl::GetStrideStatic,
- };
+ static AwDrawGLFunctionTable function_table;
+ function_table.create_graphic_buffer = &GraphicBufferImpl::Create;
+ function_table.release_graphic_buffer = &GraphicBufferImpl::Release;
+ function_table.map = &GraphicBufferImpl::MapStatic;
+ function_table.unmap = &GraphicBufferImpl::UnmapStatic;
+ function_table.get_native_buffer = &GraphicBufferImpl::GetNativeBufferStatic;
+ function_table.get_stride = &GraphicBufferImpl::GetStrideStatic;
return reinterpret_cast<intptr_t>(&function_table);
}