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

Side by Side Diff: runtime/embedders/android/android_extension.cc

Issue 11467028: Migrate files to embedder. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review fixes Created 7 years, 11 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
« no previous file with comments | « runtime/embedders/android/android_extension.h ('k') | runtime/embedders/android/context.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "jni/android_extension.h" 5 #include "embedders/android/android_extension.h"
6 6
7 #include <android/log.h> 7 #include <android/log.h>
8 #include <EGL/egl.h> 8 #include <EGL/egl.h>
9 #include <GLES2/gl2.h> 9 #include <GLES2/gl2.h>
10 #include <GLES2/gl2ext.h> 10 #include <GLES2/gl2ext.h>
11 #include <jni.h> 11 #include <jni.h>
12 #include <stdio.h> 12 #include <stdio.h>
13 #include <stdlib.h> 13 #include <stdlib.h>
14 #include <string.h> 14 #include <string.h>
15 15
16 #include "include/dart_api.h" 16 #include "include/dart_api.h"
17 #include "jni/log.h" 17 #include "embedders/android/log.h"
18 18
19 Dart_Handle HandleError(Dart_Handle handle) { 19 Dart_Handle HandleError(Dart_Handle handle) {
20 if (Dart_IsError(handle)) Dart_PropagateError(handle); 20 if (Dart_IsError(handle)) Dart_PropagateError(handle);
21 return handle; 21 return handle;
22 } 22 }
23 23
24 void CheckGLError(const char *function) { 24 void CheckGLError(const char *function) {
25 int error = glGetError(); 25 int error = glGetError();
26 if (error != GL_NO_ERROR) { 26 if (error != GL_NO_ERROR) {
27 LOGE("ERROR!: %s returns %d", function, error); 27 LOGE("ERROR!: %s returns %d", function, error);
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 HandleError(Dart_IntegerToInt64(yHandle, &y)); 856 HandleError(Dart_IntegerToInt64(yHandle, &y));
857 857
858 Dart_Handle widthHandle = HandleError(Dart_GetNativeArgument(arguments, 2)); 858 Dart_Handle widthHandle = HandleError(Dart_GetNativeArgument(arguments, 2));
859 int64_t width; 859 int64_t width;
860 HandleError(Dart_IntegerToInt64(widthHandle, &width)); 860 HandleError(Dart_IntegerToInt64(widthHandle, &width));
861 861
862 Dart_Handle heightHandle = HandleError(Dart_GetNativeArgument(arguments, 3)); 862 Dart_Handle heightHandle = HandleError(Dart_GetNativeArgument(arguments, 3));
863 int64_t height; 863 int64_t height;
864 HandleError(Dart_IntegerToInt64(heightHandle, &height)); 864 HandleError(Dart_IntegerToInt64(heightHandle, &height));
865 865
866 LOGI("Dimensions: [%ld, %ld, %ld, %ld]", x, y, width, height); 866 LOGI("Dimensions: [%d, %d, %d, %d]",
867 static_cast<int>(x),
868 static_cast<int>(y),
869 static_cast<int>(width),
870 static_cast<int>(height));
867 871
868 glViewport(x, y, width, height); 872 glViewport(x, y, width, height);
869 CheckGLError("glViewPort"); 873 CheckGLError("glViewPort");
870 Dart_ExitScope(); 874 Dart_ExitScope();
871 } 875 }
872 876
873 void GLVertexAttribPointer(Dart_NativeArguments arguments) { 877 void GLVertexAttribPointer(Dart_NativeArguments arguments) {
874 LOGI("GLVertexAttribPointer"); 878 LOGI("GLVertexAttribPointer");
875 Dart_EnterScope(); 879 Dart_EnterScope();
876 880
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 HandleError(Dart_StringToCString(name, &cname)); 1196 HandleError(Dart_StringToCString(name, &cname));
1193 for (int i = 0; function_list[i].name != NULL; ++i) { 1197 for (int i = 0; function_list[i].name != NULL; ++i) {
1194 if (strcmp(function_list[i].name, cname) == 0) { 1198 if (strcmp(function_list[i].name, cname) == 0) {
1195 result = function_list[i].function; 1199 result = function_list[i].function;
1196 break; 1200 break;
1197 } 1201 }
1198 } 1202 }
1199 Dart_ExitScope(); 1203 Dart_ExitScope();
1200 return result; 1204 return result;
1201 } 1205 }
OLDNEW
« no previous file with comments | « runtime/embedders/android/android_extension.h ('k') | runtime/embedders/android/context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698