summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrockot <rockot@chromium.org>2015-08-27 11:25:04 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-27 18:25:55 +0000
commitde5a1527e03e89df37c318582075171d55681424 (patch)
treeb4f1bb9d230083d3a89b90dde2b0b35b51cbfd65
parent30327bc319a006e6c89a7b3cdf1fef86f05ec692 (diff)
downloadchromium_src-de5a1527e03e89df37c318582075171d55681424.zip
chromium_src-de5a1527e03e89df37c318582075171d55681424.tar.gz
chromium_src-de5a1527e03e89df37c318582075171d55681424.tar.bz2
Update mojo sdk to rev cbf8d2ee9b7d07c7751d8d861f3b7e2bd9829b05
BUG=None TBR=ben@chromium.org Review URL: https://codereview.chromium.org/1309323002 Cr-Commit-Position: refs/heads/master@{#345927}
-rw-r--r--mojo/application/public/cpp/lib/application_impl.cc13
-rw-r--r--mojo/cc/BUILD.gn1
-rw-r--r--mojo/cc/context_provider_mojo.cc5
-rw-r--r--mojo/gles2/BUILD.gn17
-rw-r--r--mojo/shell/capability_filter.h27
-rw-r--r--third_party/mojo/mojo_public.gyp1
-rw-r--r--third_party/mojo/mojom_bindings_generator_variables.gypi2
-rw-r--r--third_party/mojo/src/mojo/edk/system/BUILD.gn1
-rw-r--r--third_party/mojo/src/mojo/edk/system/channel_endpoint.cc40
-rw-r--r--third_party/mojo/src/mojo/edk/system/channel_endpoint.h29
-rw-r--r--third_party/mojo/src/mojo/edk/system/channel_manager.cc14
-rw-r--r--third_party/mojo/src/mojo/edk/system/channel_manager.h13
-rw-r--r--third_party/mojo/src/mojo/edk/system/channel_manager_unittest.cc3
-rw-r--r--third_party/mojo/src/mojo/edk/system/connection_manager.h6
-rw-r--r--third_party/mojo/src/mojo/edk/system/connection_manager_messages.h30
-rw-r--r--third_party/mojo/src/mojo/edk/system/connection_manager_unittest.cc128
-rw-r--r--third_party/mojo/src/mojo/edk/system/ipc_support.cc8
-rw-r--r--third_party/mojo/src/mojo/edk/system/ipc_support_unittest.cc417
-rw-r--r--third_party/mojo/src/mojo/edk/system/master_connection_manager.cc276
-rw-r--r--third_party/mojo/src/mojo/edk/system/master_connection_manager.h32
-rw-r--r--third_party/mojo/src/mojo/edk/system/message_in_transit.h6
-rw-r--r--third_party/mojo/src/mojo/edk/system/remote_producer_data_pipe_impl.cc15
-rw-r--r--third_party/mojo/src/mojo/edk/system/slave_connection_manager.cc36
-rw-r--r--third_party/mojo/src/mojo/edk/system/slave_connection_manager.h3
-rw-r--r--third_party/mojo/src/mojo/public/VERSION2
-rw-r--r--third_party/mojo/src/mojo/public/c/gles2/BUILD.gn7
-rw-r--r--third_party/mojo/src/mojo/public/c/gles2/chromium_bind_uniform_location.h30
-rw-r--r--third_party/mojo/src/mojo/public/c/gles2/chromium_resize.h29
-rw-r--r--third_party/mojo/src/mojo/public/c/gles2/ext_debug_marker.h29
-rw-r--r--third_party/mojo/src/mojo/public/c/gles2/gles2.h3
-rw-r--r--third_party/mojo/src/mojo/public/c/gles2/gles2_call_visitor_chromium_bind_uniform_location_autogen.h14
-rw-r--r--third_party/mojo/src/mojo/public/c/gles2/gles2_call_visitor_chromium_resize_autogen.h14
-rw-r--r--third_party/mojo/src/mojo/public/c/gles2/gles2_call_visitor_ext_debug_marker_autogen.h19
-rw-r--r--third_party/mojo/src/mojo/public/c/gles2/gles2_call_visitor_oes_vertex_array_object_autogen.h20
-rw-r--r--third_party/mojo/src/mojo/public/c/gles2/occlusion_query_ext.h1
-rw-r--r--third_party/mojo/src/mojo/public/c/gles2/oes_vertex_array_object.h29
-rw-r--r--third_party/mojo/src/mojo/public/c/gpu/BUILD.gn69
-rw-r--r--third_party/mojo/src/mojo/public/c/gpu/GLES2/gl2.h526
-rw-r--r--third_party/mojo/src/mojo/public/c/gpu/GLES2/gl2ext.h2026
-rw-r--r--third_party/mojo/src/mojo/public/c/gpu/GLES2/gl2extmojo.h785
-rw-r--r--third_party/mojo/src/mojo/public/c/gpu/GLES2/gl2mojo.h32
-rw-r--r--third_party/mojo/src/mojo/public/c/gpu/GLES2/gl2mojo_autogen.h325
-rw-r--r--third_party/mojo/src/mojo/public/c/gpu/GLES2/gl2platform.h30
-rw-r--r--third_party/mojo/src/mojo/public/c/gpu/KHR/khrplatform.h298
-rw-r--r--third_party/mojo/src/mojo/public/c/gpu/MGL/mgl.h62
-rw-r--r--third_party/mojo/src/mojo/public/c/gpu/MGL/mgl_onscreen.h29
-rw-r--r--third_party/mojo/src/mojo/public/c/gpu/MGL/mgl_types.h22
-rw-r--r--third_party/mojo/src/mojo/public/c/system/functions.h2
-rw-r--r--third_party/mojo/src/mojo/public/cpp/bindings/array.h29
-rw-r--r--third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_handler.cc7
-rw-r--r--third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_proxy.cc12
-rw-r--r--third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.cc26
-rw-r--r--third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.h29
-rw-r--r--third_party/mojo/src/mojo/public/cpp/bindings/lib/message.cc56
-rw-r--r--third_party/mojo/src/mojo/public/cpp/bindings/lib/message_builder.cc19
-rw-r--r--third_party/mojo/src/mojo/public/cpp/bindings/lib/message_builder.h12
-rw-r--r--third_party/mojo/src/mojo/public/cpp/bindings/message.h14
-rw-r--r--third_party/mojo/src/mojo/public/cpp/bindings/tests/array_unittest.cc12
-rw-r--r--third_party/mojo/src/mojo/public/cpp/bindings/tests/buffer_unittest.cc14
-rw-r--r--third_party/mojo/src/mojo/public/cpp/bindings/tests/connector_unittest.cc3
-rw-r--r--third_party/mojo/src/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc72
-rw-r--r--third_party/mojo/src/mojo/public/cpp/bindings/tests/map_unittest.cc6
-rw-r--r--third_party/mojo/src/mojo/public/cpp/bindings/tests/message_queue.cc4
-rw-r--r--third_party/mojo/src/mojo/public/cpp/bindings/tests/router_unittest.cc6
-rw-r--r--third_party/mojo/src/mojo/public/cpp/bindings/tests/serialization_warning_unittest.cc4
-rw-r--r--third_party/mojo/src/mojo/public/cpp/bindings/tests/struct_unittest.cc10
-rw-r--r--third_party/mojo/src/mojo/public/cpp/bindings/tests/union_unittest.cc76
-rw-r--r--third_party/mojo/src/mojo/public/cpp/bindings/tests/validation_unittest.cc33
-rw-r--r--third_party/mojo/src/mojo/public/cpp/environment/lib/default_task_tracker.cc2
-rw-r--r--third_party/mojo/src/mojo/public/cpp/environment/lib/default_task_tracker.h5
-rw-r--r--third_party/mojo/src/mojo/public/cpp/environment/task_tracker.h10
-rw-r--r--third_party/mojo/src/mojo/public/dart/.gitignore1
-rw-r--r--third_party/mojo/src/mojo/public/dart/BUILD.gn28
-rw-r--r--third_party/mojo/src/mojo/public/dart/CHANGELOG.md4
-rw-r--r--third_party/mojo/src/mojo/public/dart/lib/_sdkext3
-rw-r--r--third_party/mojo/src/mojo/public/dart/lib/application.dart6
-rw-r--r--third_party/mojo/src/mojo/public/dart/lib/bindings.dart2
-rw-r--r--third_party/mojo/src/mojo/public/dart/lib/core.dart1
-rw-r--r--third_party/mojo/src/mojo/public/dart/lib/src/control_message.dart15
-rw-r--r--third_party/mojo/src/mojo/public/dart/lib/src/utils.dart15
-rw-r--r--third_party/mojo/src/mojo/public/dart/pubspec.yaml4
-rw-r--r--third_party/mojo/src/mojo/public/dart/rules.gni544
-rw-r--r--third_party/mojo/src/mojo/public/dart/sdk_ext/src/natives.dart4
-rw-r--r--third_party/mojo/src/mojo/public/interfaces/bindings/interface_control_messages.mojom2
-rw-r--r--third_party/mojo/src/mojo/public/interfaces/bindings/tests/BUILD.gn1
-rw-r--r--third_party/mojo/src/mojo/public/interfaces/bindings/tests/scoping.mojom17
-rw-r--r--third_party/mojo/src/mojo/public/interfaces/bindings/tests/validation_test_interfaces.mojom18
-rw-r--r--third_party/mojo/src/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Encoder.java4
-rw-r--r--third_party/mojo/src/mojo/public/mojo.gni11
-rw-r--r--third_party/mojo/src/mojo/public/mojo_application.gni7
-rw-r--r--third_party/mojo/src/mojo/public/platform/native/BUILD.gn30
-rw-r--r--third_party/mojo/src/mojo/public/platform/native/gles2_impl_chromium_bind_uniform_location_thunks.cc34
-rw-r--r--third_party/mojo/src/mojo/public/platform/native/gles2_impl_chromium_bind_uniform_location_thunks.h47
-rw-r--r--third_party/mojo/src/mojo/public/platform/native/gles2_impl_chromium_resize_thunks.cc31
-rw-r--r--third_party/mojo/src/mojo/public/platform/native/gles2_impl_chromium_resize_thunks.h44
-rw-r--r--third_party/mojo/src/mojo/public/platform/native/gles2_impl_ext_debug_marker_thunks.cc33
-rw-r--r--third_party/mojo/src/mojo/public/platform/native/gles2_impl_ext_debug_marker_thunks.h44
-rw-r--r--third_party/mojo/src/mojo/public/platform/native/gles2_impl_oes_vertex_array_object_thunks.cc35
-rw-r--r--third_party/mojo/src/mojo/public/platform/native/gles2_impl_oes_vertex_array_object_thunks.h45
-rw-r--r--third_party/mojo/src/mojo/public/platform/native/gles2_thunks.cc5
-rw-r--r--third_party/mojo/src/mojo/public/platform/native/gles2_thunks.h4
-rw-r--r--third_party/mojo/src/mojo/public/platform/native/mgl_onscreen_thunks.c28
-rw-r--r--third_party/mojo/src/mojo/public/platform/native/mgl_onscreen_thunks.h46
-rw-r--r--third_party/mojo/src/mojo/public/platform/native/mgl_thunks.c45
-rw-r--r--third_party/mojo/src/mojo/public/platform/native/mgl_thunks.h56
-rw-r--r--third_party/mojo/src/mojo/public/tools/BUILD.gn18
-rw-r--r--third_party/mojo/src/mojo/public/tools/NETWORK_SERVICE_VERSION2
-rw-r--r--third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/enum_declaration.tmpl9
-rw-r--r--third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/enum_macros.tmpl46
-rw-r--r--third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/interface_declaration.tmpl4
-rw-r--r--third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl17
-rw-r--r--third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl6
-rw-r--r--third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl3
-rw-r--r--third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl5
-rw-r--r--third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_definition.tmpl7
-rw-r--r--third_party/mojo/src/mojo/public/tools/bindings/generators/java_templates/interface_definition.tmpl1
-rw-r--r--third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_cpp_generator.py8
-rw-r--r--third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_dart_generator.py18
-rw-r--r--third_party/mojo/src/mojo/public/tools/bindings/mojom.gni2
-rw-r--r--third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom/generate/data.py28
-rw-r--r--third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom/generate/module.py5
-rwxr-xr-xthird_party/mojo/src/mojo/public/tools/dart_analyze.py107
-rwxr-xr-xthird_party/mojo/src/mojo/public/tools/dart_package.py25
-rwxr-xr-xthird_party/mojo/src/mojo/public/tools/dart_pkg.py470
-rwxr-xr-xthird_party/mojo/src/mojo/public/tools/dart_snapshotter.py29
-rwxr-xr-xthird_party/mojo/src/mojo/public/tools/dartx.py33
-rwxr-xr-xthird_party/mojo/src/mojo/public/tools/download_dart_snapshotter.py101
127 files changed, 7199 insertions, 946 deletions
diff --git a/mojo/application/public/cpp/lib/application_impl.cc b/mojo/application/public/cpp/lib/application_impl.cc
index 6279703..7885e50 100644
--- a/mojo/application/public/cpp/lib/application_impl.cc
+++ b/mojo/application/public/cpp/lib/application_impl.cc
@@ -25,19 +25,6 @@ void DefaultTerminationClosure() {
} // namespace
-// TODO(beng): upstream this into mojo repo, array.h
-template <typename E, typename T>
-struct TypeConverter<std::set<E>, Array<T>> {
- static std::set<E> Convert(const Array<T>& input) {
- std::set<E> result;
- if (!input.is_null()) {
- for (size_t i = 0; i < input.size(); ++i)
- result.insert(TypeConverter<E, T>::Convert(input[i]));
- }
- return result;
- }
-};
-
ApplicationImpl::ApplicationImpl(ApplicationDelegate* delegate,
InterfaceRequest<Application> request)
: ApplicationImpl(delegate, request.Pass(),
diff --git a/mojo/cc/BUILD.gn b/mojo/cc/BUILD.gn
index c35180f..5e7e964 100644
--- a/mojo/cc/BUILD.gn
+++ b/mojo/cc/BUILD.gn
@@ -13,6 +13,7 @@ source_set("cc") {
"//gpu/command_buffer/client:gles2_implementation",
"//gpu/command_buffer/client:gles2_interface",
"//mojo/converters/surfaces",
+ "//mojo/gles2:headers",
"//mojo/gpu:mojo_gles2_implementation",
"//skia",
"//third_party/mojo/src/mojo/public/c/gles2",
diff --git a/mojo/cc/context_provider_mojo.cc b/mojo/cc/context_provider_mojo.cc
index 5b0a640..801d9f5 100644
--- a/mojo/cc/context_provider_mojo.cc
+++ b/mojo/cc/context_provider_mojo.cc
@@ -5,6 +5,7 @@
#include "mojo/cc/context_provider_mojo.h"
#include "base/logging.h"
+#include "mojo/gles2/gles2_context.h"
#include "mojo/gpu/mojo_gles2_impl_autogen.h"
#include "third_party/mojo/src/mojo/public/cpp/environment/environment.h"
@@ -36,8 +37,8 @@ gpu::gles2::GLES2Interface* ContextProviderMojo::ContextGL() {
gpu::ContextSupport* ContextProviderMojo::ContextSupport() {
if (!context_)
return NULL;
- return static_cast<gpu::ContextSupport*>(
- MojoGLES2GetContextSupport(context_));
+ // TODO(rjkroege): Ensure that UIP does not take this code path.
+ return static_cast<gles2::GLES2Context*>(context_)->context_support();
}
class GrContext* ContextProviderMojo::GrContext() { return NULL; }
diff --git a/mojo/gles2/BUILD.gn b/mojo/gles2/BUILD.gn
index 5ec3289..85f4ca6 100644
--- a/mojo/gles2/BUILD.gn
+++ b/mojo/gles2/BUILD.gn
@@ -10,6 +10,23 @@ config("gles2_use_mojo") {
defines = [ "GLES2_USE_MOJO" ]
}
+source_set("headers") {
+ sources = [
+ "command_buffer_client_impl.h",
+ "gles2_context.h",
+ ]
+
+ public_deps = [
+ "//base",
+ "//components/view_manager/public/interfaces",
+ "//gpu/command_buffer/client",
+ "//gpu/command_buffer/client:gles2_implementation",
+ "//gpu/command_buffer/common",
+ "//third_party/mojo/src/mojo/public/c/gles2:headers",
+ "//third_party/mojo/src/mojo/public/cpp/bindings",
+ ]
+}
+
source_set("gles2") {
sources = [
"command_buffer_client_impl.cc",
diff --git a/mojo/shell/capability_filter.h b/mojo/shell/capability_filter.h
index 6d17cc3..16a55c2 100644
--- a/mojo/shell/capability_filter.h
+++ b/mojo/shell/capability_filter.h
@@ -11,33 +11,6 @@
#include "mojo/public/cpp/bindings/array.h"
namespace mojo {
-// TODO(beng): upstream this into mojo repo, array.h so it can be shared with
-// application_impl.cc.
-// A |TypeConverter| that will create an |std::set<E>| containing a copy of
-// the contents of an |Array<T>|, using |TypeConverter<E, T>| to copy each
-// element. If the input array is null, the output set will be empty.
-template <typename E, typename T>
-struct TypeConverter <std::set<E>, Array<T>> {
- static std::set<E> Convert(const Array<T>& input) {
- std::set<E> result;
- if (!input.is_null()) {
- for (size_t i = 0; i < input.size(); ++i)
- result.insert(TypeConverter<E, T>::Convert(input[i]));
- }
- return result;
- }
-};
-
-template <typename T, typename E>
-struct TypeConverter <Array<T>, std::set<E>> {
- static Array<T> Convert(const std::set<E>& input) {
- Array<T> result(0u);
- for (auto i : input)
- result.push_back(TypeConverter<T, E>::Convert(i));
- return result.Pass();
- }
-};
-
namespace shell {
// A set of names of interfaces that may be exposed to an application.
diff --git a/third_party/mojo/mojo_public.gyp b/third_party/mojo/mojo_public.gyp
index f5b8265..5efac66 100644
--- a/third_party/mojo/mojo_public.gyp
+++ b/third_party/mojo/mojo_public.gyp
@@ -338,6 +338,7 @@
'src/mojo/public/interfaces/bindings/tests/sample_import2.mojom',
'src/mojo/public/interfaces/bindings/tests/sample_interfaces.mojom',
'src/mojo/public/interfaces/bindings/tests/sample_service.mojom',
+ 'src/mojo/public/interfaces/bindings/tests/scoping.mojom',
'src/mojo/public/interfaces/bindings/tests/serialization_test_structs.mojom',
'src/mojo/public/interfaces/bindings/tests/test_structs.mojom',
'src/mojo/public/interfaces/bindings/tests/validation_test_interfaces.mojom',
diff --git a/third_party/mojo/mojom_bindings_generator_variables.gypi b/third_party/mojo/mojom_bindings_generator_variables.gypi
index cc8f041..744144f 100644
--- a/third_party/mojo/mojom_bindings_generator_variables.gypi
+++ b/third_party/mojo/mojom_bindings_generator_variables.gypi
@@ -8,7 +8,7 @@
'<(DEPTH)/third_party/mojo/src/mojo/public/tools/bindings/mojom_bindings_generator.py',
'mojom_bindings_generator_sources': [
'<(mojom_bindings_generator)',
- '<(DEPTH)/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/enum_declaration.tmpl',
+ '<(DEPTH)/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/enum_macros.tmpl',
'<(DEPTH)/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/interface_declaration.tmpl',
'<(DEPTH)/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl',
'<(DEPTH)/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/interface_macros.tmpl',
diff --git a/third_party/mojo/src/mojo/edk/system/BUILD.gn b/third_party/mojo/src/mojo/edk/system/BUILD.gn
index 5dd2682..ac292d5 100644
--- a/third_party/mojo/src/mojo/edk/system/BUILD.gn
+++ b/third_party/mojo/src/mojo/edk/system/BUILD.gn
@@ -41,6 +41,7 @@ component("system") {
"connection_identifier.h",
"connection_manager.cc",
"connection_manager.h",
+ "connection_manager_messages.h",
"core.cc",
"core.h",
"data_pipe.cc",
diff --git a/third_party/mojo/src/mojo/edk/system/channel_endpoint.cc b/third_party/mojo/src/mojo/edk/system/channel_endpoint.cc
index 038de8d..e7e17b4 100644
--- a/third_party/mojo/src/mojo/edk/system/channel_endpoint.cc
+++ b/third_party/mojo/src/mojo/edk/system/channel_endpoint.cc
@@ -16,9 +16,9 @@ namespace system {
ChannelEndpoint::ChannelEndpoint(ChannelEndpointClient* client,
unsigned client_port,
MessageInTransitQueue* message_queue)
- : client_(client),
+ : state_(State::PAUSED),
+ client_(client),
client_port_(client_port),
- channel_state_(ChannelState::NOT_YET_ATTACHED),
channel_(nullptr) {
DCHECK(client_ || message_queue);
@@ -31,18 +31,14 @@ bool ChannelEndpoint::EnqueueMessage(scoped_ptr<MessageInTransit> message) {
MutexLocker locker(&mutex_);
- switch (channel_state_) {
- case ChannelState::NOT_YET_ATTACHED:
- case ChannelState::DETACHED:
- // We may reach here if we haven't been attached/run yet.
- // TODO(vtl): We may also reach here if the channel is shut down early for
- // some reason (with live message pipes on it). Ideally, we'd return false
- // (and not enqueue the message), but we currently don't have a way to
- // check this.
+ switch (state_) {
+ case State::PAUSED:
channel_message_queue_.AddMessage(message.Pass());
return true;
- case ChannelState::ATTACHED:
+ case State::RUNNING:
return WriteMessageNoLock(message.Pass());
+ case State::DEAD:
+ return false;
}
NOTREACHED();
@@ -58,7 +54,7 @@ bool ChannelEndpoint::ReplaceClient(ChannelEndpointClient* client,
DCHECK(client != client_.get() || client_port != client_port_);
client_ = client;
client_port_ = client_port;
- return channel_state_ != ChannelState::DETACHED;
+ return state_ != State::DEAD;
}
void ChannelEndpoint::DetachFromClient() {
@@ -69,7 +65,7 @@ void ChannelEndpoint::DetachFromClient() {
if (!channel_)
return;
channel_->DetachEndpoint(this, local_id_, remote_id_);
- ResetChannelNoLock();
+ DieNoLock();
}
void ChannelEndpoint::AttachAndRun(Channel* channel,
@@ -80,11 +76,11 @@ void ChannelEndpoint::AttachAndRun(Channel* channel,
DCHECK(remote_id.is_valid());
MutexLocker locker(&mutex_);
- DCHECK(channel_state_ == ChannelState::NOT_YET_ATTACHED);
+ DCHECK(state_ == State::PAUSED);
DCHECK(!channel_);
DCHECK(!local_id_.is_valid());
DCHECK(!remote_id_.is_valid());
- channel_state_ = ChannelState::ATTACHED;
+ state_ = State::RUNNING;
channel_ = channel;
local_id_ = local_id;
remote_id_ = remote_id;
@@ -96,7 +92,7 @@ void ChannelEndpoint::AttachAndRun(Channel* channel,
if (!client_) {
channel_->DetachEndpoint(this, local_id_, remote_id_);
- ResetChannelNoLock();
+ DieNoLock();
}
}
@@ -131,9 +127,9 @@ void ChannelEndpoint::DetachFromChannel() {
// |DetachFromClient()| by calling |Channel::DetachEndpoint()| (and there
// are racing detaches).
if (channel_)
- ResetChannelNoLock();
+ DieNoLock();
else
- DCHECK(channel_state_ == ChannelState::DETACHED);
+ DCHECK(state_ == State::DEAD);
}
// If |ReplaceClient()| is called (from another thread) after the above locked
@@ -190,7 +186,7 @@ void ChannelEndpoint::OnReadMessageForClient(
MutexLocker locker(&mutex_);
if (!channel_ || !client_) {
// This isn't a failure per se. (It just means that, e.g., the other end
- // of the message point closed first.)
+ // of the message pipe closed first.)
return;
}
@@ -212,13 +208,13 @@ void ChannelEndpoint::OnReadMessageForClient(
}
}
-void ChannelEndpoint::ResetChannelNoLock() {
- DCHECK(channel_state_ == ChannelState::ATTACHED);
+void ChannelEndpoint::DieNoLock() {
+ DCHECK(state_ == State::RUNNING);
DCHECK(channel_);
DCHECK(local_id_.is_valid());
DCHECK(remote_id_.is_valid());
- channel_state_ = ChannelState::DETACHED;
+ state_ = State::DEAD;
channel_ = nullptr;
local_id_ = ChannelEndpointId();
remote_id_ = ChannelEndpointId();
diff --git a/third_party/mojo/src/mojo/edk/system/channel_endpoint.h b/third_party/mojo/src/mojo/edk/system/channel_endpoint.h
index c70e66e..3ebe386 100644
--- a/third_party/mojo/src/mojo/edk/system/channel_endpoint.h
+++ b/third_party/mojo/src/mojo/edk/system/channel_endpoint.h
@@ -168,13 +168,23 @@ class MOJO_SYSTEM_IMPL_EXPORT ChannelEndpoint final
// Helper for |OnReadMessage()|, handling messages for the client.
void OnReadMessageForClient(scoped_ptr<MessageInTransit> message);
- // Resets |channel_| to null (and sets |channel_state_| to
- // |ChannelState::DETACHED|). This may only be called if |channel_| is
- // non-null.
- void ResetChannelNoLock() MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
+ // Moves |state_| from |RUNNING| to |DEAD|. |channel_| must be non-null, but
+ // this does not call |channel_->DetachEndpoint()|.
+ void DieNoLock() MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
Mutex mutex_;
+ enum class State {
+ // |AttachAndRun()| has not been called yet (|channel_| is null).
+ PAUSED,
+ // |AttachAndRun()| has been called, but not |DetachFromChannel()|
+ // (|channel_| is non-null and valid).
+ RUNNING,
+ // |DetachFromChannel()| has been called (|channel_| is null).
+ DEAD
+ };
+ State state_ MOJO_GUARDED_BY(mutex_);
+
// |client_| must be valid whenever it is non-null. Before |*client_| gives up
// its reference to this object, it must call |DetachFromClient()|.
// NOTE: This is a |scoped_refptr<>|, rather than a raw pointer, since the
@@ -193,17 +203,6 @@ class MOJO_SYSTEM_IMPL_EXPORT ChannelEndpoint final
scoped_refptr<ChannelEndpointClient> client_ MOJO_GUARDED_BY(mutex_);
unsigned client_port_ MOJO_GUARDED_BY(mutex_);
- // State with respect to interaction with the |Channel|.
- enum class ChannelState {
- // |AttachAndRun()| has not been called yet (|channel_| is null).
- NOT_YET_ATTACHED,
- // |AttachAndRun()| has been called, but not |DetachFromChannel()|
- // (|channel_| is non-null and valid).
- ATTACHED,
- // |DetachFromChannel()| has been called (|channel_| is null).
- DETACHED
- };
- ChannelState channel_state_ MOJO_GUARDED_BY(mutex_);
// |channel_| must be valid whenever it is non-null. Before |*channel_| gives
// up its reference to this object, it must call |DetachFromChannel()|.
// |local_id_| and |remote_id_| are valid if and only |channel_| is non-null.
diff --git a/third_party/mojo/src/mojo/edk/system/channel_manager.cc b/third_party/mojo/src/mojo/edk/system/channel_manager.cc
index a2e4bf9..097ffa2 100644
--- a/third_party/mojo/src/mojo/edk/system/channel_manager.cc
+++ b/third_party/mojo/src/mojo/edk/system/channel_manager.cc
@@ -87,6 +87,13 @@ scoped_refptr<MessagePipeDispatcher> ChannelManager::CreateChannelOnIOThread(
return dispatcher;
}
+scoped_refptr<Channel> ChannelManager::CreateChannelWithoutBootstrapOnIOThread(
+ ChannelId channel_id,
+ embedder::ScopedPlatformHandle platform_handle) {
+ return CreateChannelOnIOThreadHelper(channel_id, platform_handle.Pass(),
+ nullptr);
+}
+
scoped_refptr<MessagePipeDispatcher> ChannelManager::CreateChannel(
ChannelId channel_id,
embedder::ScopedPlatformHandle platform_handle,
@@ -163,19 +170,19 @@ void ChannelManager::ShutdownHelper(
}
}
-void ChannelManager::CreateChannelOnIOThreadHelper(
+scoped_refptr<Channel> ChannelManager::CreateChannelOnIOThreadHelper(
ChannelId channel_id,
embedder::ScopedPlatformHandle platform_handle,
scoped_refptr<system::ChannelEndpoint> bootstrap_channel_endpoint) {
DCHECK_NE(channel_id, kInvalidChannelId);
DCHECK(platform_handle.is_valid());
- DCHECK(bootstrap_channel_endpoint);
// Create and initialize a |system::Channel|.
scoped_refptr<system::Channel> channel =
new system::Channel(platform_support_);
channel->Init(system::RawChannel::Create(platform_handle.Pass()));
- channel->SetBootstrapEndpoint(bootstrap_channel_endpoint);
+ if (bootstrap_channel_endpoint)
+ channel->SetBootstrapEndpoint(bootstrap_channel_endpoint);
{
MutexLocker locker(&mutex_);
@@ -183,6 +190,7 @@ void ChannelManager::CreateChannelOnIOThreadHelper(
channels_[channel_id] = channel;
}
channel->SetChannelManager(this);
+ return channel;
}
void ChannelManager::CreateChannelHelper(
diff --git a/third_party/mojo/src/mojo/edk/system/channel_manager.h b/third_party/mojo/src/mojo/edk/system/channel_manager.h
index 014c1b3..1ff958d 100644
--- a/third_party/mojo/src/mojo/edk/system/channel_manager.h
+++ b/third_party/mojo/src/mojo/edk/system/channel_manager.h
@@ -72,6 +72,14 @@ class MOJO_SYSTEM_IMPL_EXPORT ChannelManager {
ChannelId channel_id,
embedder::ScopedPlatformHandle platform_handle);
+ // Like |CreateChannelOnIOThread()|, but doesn't create a bootstrap message
+ // pipe. Returns the newly-created |Channel|.
+ // TODO(vtl): Maybe get rid of the others (and bootstrap message pipes in
+ // general).
+ scoped_refptr<Channel> CreateChannelWithoutBootstrapOnIOThread(
+ ChannelId channel_id,
+ embedder::ScopedPlatformHandle platform_handle);
+
// Like |CreateChannelOnIOThread()|, but may be called from any thread. On
// completion, will call |callback| (using |callback_thread_task_runner| if it
// is non-null, else on the I/O thread). Note: This will always post a task to
@@ -116,8 +124,9 @@ class MOJO_SYSTEM_IMPL_EXPORT ChannelManager {
scoped_refptr<base::TaskRunner> callback_thread_task_runner);
// Used by |CreateChannelOnIOThread()| and |CreateChannelHelper()|. Called on
- // the I/O thread.
- void CreateChannelOnIOThreadHelper(
+ // the I/O thread. |bootstrap_channel_endpoint| is optional and may be null.
+ // Returns the newly-created |Channel|.
+ scoped_refptr<Channel> CreateChannelOnIOThreadHelper(
ChannelId channel_id,
embedder::ScopedPlatformHandle platform_handle,
scoped_refptr<system::ChannelEndpoint> bootstrap_channel_endpoint);
diff --git a/third_party/mojo/src/mojo/edk/system/channel_manager_unittest.cc b/third_party/mojo/src/mojo/edk/system/channel_manager_unittest.cc
index afa9b15..2d38b61 100644
--- a/third_party/mojo/src/mojo/edk/system/channel_manager_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/system/channel_manager_unittest.cc
@@ -168,6 +168,9 @@ TEST_F(ChannelManagerTest, CallsFromOtherThread) {
EXPECT_EQ(MOJO_RESULT_OK, d->Close());
}
+// TODO(vtl): Test |CreateChannelWithoutBootstrapOnIOThread()|. (This will
+// require additional functionality in |Channel|.)
+
} // namespace
} // namespace system
} // namespace mojo
diff --git a/third_party/mojo/src/mojo/edk/system/connection_manager.h b/third_party/mojo/src/mojo/edk/system/connection_manager.h
index 5923c75..e0c3a6f 100644
--- a/third_party/mojo/src/mojo/edk/system/connection_manager.h
+++ b/third_party/mojo/src/mojo/edk/system/connection_manager.h
@@ -99,12 +99,14 @@ class MOJO_SYSTEM_IMPL_EXPORT ConnectionManager {
// Connects a pending connection; to be called only after both parties have
// called |AllowConnect()|. On success, |Result::SUCCESS_CONNECT_...| is
- // returned and |peer_process_identifier| is set to an unique identifier for
- // the peer process. In the case of |SUCCESS_CONNECT_SAME_PROCESS|,
+ // returned, |peer_process_identifier| is set to an unique identifier for the
+ // peer process, and |is_first| is set to true if this is the first party to
+ // call |Connect()|. In the case of |SUCCESS_CONNECT_SAME_PROCESS|,
// |*platform_handle| is set to a suitable native handle connecting the two
// parties.
virtual Result Connect(const ConnectionIdentifier& connection_id,
ProcessIdentifier* peer_process_identifier,
+ bool* is_first,
embedder::ScopedPlatformHandle* platform_handle) = 0;
protected:
diff --git a/third_party/mojo/src/mojo/edk/system/connection_manager_messages.h b/third_party/mojo/src/mojo/edk/system/connection_manager_messages.h
new file mode 100644
index 0000000..4117f95
--- /dev/null
+++ b/third_party/mojo/src/mojo/edk/system/connection_manager_messages.h
@@ -0,0 +1,30 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_SYSTEM_CONNECTION_MANAGER_MESSAGES_H_
+#define MOJO_EDK_SYSTEM_CONNECTION_MANAGER_MESSAGES_H_
+
+#include <string.h>
+
+#include "mojo/edk/system/process_identifier.h"
+#include "mojo/edk/system/system_impl_export.h"
+
+namespace mojo {
+namespace system {
+
+struct ConnectionManagerAckSuccessConnectData {
+ // Set to the process identifier of the process that the receiver of this ack
+ // ack should connect to.
+ ProcessIdentifier peer_process_identifier;
+
+ // Whether the receiver of this ack is the first party in the connection. This
+ // is typically used to decide whether the receiver should initiate the
+ // message (or data) pipe (i.e., allocate endpoint IDs, etc.).
+ bool is_first;
+};
+
+} // namespace system
+} // namespace mojo
+
+#endif // MOJO_EDK_SYSTEM_CONNECTION_MANAGER_MESSAGES_H_
diff --git a/third_party/mojo/src/mojo/edk/system/connection_manager_unittest.cc b/third_party/mojo/src/mojo/edk/system/connection_manager_unittest.cc
index 20fa73e..d8584b9 100644
--- a/third_party/mojo/src/mojo/edk/system/connection_manager_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/system/connection_manager_unittest.cc
@@ -225,16 +225,19 @@ TEST_F(ConnectionManagerTest, BasicConnectSlaves) {
EXPECT_TRUE(slave2.AllowConnect(connection_id));
ProcessIdentifier peer1 = kInvalidProcessIdentifier;
+ bool is_first = false;
embedder::ScopedPlatformHandle h1;
EXPECT_EQ(ConnectionManager::Result::SUCCESS_CONNECT_NEW_CONNECTION,
- slave1.Connect(connection_id, &peer1, &h1));
+ slave1.Connect(connection_id, &peer1, &is_first, &h1));
EXPECT_EQ(slave2_id, peer1);
+ EXPECT_TRUE(is_first);
EXPECT_TRUE(h1.is_valid());
ProcessIdentifier peer2 = kInvalidProcessIdentifier;
embedder::ScopedPlatformHandle h2;
EXPECT_EQ(ConnectionManager::Result::SUCCESS_CONNECT_NEW_CONNECTION,
- slave2.Connect(connection_id, &peer2, &h2));
+ slave2.Connect(connection_id, &peer2, &is_first, &h2));
EXPECT_EQ(slave1_id, peer2);
+ EXPECT_FALSE(is_first);
EXPECT_TRUE(h2.is_valid());
EXPECT_TRUE(ArePlatformHandlesConnected(h1.get(), h2.get()));
@@ -320,10 +323,12 @@ TEST_F(ConnectionManagerTest, SlaveCancelConnect) {
EXPECT_TRUE(slave1.CancelConnect(connection_id));
ProcessIdentifier peer2 = kInvalidProcessIdentifier;
+ bool is_first = false;
embedder::ScopedPlatformHandle h2;
EXPECT_EQ(ConnectionManager::Result::FAILURE,
- slave2.Connect(connection_id, &peer2, &h2));
+ slave2.Connect(connection_id, &peer2, &is_first, &h2));
EXPECT_EQ(kInvalidProcessIdentifier, peer2);
+ EXPECT_FALSE(is_first);
EXPECT_FALSE(h2.is_valid());
slave1.Shutdown();
@@ -363,10 +368,12 @@ TEST_F(ConnectionManagerTest, ErrorRemovePending) {
EXPECT_EQ(1u, master_process_delegate().on_slave_disconnect_calls());
ProcessIdentifier peer2 = kInvalidProcessIdentifier;
+ bool is_first = false;
embedder::ScopedPlatformHandle h2;
EXPECT_EQ(ConnectionManager::Result::FAILURE,
- slave2.Connect(connection_id, &peer2, &h2));
+ slave2.Connect(connection_id, &peer2, &is_first, &h2));
EXPECT_EQ(kInvalidProcessIdentifier, peer2);
+ EXPECT_FALSE(is_first);
EXPECT_FALSE(h2.is_valid());
slave2.Shutdown();
@@ -389,16 +396,19 @@ TEST_F(ConnectionManagerTest, ConnectSlaveToSelf) {
EXPECT_TRUE(slave.AllowConnect(connection_id));
ProcessIdentifier peer1 = kInvalidProcessIdentifier;
+ bool is_first = false;
embedder::ScopedPlatformHandle h1;
EXPECT_EQ(ConnectionManager::Result::SUCCESS_CONNECT_SAME_PROCESS,
- slave.Connect(connection_id, &peer1, &h1));
+ slave.Connect(connection_id, &peer1, &is_first, &h1));
EXPECT_EQ(slave_id, peer1);
+ EXPECT_TRUE(is_first);
EXPECT_FALSE(h1.is_valid());
ProcessIdentifier peer2 = kInvalidProcessIdentifier;
embedder::ScopedPlatformHandle h2;
EXPECT_EQ(ConnectionManager::Result::SUCCESS_CONNECT_SAME_PROCESS,
- slave.Connect(connection_id, &peer2, &h2));
+ slave.Connect(connection_id, &peer2, &is_first, &h2));
EXPECT_EQ(slave_id, peer2);
+ EXPECT_FALSE(is_first);
EXPECT_FALSE(h2.is_valid());
slave.Shutdown();
@@ -428,15 +438,18 @@ TEST_F(ConnectionManagerTest, ConnectSlavesTwice) {
EXPECT_TRUE(slave2.AllowConnect(connection_id));
ProcessIdentifier peer1 = kInvalidProcessIdentifier;
+ bool is_first = false;
embedder::ScopedPlatformHandle h1;
EXPECT_EQ(ConnectionManager::Result::SUCCESS_CONNECT_NEW_CONNECTION,
- slave1.Connect(connection_id, &peer1, &h1));
+ slave1.Connect(connection_id, &peer1, &is_first, &h1));
EXPECT_EQ(slave2_id, peer1);
+ EXPECT_TRUE(is_first);
ProcessIdentifier peer2 = kInvalidProcessIdentifier;
embedder::ScopedPlatformHandle h2;
EXPECT_EQ(ConnectionManager::Result::SUCCESS_CONNECT_NEW_CONNECTION,
- slave2.Connect(connection_id, &peer2, &h2));
+ slave2.Connect(connection_id, &peer2, &is_first, &h2));
EXPECT_EQ(slave1_id, peer2);
+ EXPECT_FALSE(is_first);
EXPECT_TRUE(ArePlatformHandlesConnected(h1.get(), h2.get()));
@@ -451,18 +464,80 @@ TEST_F(ConnectionManagerTest, ConnectSlavesTwice) {
h1.reset();
h2.reset();
- // TODO(vtl): FIXME -- this will break when I implemented
- // SUCCESS_CONNECT_REUSE_CONNECTION.
ProcessIdentifier second_peer2 = kInvalidProcessIdentifier;
- EXPECT_EQ(ConnectionManager::Result::SUCCESS_CONNECT_NEW_CONNECTION,
- slave2.Connect(connection_id, &second_peer2, &h2));
+ EXPECT_EQ(ConnectionManager::Result::SUCCESS_CONNECT_REUSE_CONNECTION,
+ slave2.Connect(connection_id, &second_peer2, &is_first, &h2));
+ EXPECT_EQ(peer2, second_peer2);
+ EXPECT_TRUE(is_first);
+ EXPECT_FALSE(h2.is_valid());
ProcessIdentifier second_peer1 = kInvalidProcessIdentifier;
+ EXPECT_EQ(ConnectionManager::Result::SUCCESS_CONNECT_REUSE_CONNECTION,
+ slave1.Connect(connection_id, &second_peer1, &is_first, &h1));
+ EXPECT_EQ(peer1, second_peer1);
+ EXPECT_FALSE(is_first);
+ EXPECT_FALSE(h1.is_valid());
+
+ slave2.Shutdown();
+ slave1.Shutdown();
+ master.Shutdown();
+}
+
+TEST_F(ConnectionManagerTest, OverlappingSlaveConnects) {
+ MasterConnectionManager master(platform_support());
+ master.Init(base::MessageLoop::current()->task_runner(),
+ &master_process_delegate());
+
+ MockSlaveProcessDelegate slave1_process_delegate;
+ SlaveConnectionManager slave1(platform_support());
+ ProcessIdentifier slave1_id =
+ ConnectSlave(&master, &slave1_process_delegate, &slave1, "slave1");
+ EXPECT_TRUE(IsValidSlaveProcessIdentifier(slave1_id));
+
+ MockSlaveProcessDelegate slave2_process_delegate;
+ SlaveConnectionManager slave2(platform_support());
+ ProcessIdentifier slave2_id =
+ ConnectSlave(&master, &slave2_process_delegate, &slave2, "slave2");
+ EXPECT_TRUE(IsValidSlaveProcessIdentifier(slave2_id));
+ EXPECT_NE(slave1_id, slave2_id);
+
+ ConnectionIdentifier connection_id1 = master.GenerateConnectionIdentifier();
+ EXPECT_TRUE(slave1.AllowConnect(connection_id1));
+ EXPECT_TRUE(slave2.AllowConnect(connection_id1));
+
+ ConnectionIdentifier connection_id2 = master.GenerateConnectionIdentifier();
+ EXPECT_TRUE(slave1.AllowConnect(connection_id2));
+ EXPECT_TRUE(slave2.AllowConnect(connection_id2));
+
+ ProcessIdentifier peer1 = kInvalidProcessIdentifier;
+ bool is_first = false;
+ embedder::ScopedPlatformHandle h1;
EXPECT_EQ(ConnectionManager::Result::SUCCESS_CONNECT_NEW_CONNECTION,
- slave1.Connect(connection_id, &second_peer1, &h1));
+ slave1.Connect(connection_id1, &peer1, &is_first, &h1));
+ EXPECT_EQ(slave2_id, peer1);
+ EXPECT_TRUE(is_first);
+ ProcessIdentifier peer2 = kInvalidProcessIdentifier;
+ embedder::ScopedPlatformHandle h2;
+ EXPECT_EQ(ConnectionManager::Result::SUCCESS_CONNECT_NEW_CONNECTION,
+ slave2.Connect(connection_id2, &peer2, &is_first, &h2));
+ EXPECT_EQ(slave1_id, peer2);
+ EXPECT_TRUE(is_first);
+
+ EXPECT_TRUE(ArePlatformHandlesConnected(h1.get(), h2.get()));
+ h1.reset();
+ h2.reset();
+ ProcessIdentifier second_peer1 = kInvalidProcessIdentifier;
+ EXPECT_EQ(ConnectionManager::Result::SUCCESS_CONNECT_REUSE_CONNECTION,
+ slave1.Connect(connection_id2, &second_peer1, &is_first, &h1));
EXPECT_EQ(peer1, second_peer1);
+ EXPECT_FALSE(is_first);
+ EXPECT_FALSE(h1.is_valid());
+ ProcessIdentifier second_peer2 = kInvalidProcessIdentifier;
+ EXPECT_EQ(ConnectionManager::Result::SUCCESS_CONNECT_REUSE_CONNECTION,
+ slave2.Connect(connection_id1, &second_peer2, &is_first, &h2));
EXPECT_EQ(peer2, second_peer2);
- EXPECT_TRUE(ArePlatformHandlesConnected(h1.get(), h2.get()));
+ EXPECT_FALSE(is_first);
+ EXPECT_FALSE(h2.is_valid());
slave2.Shutdown();
slave1.Shutdown();
@@ -485,16 +560,19 @@ TEST_F(ConnectionManagerTest, ConnectMasterToSlave) {
EXPECT_TRUE(slave.AllowConnect(connection_id));
ProcessIdentifier master_peer = kInvalidProcessIdentifier;
+ bool is_first = false;
embedder::ScopedPlatformHandle master_h;
EXPECT_EQ(ConnectionManager::Result::SUCCESS_CONNECT_NEW_CONNECTION,
- master.Connect(connection_id, &master_peer, &master_h));
+ master.Connect(connection_id, &master_peer, &is_first, &master_h));
EXPECT_EQ(slave_id, master_peer);
+ EXPECT_TRUE(is_first);
EXPECT_TRUE(master_h.is_valid());
ProcessIdentifier slave_peer = kInvalidProcessIdentifier;
embedder::ScopedPlatformHandle slave_h;
EXPECT_EQ(ConnectionManager::Result::SUCCESS_CONNECT_NEW_CONNECTION,
- slave.Connect(connection_id, &slave_peer, &slave_h));
+ slave.Connect(connection_id, &slave_peer, &is_first, &slave_h));
EXPECT_EQ(kMasterProcessIdentifier, slave_peer);
+ EXPECT_FALSE(is_first);
EXPECT_TRUE(slave_h.is_valid());
EXPECT_TRUE(ArePlatformHandlesConnected(master_h.get(), slave_h.get()));
@@ -513,16 +591,19 @@ TEST_F(ConnectionManagerTest, ConnectMasterToSelf) {
EXPECT_TRUE(master.AllowConnect(connection_id));
ProcessIdentifier peer1 = kInvalidProcessIdentifier;
+ bool is_first = false;
embedder::ScopedPlatformHandle h1;
EXPECT_EQ(ConnectionManager::Result::SUCCESS_CONNECT_SAME_PROCESS,
- master.Connect(connection_id, &peer1, &h1));
+ master.Connect(connection_id, &peer1, &is_first, &h1));
EXPECT_EQ(kMasterProcessIdentifier, peer1);
+ EXPECT_TRUE(is_first);
EXPECT_FALSE(h1.is_valid());
ProcessIdentifier peer2 = kInvalidProcessIdentifier;
embedder::ScopedPlatformHandle h2;
EXPECT_EQ(ConnectionManager::Result::SUCCESS_CONNECT_SAME_PROCESS,
- master.Connect(connection_id, &peer2, &h2));
+ master.Connect(connection_id, &peer2, &is_first, &h2));
EXPECT_EQ(kMasterProcessIdentifier, peer2);
+ EXPECT_FALSE(is_first);
EXPECT_FALSE(h2.is_valid());
EXPECT_EQ(peer1, peer2);
@@ -547,10 +628,12 @@ TEST_F(ConnectionManagerTest, MasterCancelConnect) {
EXPECT_TRUE(master.CancelConnect(connection_id));
ProcessIdentifier peer = kInvalidProcessIdentifier;
+ bool is_first = false;
embedder::ScopedPlatformHandle h;
EXPECT_EQ(ConnectionManager::Result::FAILURE,
- slave.Connect(connection_id, &peer, &h));
+ slave.Connect(connection_id, &peer, &is_first, &h));
EXPECT_EQ(kInvalidProcessIdentifier, peer);
+ EXPECT_FALSE(is_first);
EXPECT_FALSE(h.is_valid());
slave.Shutdown();
@@ -586,9 +669,11 @@ TEST_F(ConnectionManagerTest, AddSlaveAndBootstrap) {
embedder::ScopedPlatformHandle h1;
ProcessIdentifier master_peer = kInvalidProcessIdentifier;
+ bool is_first = false;
EXPECT_EQ(ConnectionManager::Result::SUCCESS_CONNECT_NEW_CONNECTION,
- master.Connect(connection_id, &master_peer, &h1));
+ master.Connect(connection_id, &master_peer, &is_first, &h1));
EXPECT_EQ(slave_id, master_peer);
+ EXPECT_TRUE(is_first);
EXPECT_TRUE(h1.is_valid());
// We can delay creating/initializing |slave| for quite a while.
@@ -600,8 +685,9 @@ TEST_F(ConnectionManagerTest, AddSlaveAndBootstrap) {
ProcessIdentifier slave_peer = kInvalidProcessIdentifier;
embedder::ScopedPlatformHandle h2;
EXPECT_EQ(ConnectionManager::Result::SUCCESS_CONNECT_NEW_CONNECTION,
- slave.Connect(connection_id, &slave_peer, &h2));
+ slave.Connect(connection_id, &slave_peer, &is_first, &h2));
EXPECT_EQ(kMasterProcessIdentifier, slave_peer);
+ EXPECT_FALSE(is_first);
EXPECT_TRUE(ArePlatformHandlesConnected(h1.get(), h2.get()));
diff --git a/third_party/mojo/src/mojo/edk/system/ipc_support.cc b/third_party/mojo/src/mojo/edk/system/ipc_support.cc
index 7c4f3d4..1c4b232 100644
--- a/third_party/mojo/src/mojo/edk/system/ipc_support.cc
+++ b/third_party/mojo/src/mojo/edk/system/ipc_support.cc
@@ -140,8 +140,9 @@ embedder::ScopedPlatformHandle IPCSupport::ConnectToSlaveInternal(
connection_id);
system::ProcessIdentifier peer_id = system::kInvalidProcessIdentifier;
+ bool is_first;
embedder::ScopedPlatformHandle platform_connection_handle;
- CHECK_EQ(connection_manager()->Connect(connection_id, &peer_id,
+ CHECK_EQ(connection_manager()->Connect(connection_id, &peer_id, &is_first,
&platform_connection_handle),
ConnectionManager::Result::SUCCESS_CONNECT_NEW_CONNECTION);
DCHECK_EQ(peer_id, *slave_process_identifier);
@@ -153,9 +154,10 @@ embedder::ScopedPlatformHandle IPCSupport::ConnectToMasterInternal(
const ConnectionIdentifier& connection_id) {
DCHECK_EQ(process_type_, embedder::ProcessType::SLAVE);
- system::ProcessIdentifier peer_id;
+ system::ProcessIdentifier peer_id = system::kInvalidProcessIdentifier;
+ bool is_first;
embedder::ScopedPlatformHandle platform_connection_handle;
- CHECK_EQ(connection_manager()->Connect(connection_id, &peer_id,
+ CHECK_EQ(connection_manager()->Connect(connection_id, &peer_id, &is_first,
&platform_connection_handle),
ConnectionManager::Result::SUCCESS_CONNECT_NEW_CONNECTION);
DCHECK_EQ(peer_id, system::kMasterProcessIdentifier);
diff --git a/third_party/mojo/src/mojo/edk/system/ipc_support_unittest.cc b/third_party/mojo/src/mojo/edk/system/ipc_support_unittest.cc
index 823f6b9..695c4ec 100644
--- a/third_party/mojo/src/mojo/edk/system/ipc_support_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/system/ipc_support_unittest.cc
@@ -11,6 +11,7 @@
#include "base/command_line.h"
#include "base/location.h"
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "base/synchronization/waitable_event.h"
#include "base/test/test_io_thread.h"
#include "base/test/test_timeouts.h"
@@ -37,6 +38,84 @@ namespace {
const char kConnectionIdFlag[] = "test-connection-id";
+// Tests writing a message (containing just data) to |write_mp| and then reading
+// it from |read_mp| (it should be the next message, i.e., there should be no
+// other messages already enqueued in that direction).
+void TestWriteReadMessage(scoped_refptr<MessagePipeDispatcher> write_mp,
+ scoped_refptr<MessagePipeDispatcher> read_mp) {
+ // Set up waiting on the read end first (to avoid racing).
+ Waiter waiter;
+ waiter.Init();
+ ASSERT_EQ(
+ MOJO_RESULT_OK,
+ read_mp->AddAwakable(&waiter, MOJO_HANDLE_SIGNAL_READABLE, 0, nullptr));
+
+ // Write a message with just 'x' through the write end.
+ EXPECT_EQ(MOJO_RESULT_OK,
+ write_mp->WriteMessage(UserPointer<const void>("x"), 1, nullptr,
+ MOJO_WRITE_MESSAGE_FLAG_NONE));
+
+ // Wait for it to arrive.
+ EXPECT_EQ(MOJO_RESULT_OK, waiter.Wait(test::ActionDeadline(), nullptr));
+ read_mp->RemoveAwakable(&waiter, nullptr);
+
+ // Read the message from the read end.
+ char buffer[10] = {};
+ uint32_t buffer_size = static_cast<uint32_t>(sizeof(buffer));
+ EXPECT_EQ(MOJO_RESULT_OK,
+ read_mp->ReadMessage(UserPointer<void>(buffer),
+ MakeUserPointer(&buffer_size), 0, nullptr,
+ MOJO_READ_MESSAGE_FLAG_NONE));
+ EXPECT_EQ(1u, buffer_size);
+ EXPECT_EQ('x', buffer[0]);
+}
+
+// Writes a message pipe dispatcher (in a message) to |write_mp| and reads it
+// from |read_mp| (it should be the next message, i.e., there should be no other
+// other messages already enqueued in that direction).
+scoped_refptr<MessagePipeDispatcher> SendMessagePipeDispatcher(
+ scoped_refptr<MessagePipeDispatcher> write_mp,
+ scoped_refptr<MessagePipeDispatcher> read_mp,
+ scoped_refptr<MessagePipeDispatcher> mp_to_send) {
+ CHECK_NE(mp_to_send, write_mp);
+ CHECK_NE(mp_to_send, read_mp);
+
+ // Set up waiting on the read end first (to avoid racing).
+ Waiter waiter;
+ waiter.Init();
+ CHECK_EQ(
+ read_mp->AddAwakable(&waiter, MOJO_HANDLE_SIGNAL_READABLE, 0, nullptr),
+ MOJO_RESULT_OK);
+
+ // Write a message with just |mp_to_send| through the write end.
+ DispatcherTransport transport(
+ test::DispatcherTryStartTransport(mp_to_send.get()));
+ CHECK(transport.is_valid());
+ std::vector<DispatcherTransport> transports;
+ transports.push_back(transport);
+ CHECK_EQ(write_mp->WriteMessage(NullUserPointer(), 0, &transports,
+ MOJO_WRITE_MESSAGE_FLAG_NONE),
+ MOJO_RESULT_OK);
+ transport.End();
+
+ // Wait for it to arrive.
+ CHECK_EQ(waiter.Wait(test::ActionDeadline(), nullptr), MOJO_RESULT_OK);
+ read_mp->RemoveAwakable(&waiter, nullptr);
+
+ // Read the message from the read end.
+ DispatcherVector dispatchers;
+ uint32_t num_dispatchers = 10;
+ CHECK_EQ(
+ read_mp->ReadMessage(NullUserPointer(), NullUserPointer(), &dispatchers,
+ &num_dispatchers, MOJO_READ_MESSAGE_FLAG_NONE),
+ MOJO_RESULT_OK);
+ CHECK_EQ(dispatchers.size(), 1u);
+ CHECK_EQ(num_dispatchers, 1u);
+ CHECK_EQ(dispatchers[0]->GetType(), Dispatcher::Type::MESSAGE_PIPE);
+ return scoped_refptr<MessagePipeDispatcher>(
+ static_cast<MessagePipeDispatcher*>(dispatchers[0].get()));
+}
+
class TestMasterProcessDelegate : public embedder::MasterProcessDelegate {
public:
TestMasterProcessDelegate()
@@ -203,12 +282,95 @@ class TestSlave {
MOJO_DISALLOW_COPY_AND_ASSIGN(TestSlave);
};
+// Encapsulates both the master and slave sides for each slave.
+class TestSlaveSetup {
+ public:
+ TestSlaveSetup(embedder::SimplePlatformSupport* platform_support,
+ base::TestIOThread* test_io_thread,
+ TestMasterProcessDelegate* master_process_delegate,
+ IPCSupport* master_ipc_support)
+ : platform_support_(platform_support),
+ test_io_thread_(test_io_thread),
+ master_process_delegate_(master_process_delegate),
+ master_ipc_support_(master_ipc_support) {}
+ ~TestSlaveSetup() {
+ CHECK(!slave_connection_);
+ CHECK(!slave_);
+ }
+
+ void Init() {
+ // Set up the master side entirely before the slave side, since this
+ // simulates what's likely to happen "in reality" more closely.
+ slave_connection_.reset(
+ new TestSlaveConnection(test_io_thread_, master_ipc_support_));
+ master_mp_ = slave_connection_->ConnectToSlave();
+
+ slave_.reset(new TestSlave(platform_support_, test_io_thread_,
+ slave_connection_->PassSlavePlatformHandle()));
+ slave_mp_ = slave_->ConnectToMaster(slave_connection_->connection_id());
+ }
+
+ void TestConnection() {
+ TestWriteReadMessage(master_mp_, slave_mp_);
+ TestWriteReadMessage(slave_mp_, master_mp_);
+ }
+
+ scoped_refptr<MessagePipeDispatcher> PassMasterMessagePipe() {
+ return master_mp_.Pass();
+ }
+
+ scoped_refptr<MessagePipeDispatcher> PassSlaveMessagePipe() {
+ return slave_mp_.Pass();
+ }
+
+ void Shutdown() {
+ if (master_mp_) {
+ master_mp_->Close();
+ master_mp_ = nullptr;
+ }
+ if (slave_mp_) {
+ slave_mp_->Close();
+ slave_mp_ = nullptr;
+ }
+
+ slave_->ShutdownChannelToMaster();
+ slave_->ShutdownIPCSupport();
+ EXPECT_TRUE(master_process_delegate_->TryWaitForOnSlaveDisconnect());
+ slave_connection_->ShutdownChannelToSlave();
+
+ slave_.reset();
+ slave_connection_.reset();
+ }
+
+ TestSlaveConnection* slave_connection() { return slave_connection_.get(); }
+ // Note: To close the master message pipe, use |PassMasterMessagePipe()|.
+ MessagePipeDispatcher* master_mp() { return master_mp_.get(); }
+
+ TestSlave* slave() { return slave_.get(); }
+ // Note: To close the slave message pipe, use |PassSlaveMessagePipe()|.
+ MessagePipeDispatcher* slave_mp() { return slave_mp_.get(); }
+
+ private:
+ embedder::SimplePlatformSupport* const platform_support_;
+ base::TestIOThread* const test_io_thread_;
+ TestMasterProcessDelegate* const master_process_delegate_;
+ IPCSupport* const master_ipc_support_;
+
+ scoped_ptr<TestSlaveConnection> slave_connection_;
+ scoped_refptr<MessagePipeDispatcher> master_mp_;
+
+ scoped_ptr<TestSlave> slave_;
+ scoped_refptr<MessagePipeDispatcher> slave_mp_;
+
+ MOJO_DISALLOW_COPY_AND_ASSIGN(TestSlaveSetup);
+};
+
class IPCSupportTest : public testing::Test {
public:
// Note: Run master process delegate methods on the I/O thread.
IPCSupportTest()
: test_io_thread_(base::TestIOThread::kAutoStart),
- master_ipc_support_(&platform_support(),
+ master_ipc_support_(&platform_support_,
embedder::ProcessType::MASTER,
test_io_thread_.task_runner(),
&master_process_delegate_,
@@ -216,6 +378,14 @@ class IPCSupportTest : public testing::Test {
embedder::ScopedPlatformHandle()) {}
~IPCSupportTest() override {}
+ scoped_ptr<TestSlaveSetup> SetupSlave() {
+ scoped_ptr<TestSlaveSetup> s(
+ new TestSlaveSetup(&platform_support_, &test_io_thread_,
+ &master_process_delegate_, &master_ipc_support_));
+ s->Init();
+ return s;
+ }
+
void ShutdownMasterIPCSupport() {
test_io_thread_.PostTaskAndWait(
FROM_HERE, base::Bind(&IPCSupport::ShutdownOnIOThread,
@@ -242,38 +412,6 @@ class IPCSupportTest : public testing::Test {
MOJO_DISALLOW_COPY_AND_ASSIGN(IPCSupportTest);
};
-// Tests writing a message (containing just data) to |write_mp| and then reading
-// it from |read_mp| (it should be the next message, i.e., there should be no
-// other messages already enqueued in that direction).
-void TestWriteReadMessage(scoped_refptr<MessagePipeDispatcher> write_mp,
- scoped_refptr<MessagePipeDispatcher> read_mp) {
- // Set up waiting on the read end first (to avoid racing).
- Waiter waiter;
- waiter.Init();
- ASSERT_EQ(
- MOJO_RESULT_OK,
- read_mp->AddAwakable(&waiter, MOJO_HANDLE_SIGNAL_READABLE, 0, nullptr));
-
- // Write a message with just 'x' through the write end.
- EXPECT_EQ(MOJO_RESULT_OK,
- write_mp->WriteMessage(UserPointer<const void>("x"), 1, nullptr,
- MOJO_WRITE_MESSAGE_FLAG_NONE));
-
- // Wait for it to arrive.
- EXPECT_EQ(MOJO_RESULT_OK, waiter.Wait(test::ActionDeadline(), nullptr));
- read_mp->RemoveAwakable(&waiter, nullptr);
-
- // Read the message from the read end.
- char buffer[10] = {};
- uint32_t buffer_size = static_cast<uint32_t>(sizeof(buffer));
- EXPECT_EQ(MOJO_RESULT_OK,
- read_mp->ReadMessage(UserPointer<void>(buffer),
- MakeUserPointer(&buffer_size), 0, nullptr,
- MOJO_READ_MESSAGE_FLAG_NONE));
- EXPECT_EQ(1u, buffer_size);
- EXPECT_EQ('x', buffer[0]);
-}
-
using MessagePipeDispatcherPair =
std::pair<scoped_refptr<MessagePipeDispatcher>,
scoped_refptr<MessagePipeDispatcher>>;
@@ -289,83 +427,23 @@ MessagePipeDispatcherPair CreateMessagePipe() {
return rv;
}
-// Writes a message pipe dispatcher (in a message) to |write_mp| and reads it
-// from |read_mp| (it should be the next message, i.e., there should be no other
-// other messages already enqueued in that direction).
-scoped_refptr<MessagePipeDispatcher> SendMessagePipeDispatcher(
- scoped_refptr<MessagePipeDispatcher> write_mp,
- scoped_refptr<MessagePipeDispatcher> read_mp,
- scoped_refptr<MessagePipeDispatcher> mp_to_send) {
- CHECK_NE(mp_to_send, write_mp);
- CHECK_NE(mp_to_send, read_mp);
-
- // Set up waiting on the read end first (to avoid racing).
- Waiter waiter;
- waiter.Init();
- CHECK_EQ(
- read_mp->AddAwakable(&waiter, MOJO_HANDLE_SIGNAL_READABLE, 0, nullptr),
- MOJO_RESULT_OK);
-
- // Write a message with just |mp_to_send| through the write end.
- DispatcherTransport transport(
- test::DispatcherTryStartTransport(mp_to_send.get()));
- CHECK(transport.is_valid());
- std::vector<DispatcherTransport> transports;
- transports.push_back(transport);
- CHECK_EQ(write_mp->WriteMessage(NullUserPointer(), 0, &transports,
- MOJO_WRITE_MESSAGE_FLAG_NONE),
- MOJO_RESULT_OK);
- transport.End();
-
- // Wait for it to arrive.
- CHECK_EQ(waiter.Wait(test::ActionDeadline(), nullptr), MOJO_RESULT_OK);
- read_mp->RemoveAwakable(&waiter, nullptr);
-
- // Read the message from the read end.
- DispatcherVector dispatchers;
- uint32_t num_dispatchers = 10;
- CHECK_EQ(
- read_mp->ReadMessage(NullUserPointer(), NullUserPointer(), &dispatchers,
- &num_dispatchers, MOJO_READ_MESSAGE_FLAG_NONE),
- MOJO_RESULT_OK);
- CHECK_EQ(dispatchers.size(), 1u);
- CHECK_EQ(num_dispatchers, 1u);
- CHECK_EQ(dispatchers[0]->GetType(), Dispatcher::Type::MESSAGE_PIPE);
- return scoped_refptr<MessagePipeDispatcher>(
- static_cast<MessagePipeDispatcher*>(dispatchers[0].get()));
-}
-
TEST_F(IPCSupportTest, MasterSlave) {
- TestSlaveConnection slave_connection(&test_io_thread(),
- &master_ipc_support());
- scoped_refptr<MessagePipeDispatcher> master_mp =
- slave_connection.ConnectToSlave();
+ scoped_ptr<TestSlaveSetup> s(SetupSlave());
- TestSlave slave(&platform_support(), &test_io_thread(),
- slave_connection.PassSlavePlatformHandle());
- scoped_refptr<MessagePipeDispatcher> slave_mp =
- slave.ConnectToMaster(slave_connection.connection_id());
-
- // Test that we can send a message from the master to the slave.
- TestWriteReadMessage(master_mp, slave_mp);
- // And vice versa.
- TestWriteReadMessage(slave_mp, master_mp);
+ s->TestConnection();
// Don't need the message pipe anymore.
- master_mp->Close();
- slave_mp->Close();
+ s->PassMasterMessagePipe()->Close();
+ s->PassSlaveMessagePipe()->Close();
// A message was sent through the message pipe, |Channel|s must have been
// established on both sides. The events have thus almost certainly been
// signalled, but we'll wait just to be sure.
- slave_connection.WaitForChannelToSlave();
- slave.WaitForChannelToMaster();
+ s->slave_connection()->WaitForChannelToSlave();
+ s->slave()->WaitForChannelToMaster();
- slave.ShutdownChannelToMaster();
- slave.ShutdownIPCSupport();
- EXPECT_TRUE(master_process_delegate().TryWaitForOnSlaveDisconnect());
+ s->Shutdown();
- slave_connection.ShutdownChannelToSlave();
ShutdownMasterIPCSupport();
}
@@ -378,47 +456,28 @@ TEST_F(IPCSupportTest, MasterSlave) {
// TODO(vtl): In this scenario, we can't test the intermediary (the master)
// going away.
TEST_F(IPCSupportTest, ConnectTwoSlaves) {
- TestSlaveConnection slave1_connection(&test_io_thread(),
- &master_ipc_support());
- scoped_refptr<MessagePipeDispatcher> master_mp1 =
- slave1_connection.ConnectToSlave();
-
- TestSlave slave1(&platform_support(), &test_io_thread(),
- slave1_connection.PassSlavePlatformHandle());
- scoped_refptr<MessagePipeDispatcher> slave1_mp =
- slave1.ConnectToMaster(slave1_connection.connection_id());
-
- TestSlaveConnection slave2_connection(&test_io_thread(),
- &master_ipc_support());
- scoped_refptr<MessagePipeDispatcher> master_mp2 =
- slave2_connection.ConnectToSlave();
-
- TestSlave slave2(&platform_support(), &test_io_thread(),
- slave2_connection.PassSlavePlatformHandle());
- scoped_refptr<MessagePipeDispatcher> slave2_mp =
- slave2.ConnectToMaster(slave2_connection.connection_id());
-
- TestWriteReadMessage(master_mp1, slave1_mp);
- TestWriteReadMessage(slave1_mp, master_mp1);
- TestWriteReadMessage(master_mp2, slave2_mp);
- TestWriteReadMessage(slave2_mp, master_mp2);
+ scoped_ptr<TestSlaveSetup> s1(SetupSlave());
+ scoped_ptr<TestSlaveSetup> s2(SetupSlave());
+ s1->TestConnection();
+ s2->TestConnection();
// Make a message pipe (logically "in" the master) and send one end to each
// slave.
- MessagePipeDispatcherPair send_mps = CreateMessagePipe();
+ MessagePipeDispatcherPair send_mp = CreateMessagePipe();
scoped_refptr<MessagePipeDispatcher> slave1_received_mp =
- SendMessagePipeDispatcher(master_mp1, slave1_mp, send_mps.first);
+ SendMessagePipeDispatcher(s1->master_mp(), s1->slave_mp(), send_mp.first);
scoped_refptr<MessagePipeDispatcher> slave2_received_mp =
- SendMessagePipeDispatcher(master_mp2, slave2_mp, send_mps.second);
+ SendMessagePipeDispatcher(s2->master_mp(), s2->slave_mp(),
+ send_mp.second);
// These should be connected.
TestWriteReadMessage(slave1_received_mp, slave2_received_mp);
TestWriteReadMessage(slave2_received_mp, slave1_received_mp);
- master_mp1->Close();
- master_mp2->Close();
- slave1_mp->Close();
- slave2_mp->Close();
+ s1->PassMasterMessagePipe()->Close();
+ s2->PassMasterMessagePipe()->Close();
+ s1->PassSlaveMessagePipe()->Close();
+ s2->PassSlaveMessagePipe()->Close();
// They should still be connected.
TestWriteReadMessage(slave1_received_mp, slave2_received_mp);
@@ -427,15 +486,95 @@ TEST_F(IPCSupportTest, ConnectTwoSlaves) {
slave1_received_mp->Close();
slave2_received_mp->Close();
- slave1.ShutdownChannelToMaster();
- slave1.ShutdownIPCSupport();
- EXPECT_TRUE(master_process_delegate().TryWaitForOnSlaveDisconnect());
- slave1_connection.ShutdownChannelToSlave();
+ s1->Shutdown();
+ s2->Shutdown();
- slave2.ShutdownChannelToMaster();
- slave2.ShutdownIPCSupport();
- EXPECT_TRUE(master_process_delegate().TryWaitForOnSlaveDisconnect());
- slave2_connection.ShutdownChannelToSlave();
+ ShutdownMasterIPCSupport();
+}
+
+// Like |ConnectTwoSlaves|, but does it twice, to test reusing a connection.
+TEST_F(IPCSupportTest, ConnectTwoSlavesTwice) {
+ scoped_ptr<TestSlaveSetup> s1(SetupSlave());
+ scoped_ptr<TestSlaveSetup> s2(SetupSlave());
+ s1->TestConnection();
+ s2->TestConnection();
+
+ MessagePipeDispatcherPair send_mp1 = CreateMessagePipe();
+ scoped_refptr<MessagePipeDispatcher> slave1_received_mp1 =
+ SendMessagePipeDispatcher(s1->master_mp(), s1->slave_mp(),
+ send_mp1.first);
+ scoped_refptr<MessagePipeDispatcher> slave2_received_mp1 =
+ SendMessagePipeDispatcher(s2->master_mp(), s2->slave_mp(),
+ send_mp1.second);
+
+ MessagePipeDispatcherPair send_mp2 = CreateMessagePipe();
+ scoped_refptr<MessagePipeDispatcher> slave1_received_mp2 =
+ SendMessagePipeDispatcher(s1->master_mp(), s1->slave_mp(),
+ send_mp2.first);
+ scoped_refptr<MessagePipeDispatcher> slave2_received_mp2 =
+ SendMessagePipeDispatcher(s2->master_mp(), s2->slave_mp(),
+ send_mp2.second);
+
+ s1->PassMasterMessagePipe()->Close();
+ s2->PassMasterMessagePipe()->Close();
+ s1->PassSlaveMessagePipe()->Close();
+ s2->PassSlaveMessagePipe()->Close();
+
+ TestWriteReadMessage(slave1_received_mp1, slave2_received_mp1);
+ TestWriteReadMessage(slave2_received_mp1, slave1_received_mp1);
+
+ TestWriteReadMessage(slave1_received_mp2, slave2_received_mp2);
+ TestWriteReadMessage(slave2_received_mp2, slave1_received_mp2);
+
+ slave1_received_mp1->Close();
+ slave2_received_mp1->Close();
+
+ TestWriteReadMessage(slave1_received_mp2, slave2_received_mp2);
+ TestWriteReadMessage(slave2_received_mp2, slave1_received_mp2);
+
+ slave1_received_mp2->Close();
+ slave2_received_mp2->Close();
+
+ s1->Shutdown();
+ s2->Shutdown();
+
+ ShutdownMasterIPCSupport();
+}
+
+// Creates a message pipe in the slave, which sends both ends (in separate
+// messages) to the master.
+TEST_F(IPCSupportTest, SlavePassBackToMaster) {
+ scoped_ptr<TestSlaveSetup> s(SetupSlave());
+
+ s->TestConnection();
+
+ // Make a message pipe (logically "in" the slave) and send both ends
+ // (separately) to the master.
+ MessagePipeDispatcherPair send_mp = CreateMessagePipe();
+ scoped_refptr<MessagePipeDispatcher> received_mp1 =
+ SendMessagePipeDispatcher(s->slave_mp(), s->master_mp(), send_mp.first);
+
+ TestWriteReadMessage(received_mp1, send_mp.second);
+ TestWriteReadMessage(send_mp.second, received_mp1);
+
+ scoped_refptr<MessagePipeDispatcher> received_mp2 =
+ SendMessagePipeDispatcher(s->slave_mp(), s->master_mp(), send_mp.second);
+
+ s->PassMasterMessagePipe()->Close();
+ s->PassSlaveMessagePipe()->Close();
+
+ TestWriteReadMessage(received_mp1, received_mp2);
+ TestWriteReadMessage(received_mp2, received_mp1);
+
+ s->Shutdown();
+
+ // These should still be connected.
+ // TODO(vtl): This is not yet implemented, thus will fail here!
+ // TestWriteReadMessage(received_mp1, received_mp2);
+ // TestWriteReadMessage(received_mp2, received_mp1);
+
+ received_mp1->Close();
+ received_mp2->Close();
ShutdownMasterIPCSupport();
}
diff --git a/third_party/mojo/src/mojo/edk/system/master_connection_manager.cc b/third_party/mojo/src/mojo/edk/system/master_connection_manager.cc
index 7e24a4a8..9257212 100644
--- a/third_party/mojo/src/mojo/edk/system/master_connection_manager.cc
+++ b/third_party/mojo/src/mojo/edk/system/master_connection_manager.cc
@@ -12,7 +12,9 @@
#include "base/synchronization/waitable_event.h"
#include "mojo/edk/embedder/master_process_delegate.h"
#include "mojo/edk/embedder/platform_channel_pair.h"
+#include "mojo/edk/embedder/platform_handle.h"
#include "mojo/edk/embedder/platform_handle_vector.h"
+#include "mojo/edk/system/connection_manager_messages.h"
#include "mojo/edk/system/message_in_transit.h"
#include "mojo/edk/system/raw_channel.h"
#include "mojo/edk/system/transport_data.h"
@@ -59,7 +61,8 @@ MessageInTransit::Subtype ConnectionManagerResultToMessageInTransitSubtype(
// |MasterConnectionManager::Helper| is not thread-safe, and must only be used
// on its |owner_|'s private thread.
-class MasterConnectionManager::Helper final : public RawChannel::Delegate {
+class MOJO_SYSTEM_IMPL_EXPORT MasterConnectionManager::Helper final
+ : public RawChannel::Delegate {
public:
Helper(MasterConnectionManager* owner,
ProcessIdentifier process_identifier,
@@ -141,7 +144,9 @@ void MasterConnectionManager::Helper::OnReadMessage(
const ConnectionIdentifier* connection_id =
reinterpret_cast<const ConnectionIdentifier*>(message_view.bytes());
Result result = Result::FAILURE;
- ProcessIdentifier peer_process_identifier = kInvalidProcessIdentifier;
+ // Note: It's important to fully zero-initialize |data|, including padding,
+ // since it'll be sent to another process.
+ ConnectionManagerAckSuccessConnectData data = {};
embedder::ScopedPlatformHandle platform_handle;
uint32_t num_bytes = 0;
const void* bytes = nullptr;
@@ -158,17 +163,15 @@ void MasterConnectionManager::Helper::OnReadMessage(
break;
case MessageInTransit::Subtype::CONNECTION_MANAGER_CONNECT: {
result = owner_->ConnectImpl(process_identifier_, *connection_id,
- &peer_process_identifier, &platform_handle);
+ &data.peer_process_identifier,
+ &data.is_first, &platform_handle);
DCHECK_NE(result, Result::SUCCESS);
- // TODO(vtl): FIXME -- currently, nothing should generate
- // SUCCESS_CONNECT_REUSE_CONNECTION.
- CHECK_NE(result, Result::SUCCESS_CONNECT_REUSE_CONNECTION);
// Success acks for "connect" have the peer process identifier as data
// (and also a platform handle in the case of "new connection" -- handled
// further below).
if (result != Result::FAILURE) {
- num_bytes = static_cast<uint32_t>(sizeof(peer_process_identifier));
- bytes = &peer_process_identifier;
+ num_bytes = static_cast<uint32_t>(sizeof(data));
+ bytes = &data;
}
break;
}
@@ -216,9 +219,9 @@ void MasterConnectionManager::Helper::FatalError() {
owner_->OnError(process_identifier_); // WARNING: This destroys us.
}
-// MasterConnectionManager::PendingConnectionInfo ------------------------------
+// MasterConnectionManager::PendingConnectInfo ---------------------------------
-struct MasterConnectionManager::PendingConnectionInfo {
+struct MOJO_SYSTEM_IMPL_EXPORT MasterConnectionManager::PendingConnectInfo {
// States:
// - This is created upon a first "allow connect" (with |first| set
// immediately). We then wait for a second "allow connect".
@@ -229,28 +232,86 @@ struct MasterConnectionManager::PendingConnectionInfo {
// I.e., the valid state transitions are:
// AWAITING_SECOND_ALLOW_CONNECT -> AWAITING_CONNECTS_FROM_BOTH
// -> {AWAITING_CONNECT_FROM_FIRST,AWAITING_CONNECT_FROM_SECOND}
- enum State {
+ enum class State {
AWAITING_SECOND_ALLOW_CONNECT,
AWAITING_CONNECTS_FROM_BOTH,
AWAITING_CONNECT_FROM_FIRST,
AWAITING_CONNECT_FROM_SECOND
};
- explicit PendingConnectionInfo(ProcessIdentifier first)
- : state(AWAITING_SECOND_ALLOW_CONNECT),
+ explicit PendingConnectInfo(ProcessIdentifier first)
+ : state(State::AWAITING_SECOND_ALLOW_CONNECT),
first(first),
second(kInvalidProcessIdentifier) {
DCHECK_NE(first, kInvalidProcessIdentifier);
}
- ~PendingConnectionInfo() {}
+ ~PendingConnectInfo() {}
State state;
ProcessIdentifier first;
ProcessIdentifier second;
+};
+
+// MasterConnectionManager::ProcessConnections ---------------------------------
+
+class MasterConnectionManager::ProcessConnections {
+ public:
+ enum class ConnectionStatus { NONE, PENDING, RUNNING };
+
+ ProcessConnections() {}
+ ~ProcessConnections() {
+ // TODO(vtl): Log a warning if there are connections pending? (This might be
+ // very spammy, since the |MasterConnectionManager| may have many
+ // |ProcessConnections|.
+ for (auto& p : process_connections_)
+ p.second.CloseIfNecessary();
+ }
+
+ // If |pending_platform_handle| is non-null and the status is |PENDING| this
+ // will "return"/pass the stored pending platform handle. Warning: In that
+ // case, this has the side effect of changing the state to |RUNNING|.
+ ConnectionStatus GetConnectionStatus(
+ ProcessIdentifier to_process_identifier,
+ embedder::ScopedPlatformHandle* pending_platform_handle) {
+ DCHECK(!pending_platform_handle || !pending_platform_handle->is_valid());
+
+ auto it = process_connections_.find(to_process_identifier);
+ if (it == process_connections_.end())
+ return ConnectionStatus::NONE;
+ if (!it->second.is_valid())
+ return ConnectionStatus::RUNNING;
+ // Pending:
+ if (pending_platform_handle) {
+ pending_platform_handle->reset(it->second);
+ it->second = embedder::PlatformHandle();
+ }
+ return ConnectionStatus::PENDING;
+ }
+
+ void AddConnection(ProcessIdentifier to_process_identifier,
+ ConnectionStatus status,
+ embedder::ScopedPlatformHandle pending_platform_handle) {
+ DCHECK(process_connections_.find(to_process_identifier) ==
+ process_connections_.end());
+
+ if (status == ConnectionStatus::RUNNING) {
+ DCHECK(!pending_platform_handle.is_valid());
+ process_connections_[to_process_identifier] = embedder::PlatformHandle();
+ } else if (status == ConnectionStatus::PENDING) {
+ DCHECK(pending_platform_handle.is_valid());
+ process_connections_[to_process_identifier] =
+ pending_platform_handle.release();
+ } else {
+ NOTREACHED();
+ }
+ }
- // Valid in AWAITING_CONNECT_FROM_{FIRST, SECOND} states.
- embedder::ScopedPlatformHandle remaining_handle;
+ private:
+ base::hash_map<ProcessIdentifier, embedder::PlatformHandle>
+ process_connections_; // "Owns" any valid platform handles.
+
+ MOJO_DISALLOW_COPY_AND_ASSIGN(ProcessConnections);
};
// MasterConnectionManager -----------------------------------------------------
@@ -261,6 +322,7 @@ MasterConnectionManager::MasterConnectionManager(
master_process_delegate_(),
private_thread_("MasterConnectionManagerPrivateThread"),
next_process_identifier_(kFirstSlaveProcessIdentifier) {
+ connections_[kMasterProcessIdentifier] = new ProcessConnections();
}
MasterConnectionManager::~MasterConnectionManager() {
@@ -268,7 +330,7 @@ MasterConnectionManager::~MasterConnectionManager() {
DCHECK(!master_process_delegate_);
DCHECK(!private_thread_.message_loop());
DCHECK(helpers_.empty());
- DCHECK(pending_connections_.empty());
+ DCHECK(pending_connects_.empty());
}
void MasterConnectionManager::Init(
@@ -299,6 +361,8 @@ ProcessIdentifier MasterConnectionManager::AddSlave(
CHECK_NE(next_process_identifier_, kMasterProcessIdentifier);
slave_process_identifier = next_process_identifier_;
next_process_identifier_++;
+ DCHECK(connections_.find(slave_process_identifier) == connections_.end());
+ connections_[slave_process_identifier] = new ProcessConnections();
}
// We have to wait for the task to be executed, in case someone calls
@@ -323,13 +387,11 @@ ProcessIdentifier MasterConnectionManager::AddSlaveAndBootstrap(
AddSlave(slave_info, platform_handle.Pass());
MutexLocker locker(&mutex_);
- DCHECK(pending_connections_.find(connection_id) ==
- pending_connections_.end());
- PendingConnectionInfo* info =
- new PendingConnectionInfo(kMasterProcessIdentifier);
- info->state = PendingConnectionInfo::AWAITING_CONNECTS_FROM_BOTH;
+ DCHECK(pending_connects_.find(connection_id) == pending_connects_.end());
+ PendingConnectInfo* info = new PendingConnectInfo(kMasterProcessIdentifier);
+ info->state = PendingConnectInfo::State::AWAITING_CONNECTS_FROM_BOTH;
info->second = slave_process_identifier;
- pending_connections_[connection_id] = info;
+ pending_connects_[connection_id] = info;
return slave_process_identifier;
}
@@ -345,7 +407,7 @@ void MasterConnectionManager::Shutdown() {
base::Unretained(this)));
private_thread_.Stop();
DCHECK(helpers_.empty());
- DCHECK(pending_connections_.empty());
+ DCHECK(pending_connects_.empty());
master_process_delegate_ = nullptr;
delegate_thread_task_runner_ = nullptr;
}
@@ -365,9 +427,10 @@ bool MasterConnectionManager::CancelConnect(
ConnectionManager::Result MasterConnectionManager::Connect(
const ConnectionIdentifier& connection_id,
ProcessIdentifier* peer_process_identifier,
+ bool* is_first,
embedder::ScopedPlatformHandle* platform_handle) {
return ConnectImpl(kMasterProcessIdentifier, connection_id,
- peer_process_identifier, platform_handle);
+ peer_process_identifier, is_first, platform_handle);
}
bool MasterConnectionManager::AllowConnectImpl(
@@ -377,10 +440,10 @@ bool MasterConnectionManager::AllowConnectImpl(
MutexLocker locker(&mutex_);
- auto it = pending_connections_.find(connection_id);
- if (it == pending_connections_.end()) {
- pending_connections_[connection_id] =
- new PendingConnectionInfo(process_identifier);
+ auto it = pending_connects_.find(connection_id);
+ if (it == pending_connects_.end()) {
+ pending_connects_[connection_id] =
+ new PendingConnectInfo(process_identifier);
// TODO(vtl): Track process identifier -> pending connections also (so these
// can be removed efficiently if that process disconnects).
DVLOG(1) << "New pending connection ID " << connection_id.ToString()
@@ -389,9 +452,9 @@ bool MasterConnectionManager::AllowConnectImpl(
return true;
}
- PendingConnectionInfo* info = it->second;
- if (info->state == PendingConnectionInfo::AWAITING_SECOND_ALLOW_CONNECT) {
- info->state = PendingConnectionInfo::AWAITING_CONNECTS_FROM_BOTH;
+ PendingConnectInfo* info = it->second;
+ if (info->state == PendingConnectInfo::State::AWAITING_SECOND_ALLOW_CONNECT) {
+ info->state = PendingConnectInfo::State::AWAITING_CONNECTS_FROM_BOTH;
info->second = process_identifier;
DVLOG(1) << "Pending connection ID " << connection_id.ToString()
<< ": AllowConnect() from second process identifier "
@@ -403,8 +466,8 @@ bool MasterConnectionManager::AllowConnectImpl(
// caller).
LOG(ERROR) << "AllowConnect() from process " << process_identifier
<< " for connection ID " << connection_id.ToString()
- << " already in state " << info->state;
- pending_connections_.erase(it);
+ << " already in state " << static_cast<int>(info->state);
+ pending_connects_.erase(it);
delete info;
return false;
}
@@ -416,8 +479,8 @@ bool MasterConnectionManager::CancelConnectImpl(
MutexLocker locker(&mutex_);
- auto it = pending_connections_.find(connection_id);
- if (it == pending_connections_.end()) {
+ auto it = pending_connects_.find(connection_id);
+ if (it == pending_connects_.end()) {
// Not necessarily the caller's fault, and not necessarily an error.
DVLOG(1) << "CancelConnect() from process " << process_identifier
<< " for connection ID " << connection_id.ToString()
@@ -425,7 +488,7 @@ bool MasterConnectionManager::CancelConnectImpl(
return true;
}
- PendingConnectionInfo* info = it->second;
+ PendingConnectInfo* info = it->second;
if (process_identifier != info->first && process_identifier != info->second) {
LOG(ERROR) << "CancelConnect() from process " << process_identifier
<< " for connection ID " << connection_id.ToString()
@@ -436,7 +499,7 @@ bool MasterConnectionManager::CancelConnectImpl(
// Just erase it. The other side may also try to cancel, in which case it'll
// "fail" in the first if statement above (we assume that connection IDs never
// collide, so there's no need to carefully track both sides).
- pending_connections_.erase(it);
+ pending_connects_.erase(it);
delete info;
return true;
}
@@ -445,16 +508,18 @@ ConnectionManager::Result MasterConnectionManager::ConnectImpl(
ProcessIdentifier process_identifier,
const ConnectionIdentifier& connection_id,
ProcessIdentifier* peer_process_identifier,
+ bool* is_first,
embedder::ScopedPlatformHandle* platform_handle) {
DCHECK_NE(process_identifier, kInvalidProcessIdentifier);
DCHECK(peer_process_identifier);
+ DCHECK(is_first);
DCHECK(platform_handle);
DCHECK(!platform_handle->is_valid()); // Not technically wrong, but unlikely.
MutexLocker locker(&mutex_);
- auto it = pending_connections_.find(connection_id);
- if (it == pending_connections_.end()) {
+ auto it = pending_connects_.find(connection_id);
+ if (it == pending_connects_.end()) {
// Not necessarily the caller's fault.
LOG(ERROR) << "Connect() from process " << process_identifier
<< " for connection ID " << connection_id.ToString()
@@ -462,16 +527,15 @@ ConnectionManager::Result MasterConnectionManager::ConnectImpl(
return Result::FAILURE;
}
- PendingConnectionInfo* info = it->second;
- if (info->state == PendingConnectionInfo::AWAITING_CONNECTS_FROM_BOTH) {
- DCHECK(!info->remaining_handle.is_valid());
-
+ PendingConnectInfo* info = it->second;
+ ProcessIdentifier peer;
+ if (info->state == PendingConnectInfo::State::AWAITING_CONNECTS_FROM_BOTH) {
if (process_identifier == info->first) {
- info->state = PendingConnectionInfo::AWAITING_CONNECT_FROM_SECOND;
- *peer_process_identifier = info->second;
+ info->state = PendingConnectInfo::State::AWAITING_CONNECT_FROM_SECOND;
+ peer = info->second;
} else if (process_identifier == info->second) {
- info->state = PendingConnectionInfo::AWAITING_CONNECT_FROM_FIRST;
- *peer_process_identifier = info->first;
+ info->state = PendingConnectInfo::State::AWAITING_CONNECT_FROM_FIRST;
+ peer = info->first;
} else {
LOG(ERROR) << "Connect() from process " << process_identifier
<< " for connection ID " << connection_id.ToString()
@@ -479,33 +543,26 @@ ConnectionManager::Result MasterConnectionManager::ConnectImpl(
return Result::FAILURE;
}
- // TODO(vtl): FIXME -- add stuff for SUCCESS_CONNECT_REUSE_CONNECTION here.
- Result result = Result::FAILURE;
- if (info->first == info->second) {
- platform_handle->reset();
- DCHECK(!info->remaining_handle.is_valid());
- result = Result::SUCCESS_CONNECT_SAME_PROCESS;
- } else {
- embedder::PlatformChannelPair platform_channel_pair;
- *platform_handle = platform_channel_pair.PassServerHandle();
- DCHECK(platform_handle->is_valid());
- info->remaining_handle = platform_channel_pair.PassClientHandle();
- DCHECK(info->remaining_handle.is_valid());
- result = Result::SUCCESS_CONNECT_NEW_CONNECTION;
- }
DVLOG(1) << "Connection ID " << connection_id.ToString()
<< ": first Connect() from process identifier "
<< process_identifier;
- return result;
+ *peer_process_identifier = peer;
+ *is_first = true;
+ return ConnectImplHelperNoLock(process_identifier, peer, platform_handle);
}
+ // The remaining cases all result in |it| being removed from
+ // |pending_connects_| and deleting |info|.
+ pending_connects_.erase(it);
+ scoped_ptr<PendingConnectInfo> info_deleter(info);
+
+ // |remaining_connectee| should be the same as |process_identifier|.
ProcessIdentifier remaining_connectee;
- ProcessIdentifier peer;
- if (info->state == PendingConnectionInfo::AWAITING_CONNECT_FROM_FIRST) {
+ if (info->state == PendingConnectInfo::State::AWAITING_CONNECT_FROM_FIRST) {
remaining_connectee = info->first;
peer = info->second;
} else if (info->state ==
- PendingConnectionInfo::AWAITING_CONNECT_FROM_SECOND) {
+ PendingConnectInfo::State::AWAITING_CONNECT_FROM_SECOND) {
remaining_connectee = info->second;
peer = info->first;
} else {
@@ -513,9 +570,7 @@ ConnectionManager::Result MasterConnectionManager::ConnectImpl(
// caller).
LOG(ERROR) << "Connect() from process " << process_identifier
<< " for connection ID " << connection_id.ToString()
- << " in state " << info->state;
- pending_connections_.erase(it);
- delete info;
+ << " in state " << static_cast<int>(info->state);
return Result::FAILURE;
}
@@ -523,42 +578,80 @@ ConnectionManager::Result MasterConnectionManager::ConnectImpl(
LOG(ERROR) << "Connect() from process " << process_identifier
<< " for connection ID " << connection_id.ToString()
<< " which is not the remaining connectee";
- pending_connections_.erase(it);
- delete info;
return Result::FAILURE;
}
+ DVLOG(1) << "Connection ID " << connection_id.ToString()
+ << ": second Connect() from process identifier "
+ << process_identifier;
*peer_process_identifier = peer;
+ *is_first = false;
+ return ConnectImplHelperNoLock(process_identifier, peer, platform_handle);
+}
- // TODO(vtl): FIXME -- add stuff for SUCCESS_CONNECT_REUSE_CONNECTION here.
- Result result = Result::FAILURE;
- if (info->first == info->second) {
+ConnectionManager::Result MasterConnectionManager::ConnectImplHelperNoLock(
+ ProcessIdentifier process_identifier,
+ ProcessIdentifier peer_process_identifier,
+ embedder::ScopedPlatformHandle* platform_handle) {
+ if (process_identifier == peer_process_identifier) {
platform_handle->reset();
- DCHECK(!info->remaining_handle.is_valid());
- result = Result::SUCCESS_CONNECT_SAME_PROCESS;
- } else {
- *platform_handle = info->remaining_handle.Pass();
- DCHECK(platform_handle->is_valid());
- result = Result::SUCCESS_CONNECT_NEW_CONNECTION;
+ DVLOG(1) << "Connect: same process";
+ return Result::SUCCESS_CONNECT_SAME_PROCESS;
}
- pending_connections_.erase(it);
- delete info;
- DVLOG(1) << "Connection ID " << connection_id.ToString()
- << ": second Connect() from process identifier "
- << process_identifier;
- return result;
+
+ // We should know about the process identified by |process_identifier|.
+ DCHECK(connections_.find(process_identifier) != connections_.end());
+ ProcessConnections* process_connections = connections_[process_identifier];
+ // We should also know about the peer.
+ DCHECK(connections_.find(peer_process_identifier) != connections_.end());
+ switch (process_connections->GetConnectionStatus(peer_process_identifier,
+ platform_handle)) {
+ case ProcessConnections::ConnectionStatus::NONE: {
+ // TODO(vtl): In the "second connect" case, this should never be reached
+ // (but it's not easy to DCHECK this invariant here).
+ process_connections->AddConnection(
+ peer_process_identifier,
+ ProcessConnections::ConnectionStatus::RUNNING,
+ embedder::ScopedPlatformHandle());
+ embedder::PlatformChannelPair platform_channel_pair;
+ *platform_handle = platform_channel_pair.PassServerHandle();
+
+ connections_[peer_process_identifier]->AddConnection(
+ process_identifier, ProcessConnections::ConnectionStatus::PENDING,
+ platform_channel_pair.PassClientHandle());
+ break;
+ }
+ case ProcessConnections::ConnectionStatus::PENDING:
+ DCHECK(connections_[peer_process_identifier]->GetConnectionStatus(
+ process_identifier, nullptr) ==
+ ProcessConnections::ConnectionStatus::RUNNING);
+ break;
+ case ProcessConnections::ConnectionStatus::RUNNING:
+ // |process_identifier| already has a connection to
+ // |peer_process_identifier|, so it should reuse that.
+ platform_handle->reset();
+ DVLOG(1) << "Connect: reuse connection";
+ return Result::SUCCESS_CONNECT_REUSE_CONNECTION;
+ }
+ DCHECK(platform_handle->is_valid());
+ DVLOG(1) << "Connect: new connection";
+ return Result::SUCCESS_CONNECT_NEW_CONNECTION;
}
void MasterConnectionManager::ShutdownOnPrivateThread() {
AssertOnPrivateThread();
- if (!pending_connections_.empty()) {
+ if (!pending_connects_.empty()) {
DVLOG(1) << "Shutting down with connections pending";
- for (auto& p : pending_connections_)
+ for (auto& p : pending_connects_)
delete p.second;
- pending_connections_.clear();
+ pending_connects_.clear();
}
+ for (auto& p : connections_)
+ delete p.second;
+ connections_.clear();
+
if (!helpers_.empty()) {
DVLOG(1) << "Shutting down with slaves still connected";
for (auto& p : helpers_) {
@@ -605,14 +698,13 @@ void MasterConnectionManager::OnError(ProcessIdentifier process_identifier) {
MutexLocker locker(&mutex_);
// TODO(vtl): This isn't very efficient.
- for (auto it = pending_connections_.begin();
- it != pending_connections_.end();) {
+ for (auto it = pending_connects_.begin(); it != pending_connects_.end();) {
if (it->second->first == process_identifier ||
it->second->second == process_identifier) {
auto it_to_erase = it;
++it;
delete it_to_erase->second;
- pending_connections_.erase(it_to_erase);
+ pending_connects_.erase(it_to_erase);
} else {
++it;
}
diff --git a/third_party/mojo/src/mojo/edk/system/master_connection_manager.h b/third_party/mojo/src/mojo/edk/system/master_connection_manager.h
index 497f449..ee702a8 100644
--- a/third_party/mojo/src/mojo/edk/system/master_connection_manager.h
+++ b/third_party/mojo/src/mojo/edk/system/master_connection_manager.h
@@ -81,6 +81,7 @@ class MOJO_SYSTEM_IMPL_EXPORT MasterConnectionManager final
bool CancelConnect(const ConnectionIdentifier& connection_id) override;
Result Connect(const ConnectionIdentifier& connection_id,
ProcessIdentifier* peer_process_identifier,
+ bool* is_first,
embedder::ScopedPlatformHandle* platform_handle) override;
private:
@@ -95,8 +96,19 @@ class MOJO_SYSTEM_IMPL_EXPORT MasterConnectionManager final
Result ConnectImpl(ProcessIdentifier process_identifier,
const ConnectionIdentifier& connection_id,
ProcessIdentifier* peer_process_identifier,
+ bool* is_first,
embedder::ScopedPlatformHandle* platform_handle);
+ // Helper for |ConnectImpl()|. This is called when the two process identifiers
+ // are known (and known to be valid), and all that remains is to determine the
+ // |Result| and provide a platform handle if appropriate. (This will never
+ // return |Result::FAILURE|.)
+ Result ConnectImplHelperNoLock(
+ ProcessIdentifier process_identifier,
+ ProcessIdentifier peer_process_identifier,
+ embedder::ScopedPlatformHandle* platform_handle)
+ MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
+
// These should only be called on |private_thread_|:
void ShutdownOnPrivateThread() MOJO_NOT_THREAD_SAFE;
// Signals |*event| on completion.
@@ -139,9 +151,23 @@ class MOJO_SYSTEM_IMPL_EXPORT MasterConnectionManager final
ProcessIdentifier next_process_identifier_ MOJO_GUARDED_BY(mutex_);
- struct PendingConnectionInfo;
- base::hash_map<ConnectionIdentifier, PendingConnectionInfo*>
- pending_connections_ MOJO_GUARDED_BY(mutex_); // Owns its values.
+ // Stores information on pending calls to |AllowConnect()|/|Connect()| (or
+ // |CancelConnect()|, namely those for which at least one party has called
+ // |AllowConnect()| but both have not yet called |Connect()| (or
+ // |CancelConnect()|).
+ struct PendingConnectInfo;
+ base::hash_map<ConnectionIdentifier, PendingConnectInfo*> pending_connects_
+ MOJO_GUARDED_BY(mutex_); // Owns its values.
+
+ // A |ProcessConnections| stores information about connections "from" a given
+ // (fixed, implied) process "to" other processes. A connection may be not
+ // present, running (meaning that both sides have connected and been given
+ // platform handles to a connected "pipe"), or pending (meaning that the
+ // "from" side must still be given a platform handle).
+ class ProcessConnections;
+ // This is a map from "from" processes to its |ProcessConnections| (above).
+ base::hash_map<ProcessIdentifier, ProcessConnections*> connections_
+ MOJO_GUARDED_BY(mutex_); // Owns its values.
MOJO_DISALLOW_COPY_AND_ASSIGN(MasterConnectionManager);
};
diff --git a/third_party/mojo/src/mojo/edk/system/message_in_transit.h b/third_party/mojo/src/mojo/edk/system/message_in_transit.h
index c61cfd6..2edc776 100644
--- a/third_party/mojo/src/mojo/edk/system/message_in_transit.h
+++ b/third_party/mojo/src/mojo/edk/system/message_in_transit.h
@@ -83,10 +83,8 @@ class MOJO_SYSTEM_IMPL_EXPORT MessageInTransit {
// Subtypes for type |Type::CONNECTION_MANAGER_ACK|, corresponding to
// |ConnectionManager::Result| values (failure and non-"connect" acks never
// have any message contents; success acks for "connect" always have a
- // |ProcessIdentifier| as data and also a platform handle attached for "new
- // connection"):
- // TODO(vtl): FIXME -- probably, in the "connect, reuse connection" case,
- // we'll have to send more information.
+ // |ConnectionManagerAckSuccessConnectData| as data and also a platform
+ // handle attached for "new connection"):
CONNECTION_MANAGER_ACK_FAILURE = 0,
CONNECTION_MANAGER_ACK_SUCCESS = 1,
CONNECTION_MANAGER_ACK_SUCCESS_CONNECT_SAME_PROCESS = 2,
diff --git a/third_party/mojo/src/mojo/edk/system/remote_producer_data_pipe_impl.cc b/third_party/mojo/src/mojo/edk/system/remote_producer_data_pipe_impl.cc
index 8d7fa26..5e49106 100644
--- a/third_party/mojo/src/mojo/edk/system/remote_producer_data_pipe_impl.cc
+++ b/third_party/mojo/src/mojo/edk/system/remote_producer_data_pipe_impl.cc
@@ -348,15 +348,20 @@ bool RemoteProducerDataPipeImpl::ConsumerEndSerialize(
bool RemoteProducerDataPipeImpl::OnReadMessage(unsigned /*port*/,
MessageInTransit* message) {
- // Always take ownership of the message. (This means that we should always
- // return true.)
- scoped_ptr<MessageInTransit> msg(message);
-
if (!producer_open()) {
+ // This will happen only on the rare occasion that the call to
+ // |OnReadMessage()| is racing with us calling
+ // |ChannelEndpoint::ReplaceClient()|, in which case we reject the message,
+ // and the |ChannelEndpoint| can retry (calling the new client's
+ // |OnReadMessage()|).
DCHECK(!channel_endpoint_);
- return true;
+ return false;
}
+ // Otherwise, we take ownership of the message. (This means that we should
+ // always return true below.)
+ scoped_ptr<MessageInTransit> msg(message);
+
if (!ValidateIncomingMessage(element_num_bytes(), capacity_num_bytes(),
current_num_bytes_, msg.get())) {
Disconnect();
diff --git a/third_party/mojo/src/mojo/edk/system/slave_connection_manager.cc b/third_party/mojo/src/mojo/edk/system/slave_connection_manager.cc
index 7d0a998..1d9d590 100644
--- a/third_party/mojo/src/mojo/edk/system/slave_connection_manager.cc
+++ b/third_party/mojo/src/mojo/edk/system/slave_connection_manager.cc
@@ -9,6 +9,7 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
+#include "mojo/edk/system/connection_manager_messages.h"
#include "mojo/edk/system/message_in_transit.h"
namespace mojo {
@@ -24,6 +25,7 @@ SlaveConnectionManager::SlaveConnectionManager(
awaiting_ack_type_(NOT_AWAITING_ACK),
ack_result_(nullptr),
ack_peer_process_identifier_(nullptr),
+ ack_is_first_(nullptr),
ack_platform_handle_(nullptr),
event_(false, false) { // Auto-reset, not initially signalled.
}
@@ -35,6 +37,7 @@ SlaveConnectionManager::~SlaveConnectionManager() {
DCHECK_EQ(awaiting_ack_type_, NOT_AWAITING_ACK);
DCHECK(!ack_result_);
DCHECK(!ack_peer_process_identifier_);
+ DCHECK(!ack_is_first_);
DCHECK(!ack_platform_handle_);
}
@@ -107,15 +110,21 @@ bool SlaveConnectionManager::CancelConnect(
ConnectionManager::Result SlaveConnectionManager::Connect(
const ConnectionIdentifier& connection_id,
ProcessIdentifier* peer_process_identifier,
+ bool* is_first,
embedder::ScopedPlatformHandle* platform_handle) {
AssertNotOnPrivateThread();
+ DCHECK(peer_process_identifier);
+ DCHECK(is_first);
+ DCHECK(platform_handle);
+ DCHECK(!platform_handle->is_valid()); // Not technically wrong, but unlikely.
MutexLocker locker(&mutex_);
Result result = Result::FAILURE;
private_thread_.message_loop()->PostTask(
- FROM_HERE, base::Bind(&SlaveConnectionManager::ConnectOnPrivateThread,
- base::Unretained(this), connection_id, &result,
- peer_process_identifier, platform_handle));
+ FROM_HERE,
+ base::Bind(&SlaveConnectionManager::ConnectOnPrivateThread,
+ base::Unretained(this), connection_id, &result,
+ peer_process_identifier, is_first, platform_handle));
event_.Wait();
return result;
}
@@ -193,10 +202,9 @@ void SlaveConnectionManager::ConnectOnPrivateThread(
const ConnectionIdentifier& connection_id,
Result* result,
ProcessIdentifier* peer_process_identifier,
+ bool* is_first,
embedder::ScopedPlatformHandle* platform_handle) {
DCHECK(result);
- DCHECK(platform_handle);
- DCHECK(!platform_handle->is_valid()); // Not technically wrong, but unlikely.
AssertOnPrivateThread();
// This should only posted (from another thread, to |private_thread_|) with
// the lock held (until this thread triggers |event_|).
@@ -217,6 +225,7 @@ void SlaveConnectionManager::ConnectOnPrivateThread(
awaiting_ack_type_ = AWAITING_CONNECT_ACK;
ack_result_ = result;
ack_peer_process_identifier_ = peer_process_identifier;
+ ack_is_first_ = is_first;
ack_platform_handle_ = platform_handle;
}
@@ -255,12 +264,17 @@ void SlaveConnectionManager::OnReadMessage(
DCHECK_EQ(num_platform_handles, 0u);
*ack_result_ = Result::SUCCESS;
DCHECK(!ack_peer_process_identifier_);
+ DCHECK(!ack_is_first_);
DCHECK(!ack_platform_handle_);
} else {
- // Success acks for "connect" always have a |ProcessIdentifier| as data.
- CHECK_EQ(num_bytes, sizeof(ProcessIdentifier));
- *ack_peer_process_identifier_ =
- *reinterpret_cast<const ProcessIdentifier*>(message_view.bytes());
+ // Success acks for "connect" always have a
+ // |ConnectionManagerAckSuccessConnectData| as data.
+ CHECK_EQ(num_bytes, sizeof(ConnectionManagerAckSuccessConnectData));
+ const ConnectionManagerAckSuccessConnectData& data =
+ *static_cast<const ConnectionManagerAckSuccessConnectData*>(
+ message_view.bytes());
+ *ack_peer_process_identifier_ = data.peer_process_identifier;
+ *ack_is_first_ = data.is_first;
switch (message_view.subtype()) {
case MessageInTransit::Subtype::
@@ -281,9 +295,6 @@ void SlaveConnectionManager::OnReadMessage(
DCHECK_EQ(num_platform_handles, 0u);
*ack_result_ = Result::SUCCESS_CONNECT_REUSE_CONNECTION;
ack_platform_handle_->reset();
- // TODO(vtl): FIXME -- currently, nothing should generate
- // SUCCESS_CONNECT_REUSE_CONNECTION.
- CHECK(false);
break;
default:
CHECK(false);
@@ -294,6 +305,7 @@ void SlaveConnectionManager::OnReadMessage(
awaiting_ack_type_ = NOT_AWAITING_ACK;
ack_result_ = nullptr;
ack_peer_process_identifier_ = nullptr;
+ ack_is_first_ = nullptr;
ack_platform_handle_ = nullptr;
event_.Signal();
}
diff --git a/third_party/mojo/src/mojo/edk/system/slave_connection_manager.h b/third_party/mojo/src/mojo/edk/system/slave_connection_manager.h
index b2cd92c..664c8dd 100644
--- a/third_party/mojo/src/mojo/edk/system/slave_connection_manager.h
+++ b/third_party/mojo/src/mojo/edk/system/slave_connection_manager.h
@@ -60,6 +60,7 @@ class MOJO_SYSTEM_IMPL_EXPORT SlaveConnectionManager final
bool CancelConnect(const ConnectionIdentifier& connection_id) override;
Result Connect(const ConnectionIdentifier& connection_id,
ProcessIdentifier* peer_process_identifier,
+ bool* is_first,
embedder::ScopedPlatformHandle* platform_handle) override;
private:
@@ -73,6 +74,7 @@ class MOJO_SYSTEM_IMPL_EXPORT SlaveConnectionManager final
void ConnectOnPrivateThread(const ConnectionIdentifier& connection_id,
Result* result,
ProcessIdentifier* peer_process_identifier,
+ bool* is_first,
embedder::ScopedPlatformHandle* platform_handle);
// |RawChannel::Delegate| methods (only called on |private_thread_|):
@@ -115,6 +117,7 @@ class MOJO_SYSTEM_IMPL_EXPORT SlaveConnectionManager final
Result* ack_result_;
// Used only when waiting for the ack to "connect":
ProcessIdentifier* ack_peer_process_identifier_;
+ bool* ack_is_first_;
embedder::ScopedPlatformHandle* ack_platform_handle_;
// The (synchronous) |ConnectionManager| methods are implemented in the
diff --git a/third_party/mojo/src/mojo/public/VERSION b/third_party/mojo/src/mojo/public/VERSION
index cb44eda..54cb357 100644
--- a/third_party/mojo/src/mojo/public/VERSION
+++ b/third_party/mojo/src/mojo/public/VERSION
@@ -1 +1 @@
-c02a28868825edfa57ab77947b8cb15e741c5598 \ No newline at end of file
+cbf8d2ee9b7d07c7751d8d861f3b7e2bd9829b05 \ No newline at end of file
diff --git a/third_party/mojo/src/mojo/public/c/gles2/BUILD.gn b/third_party/mojo/src/mojo/public/c/gles2/BUILD.gn
index 544368d..7581721 100644
--- a/third_party/mojo/src/mojo/public/c/gles2/BUILD.gn
+++ b/third_party/mojo/src/mojo/public/c/gles2/BUILD.gn
@@ -20,26 +20,33 @@ group("gles2") {
mojo_sdk_source_set("headers") {
sources = [
+ "chromium_bind_uniform_location.h",
"chromium_copy_texture.h",
"chromium_image.h",
"chromium_miscellaneous.h",
"chromium_pixel_transfer_buffer_object.h",
+ "chromium_resize.h",
"chromium_sub_image.h",
"chromium_sync_point.h",
"chromium_texture_mailbox.h",
+ "ext_debug_marker.h",
"gles2.h",
"gles2_call_visitor_autogen.h",
"gles2_call_visitor_chromium_copy_texture_autogen.h",
"gles2_call_visitor_chromium_image_autogen.h",
"gles2_call_visitor_chromium_miscellaneous_autogen.h",
"gles2_call_visitor_chromium_pixel_transfer_buffer_object_autogen.h",
+ "gles2_call_visitor_chromium_resize_autogen.h",
"gles2_call_visitor_chromium_sub_image_autogen.h",
"gles2_call_visitor_chromium_sync_point_autogen.h",
"gles2_call_visitor_chromium_texture_mailbox_autogen.h",
+ "gles2_call_visitor_ext_debug_marker_autogen.h",
"gles2_call_visitor_occlusion_query_ext_autogen.h",
+ "gles2_call_visitor_oes_vertex_array_object_autogen.h",
"gles2_export.h",
"gles2_types.h",
"occlusion_query_ext.h",
+ "oes_vertex_array_object.h",
]
public_configs = [ ":gles2_config" ]
diff --git a/third_party/mojo/src/mojo/public/c/gles2/chromium_bind_uniform_location.h b/third_party/mojo/src/mojo/public/c/gles2/chromium_bind_uniform_location.h
new file mode 100644
index 0000000..6886a5c
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/c/gles2/chromium_bind_uniform_location.h
@@ -0,0 +1,30 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_PUBLIC_C_GLES2_CHROMIUM_COPY_TEXTURE_H_
+#define MOJO_PUBLIC_C_GLES2_CHROMIUM_COPY_TEXTURE_H_
+
+// Note: This header should be compilable as C.
+
+#include <stdint.h>
+#include <GLES2/gl2.h>
+
+#include "mojo/public/c/gles2/gles2_export.h"
+#include "mojo/public/c/gles2/gles2_types.h"
+#include "mojo/public/c/system/types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \
+ MOJO_GLES2_EXPORT ReturnType GL_APIENTRY gl##Function PARAMETERS;
+#include "mojo/public/c/gles2/gles2_call_visitor_chromium_bind_uniform_location_autogen.h"
+#undef VISIT_GL_CALL
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // MOJO_PUBLIC_C_GLES2_CHROMIUM_COPY_TEXTURE_H_
diff --git a/third_party/mojo/src/mojo/public/c/gles2/chromium_resize.h b/third_party/mojo/src/mojo/public/c/gles2/chromium_resize.h
new file mode 100644
index 0000000..c8b1186
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/c/gles2/chromium_resize.h
@@ -0,0 +1,29 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_PUBLIC_C_GLES2_CHROMIUM_RESIZE_H_
+#define MOJO_PUBLIC_C_GLES2_CHROMIUM_RESIZE_H_
+
+// Note: This header should be compilable as C.
+
+#include <stdint.h>
+#include <GLES2/gl2.h>
+
+#include "mojo/public/c/gles2/gles2_export.h"
+#include "mojo/public/c/gles2/gles2_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \
+ MOJO_GLES2_EXPORT ReturnType GL_APIENTRY gl##Function PARAMETERS;
+#include "mojo/public/c/gles2/gles2_call_visitor_chromium_resize_autogen.h"
+#undef VISIT_GL_CALL
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // MOJO_PUBLIC_C_GLES2_CHROMIUM_RESIZE_H_
diff --git a/third_party/mojo/src/mojo/public/c/gles2/ext_debug_marker.h b/third_party/mojo/src/mojo/public/c/gles2/ext_debug_marker.h
new file mode 100644
index 0000000..c108328
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/c/gles2/ext_debug_marker.h
@@ -0,0 +1,29 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_PUBLIC_C_GLES2_EXT_DEBUG_MARKER_H_
+#define MOJO_PUBLIC_C_GLES2_EXT_DEBUG_MARKER_H_
+
+// Note: This header should be compilable as C.
+
+#include <stdint.h>
+#include <GLES2/gl2.h>
+
+#include "mojo/public/c/gles2/gles2_export.h"
+#include "mojo/public/c/gles2/gles2_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \
+ MOJO_GLES2_EXPORT ReturnType GL_APIENTRY gl##Function PARAMETERS;
+#include "mojo/public/c/gles2/gles2_call_visitor_ext_debug_marker_autogen.h"
+#undef VISIT_GL_CALL
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // MOJO_PUBLIC_C_GLES2_EXT_DEBUG_MARKER_H_
diff --git a/third_party/mojo/src/mojo/public/c/gles2/gles2.h b/third_party/mojo/src/mojo/public/c/gles2/gles2.h
index c2d43ec..d8afef6 100644
--- a/third_party/mojo/src/mojo/public/c/gles2/gles2.h
+++ b/third_party/mojo/src/mojo/public/c/gles2/gles2.h
@@ -33,10 +33,9 @@ MOJO_GLES2_EXPORT void MojoGLES2SignalSyncPoint(
MojoGLES2SignalSyncPointCallback callback,
void* closure);
-// TODO(piman): We shouldn't have to leak those 2 interfaces, especially in a
+// TODO(piman): We shouldn't have to leak this interface, especially in a
// type-unsafe way.
MOJO_GLES2_EXPORT void* MojoGLES2GetGLES2Interface(MojoGLES2Context context);
-MOJO_GLES2_EXPORT void* MojoGLES2GetContextSupport(MojoGLES2Context context);
#define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \
MOJO_GLES2_EXPORT ReturnType GL_APIENTRY gl##Function PARAMETERS;
diff --git a/third_party/mojo/src/mojo/public/c/gles2/gles2_call_visitor_chromium_bind_uniform_location_autogen.h b/third_party/mojo/src/mojo/public/c/gles2/gles2_call_visitor_chromium_bind_uniform_location_autogen.h
new file mode 100644
index 0000000..b838970
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/c/gles2/gles2_call_visitor_chromium_bind_uniform_location_autogen.h
@@ -0,0 +1,14 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file is auto-generated from
+// gpu/command_buffer/build_gles2_cmd_buffer.py
+// It's formatted by clang-format using chromium coding style:
+// clang-format -i -style=chromium filename
+// DO NOT EDIT!
+
+VISIT_GL_CALL(BindUniformLocationCHROMIUM,
+ void,
+ (GLuint program, GLint location, const char* name),
+ (program, location, name))
diff --git a/third_party/mojo/src/mojo/public/c/gles2/gles2_call_visitor_chromium_resize_autogen.h b/third_party/mojo/src/mojo/public/c/gles2/gles2_call_visitor_chromium_resize_autogen.h
new file mode 100644
index 0000000..be4d6da
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/c/gles2/gles2_call_visitor_chromium_resize_autogen.h
@@ -0,0 +1,14 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file is auto-generated from
+// gpu/command_buffer/build_gles2_cmd_buffer.py
+// It's formatted by clang-format using chromium coding style:
+// clang-format -i -style=chromium filename
+// DO NOT EDIT!
+
+VISIT_GL_CALL(ResizeCHROMIUM,
+ void,
+ (GLuint width, GLuint height, GLfloat scale_factor),
+ (width, height, scale_factor))
diff --git a/third_party/mojo/src/mojo/public/c/gles2/gles2_call_visitor_ext_debug_marker_autogen.h b/third_party/mojo/src/mojo/public/c/gles2/gles2_call_visitor_ext_debug_marker_autogen.h
new file mode 100644
index 0000000..fe1741a
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/c/gles2/gles2_call_visitor_ext_debug_marker_autogen.h
@@ -0,0 +1,19 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file is auto-generated from
+// gpu/command_buffer/build_gles2_cmd_buffer.py
+// It's formatted by clang-format using chromium coding style:
+// clang-format -i -style=chromium filename
+// DO NOT EDIT!
+
+VISIT_GL_CALL(InsertEventMarkerEXT,
+ void,
+ (GLsizei length, const GLchar* marker),
+ (length, marker))
+VISIT_GL_CALL(PushGroupMarkerEXT,
+ void,
+ (GLsizei length, const GLchar* marker),
+ (length, marker))
+VISIT_GL_CALL(PopGroupMarkerEXT, void, (), ())
diff --git a/third_party/mojo/src/mojo/public/c/gles2/gles2_call_visitor_oes_vertex_array_object_autogen.h b/third_party/mojo/src/mojo/public/c/gles2/gles2_call_visitor_oes_vertex_array_object_autogen.h
new file mode 100644
index 0000000..bc6f9b5
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/c/gles2/gles2_call_visitor_oes_vertex_array_object_autogen.h
@@ -0,0 +1,20 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file is auto-generated from
+// gpu/command_buffer/build_gles2_cmd_buffer.py
+// It's formatted by clang-format using chromium coding style:
+// clang-format -i -style=chromium filename
+// DO NOT EDIT!
+
+VISIT_GL_CALL(GenVertexArraysOES,
+ void,
+ (GLsizei n, GLuint* arrays),
+ (n, arrays))
+VISIT_GL_CALL(DeleteVertexArraysOES,
+ void,
+ (GLsizei n, const GLuint* arrays),
+ (n, arrays))
+VISIT_GL_CALL(IsVertexArrayOES, GLboolean, (GLuint array), (array))
+VISIT_GL_CALL(BindVertexArrayOES, void, (GLuint array), (array))
diff --git a/third_party/mojo/src/mojo/public/c/gles2/occlusion_query_ext.h b/third_party/mojo/src/mojo/public/c/gles2/occlusion_query_ext.h
index 5922077..5be7845 100644
--- a/third_party/mojo/src/mojo/public/c/gles2/occlusion_query_ext.h
+++ b/third_party/mojo/src/mojo/public/c/gles2/occlusion_query_ext.h
@@ -12,7 +12,6 @@
#include "mojo/public/c/gles2/gles2_export.h"
#include "mojo/public/c/gles2/gles2_types.h"
-#include "mojo/public/c/system/types.h"
#ifdef __cplusplus
extern "C" {
diff --git a/third_party/mojo/src/mojo/public/c/gles2/oes_vertex_array_object.h b/third_party/mojo/src/mojo/public/c/gles2/oes_vertex_array_object.h
new file mode 100644
index 0000000..76981c9
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/c/gles2/oes_vertex_array_object.h
@@ -0,0 +1,29 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_PUBLIC_C_GLES2_OES_VERTEX_ARRAY_OBJECT_H_
+#define MOJO_PUBLIC_C_GLES2_OES_VERTEX_ARRAY_OBJECT_H_
+
+// Note: This header should be compilable as C.
+
+#include <stdint.h>
+#include <GLES2/gl2.h>
+
+#include "mojo/public/c/gles2/gles2_export.h"
+#include "mojo/public/c/gles2/gles2_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \
+ MOJO_GLES2_EXPORT ReturnType GL_APIENTRY gl##Function PARAMETERS;
+#include "mojo/public/c/gles2/gles2_call_visitor_oes_vertex_array_object_autogen.h"
+#undef VISIT_GL_CALL
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // MOJO_PUBLIC_C_GLES2_OES_VERTEX_ARRAY_OBJECT_H_
diff --git a/third_party/mojo/src/mojo/public/c/gpu/BUILD.gn b/third_party/mojo/src/mojo/public/c/gpu/BUILD.gn
new file mode 100644
index 0000000..afab7a1
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/c/gpu/BUILD.gn
@@ -0,0 +1,69 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("../../mojo_sdk.gni")
+
+config("gpu_configs") {
+ include_dirs = [ "." ]
+ defines = [ "GLES2_USE_MOJO" ]
+}
+
+group("gpu") {
+ public_configs = [ ":gpu_configs" ]
+
+ deps = [
+ ":MGL",
+ ":GLES2",
+ "../../platform/native:mgl_thunks",
+ "../../platform/native:gles2",
+ ]
+}
+
+group("gpu_onscreen") {
+ public_deps = [
+ ":MGL_onscreen",
+ ]
+
+ deps = [
+ ":gpu",
+ "../../platform/native:mgl_onscreen_thunks",
+ ]
+}
+
+mojo_sdk_source_set("MGL") {
+ sources = [
+ "MGL/mgl.h",
+ "MGL/mgl_types.h",
+ ]
+
+ mojo_sdk_public_deps = [ "mojo/public/c/system" ]
+}
+
+mojo_sdk_source_set("MGL_onscreen") {
+ sources = [
+ "MGL/mgl_onscreen.h",
+ ]
+
+ public_deps = [
+ ":MGL",
+ ]
+}
+
+mojo_sdk_source_set("GLES2") {
+ sources = [
+ "GLES2/gl2.h",
+ "GLES2/gl2ext.h",
+ "GLES2/gl2mojo.h",
+ ]
+
+ public_deps = [
+ ":KHR",
+ ]
+}
+
+mojo_sdk_source_set("KHR") {
+ sources = [
+ "KHR/khrplatform.h",
+ ]
+}
diff --git a/third_party/mojo/src/mojo/public/c/gpu/GLES2/gl2.h b/third_party/mojo/src/mojo/public/c/gpu/GLES2/gl2.h
new file mode 100644
index 0000000..1bd43a9
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/c/gpu/GLES2/gl2.h
@@ -0,0 +1,526 @@
+#ifndef __gl2_h_
+#define __gl2_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2013-2014 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+** http://www.opengl.org/registry/
+**
+** Khronos $Revision: 28366 $ on $Date: 2014-10-20 11:29:02 +0200 (Mon, 20 Oct 2014) $
+*/
+
+#include <GLES2/gl2mojo.h>
+#include <GLES2/gl2platform.h>
+
+/* Generated on date 20141020 */
+
+/* Generated C header for:
+ * API: gles2
+ * Profile: common
+ * Versions considered: 2\.[0-9]
+ * Versions emitted: .*
+ * Default extensions included: None
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
+
+#ifndef GL_ES_VERSION_2_0
+#define GL_ES_VERSION_2_0 1
+#include <KHR/khrplatform.h>
+typedef khronos_int8_t GLbyte;
+typedef khronos_float_t GLclampf;
+typedef khronos_int32_t GLfixed;
+typedef short GLshort;
+typedef unsigned short GLushort;
+typedef void GLvoid;
+typedef struct __GLsync *GLsync;
+typedef khronos_int64_t GLint64;
+typedef khronos_uint64_t GLuint64;
+typedef unsigned int GLenum;
+typedef unsigned int GLuint;
+typedef char GLchar;
+typedef khronos_float_t GLfloat;
+typedef khronos_ssize_t GLsizeiptr;
+typedef khronos_intptr_t GLintptr;
+typedef unsigned int GLbitfield;
+typedef int GLint;
+typedef unsigned char GLboolean;
+typedef int GLsizei;
+typedef khronos_uint8_t GLubyte;
+#define GL_DEPTH_BUFFER_BIT 0x00000100
+#define GL_STENCIL_BUFFER_BIT 0x00000400
+#define GL_COLOR_BUFFER_BIT 0x00004000
+#define GL_FALSE 0
+#define GL_TRUE 1
+#define GL_POINTS 0x0000
+#define GL_LINES 0x0001
+#define GL_LINE_LOOP 0x0002
+#define GL_LINE_STRIP 0x0003
+#define GL_TRIANGLES 0x0004
+#define GL_TRIANGLE_STRIP 0x0005
+#define GL_TRIANGLE_FAN 0x0006
+#define GL_ZERO 0
+#define GL_ONE 1
+#define GL_SRC_COLOR 0x0300
+#define GL_ONE_MINUS_SRC_COLOR 0x0301
+#define GL_SRC_ALPHA 0x0302
+#define GL_ONE_MINUS_SRC_ALPHA 0x0303
+#define GL_DST_ALPHA 0x0304
+#define GL_ONE_MINUS_DST_ALPHA 0x0305
+#define GL_DST_COLOR 0x0306
+#define GL_ONE_MINUS_DST_COLOR 0x0307
+#define GL_SRC_ALPHA_SATURATE 0x0308
+#define GL_FUNC_ADD 0x8006
+#define GL_BLEND_EQUATION 0x8009
+#define GL_BLEND_EQUATION_RGB 0x8009
+#define GL_BLEND_EQUATION_ALPHA 0x883D
+#define GL_FUNC_SUBTRACT 0x800A
+#define GL_FUNC_REVERSE_SUBTRACT 0x800B
+#define GL_BLEND_DST_RGB 0x80C8
+#define GL_BLEND_SRC_RGB 0x80C9
+#define GL_BLEND_DST_ALPHA 0x80CA
+#define GL_BLEND_SRC_ALPHA 0x80CB
+#define GL_CONSTANT_COLOR 0x8001
+#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
+#define GL_CONSTANT_ALPHA 0x8003
+#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
+#define GL_BLEND_COLOR 0x8005
+#define GL_ARRAY_BUFFER 0x8892
+#define GL_ELEMENT_ARRAY_BUFFER 0x8893
+#define GL_ARRAY_BUFFER_BINDING 0x8894
+#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
+#define GL_STREAM_DRAW 0x88E0
+#define GL_STATIC_DRAW 0x88E4
+#define GL_DYNAMIC_DRAW 0x88E8
+#define GL_BUFFER_SIZE 0x8764
+#define GL_BUFFER_USAGE 0x8765
+#define GL_CURRENT_VERTEX_ATTRIB 0x8626
+#define GL_FRONT 0x0404
+#define GL_BACK 0x0405
+#define GL_FRONT_AND_BACK 0x0408
+#define GL_TEXTURE_2D 0x0DE1
+#define GL_CULL_FACE 0x0B44
+#define GL_BLEND 0x0BE2
+#define GL_DITHER 0x0BD0
+#define GL_STENCIL_TEST 0x0B90
+#define GL_DEPTH_TEST 0x0B71
+#define GL_SCISSOR_TEST 0x0C11
+#define GL_POLYGON_OFFSET_FILL 0x8037
+#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
+#define GL_SAMPLE_COVERAGE 0x80A0
+#define GL_NO_ERROR 0
+#define GL_INVALID_ENUM 0x0500
+#define GL_INVALID_VALUE 0x0501
+#define GL_INVALID_OPERATION 0x0502
+#define GL_OUT_OF_MEMORY 0x0505
+#define GL_CW 0x0900
+#define GL_CCW 0x0901
+#define GL_LINE_WIDTH 0x0B21
+#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
+#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
+#define GL_CULL_FACE_MODE 0x0B45
+#define GL_FRONT_FACE 0x0B46
+#define GL_DEPTH_RANGE 0x0B70
+#define GL_DEPTH_WRITEMASK 0x0B72
+#define GL_DEPTH_CLEAR_VALUE 0x0B73
+#define GL_DEPTH_FUNC 0x0B74
+#define GL_STENCIL_CLEAR_VALUE 0x0B91
+#define GL_STENCIL_FUNC 0x0B92
+#define GL_STENCIL_FAIL 0x0B94
+#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
+#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
+#define GL_STENCIL_REF 0x0B97
+#define GL_STENCIL_VALUE_MASK 0x0B93
+#define GL_STENCIL_WRITEMASK 0x0B98
+#define GL_STENCIL_BACK_FUNC 0x8800
+#define GL_STENCIL_BACK_FAIL 0x8801
+#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
+#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
+#define GL_STENCIL_BACK_REF 0x8CA3
+#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
+#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
+#define GL_VIEWPORT 0x0BA2
+#define GL_SCISSOR_BOX 0x0C10
+#define GL_COLOR_CLEAR_VALUE 0x0C22
+#define GL_COLOR_WRITEMASK 0x0C23
+#define GL_UNPACK_ALIGNMENT 0x0CF5
+#define GL_PACK_ALIGNMENT 0x0D05
+#define GL_MAX_TEXTURE_SIZE 0x0D33
+#define GL_MAX_VIEWPORT_DIMS 0x0D3A
+#define GL_SUBPIXEL_BITS 0x0D50
+#define GL_RED_BITS 0x0D52
+#define GL_GREEN_BITS 0x0D53
+#define GL_BLUE_BITS 0x0D54
+#define GL_ALPHA_BITS 0x0D55
+#define GL_DEPTH_BITS 0x0D56
+#define GL_STENCIL_BITS 0x0D57
+#define GL_POLYGON_OFFSET_UNITS 0x2A00
+#define GL_POLYGON_OFFSET_FACTOR 0x8038
+#define GL_TEXTURE_BINDING_2D 0x8069
+#define GL_SAMPLE_BUFFERS 0x80A8
+#define GL_SAMPLES 0x80A9
+#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
+#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
+#define GL_DONT_CARE 0x1100
+#define GL_FASTEST 0x1101
+#define GL_NICEST 0x1102
+#define GL_GENERATE_MIPMAP_HINT 0x8192
+#define GL_BYTE 0x1400
+#define GL_UNSIGNED_BYTE 0x1401
+#define GL_SHORT 0x1402
+#define GL_UNSIGNED_SHORT 0x1403
+#define GL_INT 0x1404
+#define GL_UNSIGNED_INT 0x1405
+#define GL_FLOAT 0x1406
+#define GL_FIXED 0x140C
+#define GL_DEPTH_COMPONENT 0x1902
+#define GL_ALPHA 0x1906
+#define GL_RGB 0x1907
+#define GL_RGBA 0x1908
+#define GL_LUMINANCE 0x1909
+#define GL_LUMINANCE_ALPHA 0x190A
+#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
+#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
+#define GL_UNSIGNED_SHORT_5_6_5 0x8363
+#define GL_FRAGMENT_SHADER 0x8B30
+#define GL_VERTEX_SHADER 0x8B31
+#define GL_MAX_VERTEX_ATTRIBS 0x8869
+#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
+#define GL_MAX_VARYING_VECTORS 0x8DFC
+#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
+#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
+#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
+#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
+#define GL_SHADER_TYPE 0x8B4F
+#define GL_DELETE_STATUS 0x8B80
+#define GL_LINK_STATUS 0x8B82
+#define GL_VALIDATE_STATUS 0x8B83
+#define GL_ATTACHED_SHADERS 0x8B85
+#define GL_ACTIVE_UNIFORMS 0x8B86
+#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
+#define GL_ACTIVE_ATTRIBUTES 0x8B89
+#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
+#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
+#define GL_CURRENT_PROGRAM 0x8B8D
+#define GL_NEVER 0x0200
+#define GL_LESS 0x0201
+#define GL_EQUAL 0x0202
+#define GL_LEQUAL 0x0203
+#define GL_GREATER 0x0204
+#define GL_NOTEQUAL 0x0205
+#define GL_GEQUAL 0x0206
+#define GL_ALWAYS 0x0207
+#define GL_KEEP 0x1E00
+#define GL_REPLACE 0x1E01
+#define GL_INCR 0x1E02
+#define GL_DECR 0x1E03
+#define GL_INVERT 0x150A
+#define GL_INCR_WRAP 0x8507
+#define GL_DECR_WRAP 0x8508
+#define GL_VENDOR 0x1F00
+#define GL_RENDERER 0x1F01
+#define GL_VERSION 0x1F02
+#define GL_EXTENSIONS 0x1F03
+#define GL_NEAREST 0x2600
+#define GL_LINEAR 0x2601
+#define GL_NEAREST_MIPMAP_NEAREST 0x2700
+#define GL_LINEAR_MIPMAP_NEAREST 0x2701
+#define GL_NEAREST_MIPMAP_LINEAR 0x2702
+#define GL_LINEAR_MIPMAP_LINEAR 0x2703
+#define GL_TEXTURE_MAG_FILTER 0x2800
+#define GL_TEXTURE_MIN_FILTER 0x2801
+#define GL_TEXTURE_WRAP_S 0x2802
+#define GL_TEXTURE_WRAP_T 0x2803
+#define GL_TEXTURE 0x1702
+#define GL_TEXTURE_CUBE_MAP 0x8513
+#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
+#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
+#define GL_TEXTURE0 0x84C0
+#define GL_TEXTURE1 0x84C1
+#define GL_TEXTURE2 0x84C2
+#define GL_TEXTURE3 0x84C3
+#define GL_TEXTURE4 0x84C4
+#define GL_TEXTURE5 0x84C5
+#define GL_TEXTURE6 0x84C6
+#define GL_TEXTURE7 0x84C7
+#define GL_TEXTURE8 0x84C8
+#define GL_TEXTURE9 0x84C9
+#define GL_TEXTURE10 0x84CA
+#define GL_TEXTURE11 0x84CB
+#define GL_TEXTURE12 0x84CC
+#define GL_TEXTURE13 0x84CD
+#define GL_TEXTURE14 0x84CE
+#define GL_TEXTURE15 0x84CF
+#define GL_TEXTURE16 0x84D0
+#define GL_TEXTURE17 0x84D1
+#define GL_TEXTURE18 0x84D2
+#define GL_TEXTURE19 0x84D3
+#define GL_TEXTURE20 0x84D4
+#define GL_TEXTURE21 0x84D5
+#define GL_TEXTURE22 0x84D6
+#define GL_TEXTURE23 0x84D7
+#define GL_TEXTURE24 0x84D8
+#define GL_TEXTURE25 0x84D9
+#define GL_TEXTURE26 0x84DA
+#define GL_TEXTURE27 0x84DB
+#define GL_TEXTURE28 0x84DC
+#define GL_TEXTURE29 0x84DD
+#define GL_TEXTURE30 0x84DE
+#define GL_TEXTURE31 0x84DF
+#define GL_ACTIVE_TEXTURE 0x84E0
+#define GL_REPEAT 0x2901
+#define GL_CLAMP_TO_EDGE 0x812F
+#define GL_MIRRORED_REPEAT 0x8370
+#define GL_FLOAT_VEC2 0x8B50
+#define GL_FLOAT_VEC3 0x8B51
+#define GL_FLOAT_VEC4 0x8B52
+#define GL_INT_VEC2 0x8B53
+#define GL_INT_VEC3 0x8B54
+#define GL_INT_VEC4 0x8B55
+#define GL_BOOL 0x8B56
+#define GL_BOOL_VEC2 0x8B57
+#define GL_BOOL_VEC3 0x8B58
+#define GL_BOOL_VEC4 0x8B59
+#define GL_FLOAT_MAT2 0x8B5A
+#define GL_FLOAT_MAT3 0x8B5B
+#define GL_FLOAT_MAT4 0x8B5C
+#define GL_SAMPLER_2D 0x8B5E
+#define GL_SAMPLER_CUBE 0x8B60
+#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
+#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
+#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
+#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
+#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
+#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
+#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
+#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
+#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
+#define GL_COMPILE_STATUS 0x8B81
+#define GL_INFO_LOG_LENGTH 0x8B84
+#define GL_SHADER_SOURCE_LENGTH 0x8B88
+#define GL_SHADER_COMPILER 0x8DFA
+#define GL_SHADER_BINARY_FORMATS 0x8DF8
+#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
+#define GL_LOW_FLOAT 0x8DF0
+#define GL_MEDIUM_FLOAT 0x8DF1
+#define GL_HIGH_FLOAT 0x8DF2
+#define GL_LOW_INT 0x8DF3
+#define GL_MEDIUM_INT 0x8DF4
+#define GL_HIGH_INT 0x8DF5
+#define GL_FRAMEBUFFER 0x8D40
+#define GL_RENDERBUFFER 0x8D41
+#define GL_RGBA4 0x8056
+#define GL_RGB5_A1 0x8057
+#define GL_RGB565 0x8D62
+#define GL_DEPTH_COMPONENT16 0x81A5
+#define GL_STENCIL_INDEX8 0x8D48
+#define GL_RENDERBUFFER_WIDTH 0x8D42
+#define GL_RENDERBUFFER_HEIGHT 0x8D43
+#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
+#define GL_RENDERBUFFER_RED_SIZE 0x8D50
+#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
+#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
+#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
+#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
+#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
+#define GL_COLOR_ATTACHMENT0 0x8CE0
+#define GL_DEPTH_ATTACHMENT 0x8D00
+#define GL_STENCIL_ATTACHMENT 0x8D20
+#define GL_NONE 0
+#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
+#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
+#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
+#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
+#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
+#define GL_FRAMEBUFFER_BINDING 0x8CA6
+#define GL_RENDERBUFFER_BINDING 0x8CA7
+#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
+#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
+GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
+GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
+GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name);
+GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
+GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
+GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
+GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
+GL_APICALL void GL_APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+GL_APICALL void GL_APIENTRY glBlendEquation (GLenum mode);
+GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
+GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
+GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
+GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
+GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
+GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
+GL_APICALL void GL_APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+GL_APICALL void GL_APIENTRY glClearDepthf (GLfloat d);
+GL_APICALL void GL_APIENTRY glClearStencil (GLint s);
+GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader);
+GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
+GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL GLuint GL_APIENTRY glCreateProgram (void);
+GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type);
+GL_APICALL void GL_APIENTRY glCullFace (GLenum mode);
+GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
+GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers);
+GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers);
+GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader);
+GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);
+GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func);
+GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag);
+GL_APICALL void GL_APIENTRY glDepthRangef (GLfloat n, GLfloat f);
+GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader);
+GL_APICALL void GL_APIENTRY glDisable (GLenum cap);
+GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index);
+GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
+GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices);
+GL_APICALL void GL_APIENTRY glEnable (GLenum cap);
+GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index);
+GL_APICALL void GL_APIENTRY glFinish (void);
+GL_APICALL void GL_APIENTRY glFlush (void);
+GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode);
+GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
+GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target);
+GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers);
+GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers);
+GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures);
+GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
+GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar *name);
+GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *data);
+GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);
+GL_APICALL GLenum GL_APIENTRY glGetError (void);
+GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *data);
+GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data);
+GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
+GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
+GL_APICALL const GLubyte *GL_APIENTRY glGetString (GLenum name);
+GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params);
+GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);
+GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer);
+GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode);
+GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
+GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
+GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer);
+GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program);
+GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer);
+GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader);
+GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture);
+GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width);
+GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
+GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
+GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void);
+GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glSampleCoverage (GLfloat value, GLboolean invert);
+GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
+GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
+GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
+GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
+GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
+GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
+GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);
+GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params);
+GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
+GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat v0);
+GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint v0);
+GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1);
+GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint v0, GLint v1);
+GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2);
+GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUseProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint index, GLfloat x);
+GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y);
+GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
+GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
+#endif /* GL_ES_VERSION_2_0 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/third_party/mojo/src/mojo/public/c/gpu/GLES2/gl2ext.h b/third_party/mojo/src/mojo/public/c/gpu/GLES2/gl2ext.h
new file mode 100644
index 0000000..a3efa82
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/c/gpu/GLES2/gl2ext.h
@@ -0,0 +1,2026 @@
+#ifndef __gl2ext_h_
+#define __gl2ext_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2013-2014 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+** http://www.opengl.org/registry/
+**
+** Khronos $Revision: 28366 $ on $Date: 2014-10-20 11:29:02 +0200 (Mon, 20 Oct 2014) $
+*/
+
+#ifndef GL_APIENTRYP
+#define GL_APIENTRYP GL_APIENTRY*
+#endif
+
+/* Generated on date 20141020 */
+
+/* Generated C header for:
+ * API: gles2
+ * Profile: common
+ * Versions considered: 2\.[0-9]
+ * Versions emitted: _nomatch_^
+ * Default extensions included: gles2
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
+
+#ifndef GL_KHR_blend_equation_advanced
+#define GL_KHR_blend_equation_advanced 1
+#define GL_MULTIPLY_KHR 0x9294
+#define GL_SCREEN_KHR 0x9295
+#define GL_OVERLAY_KHR 0x9296
+#define GL_DARKEN_KHR 0x9297
+#define GL_LIGHTEN_KHR 0x9298
+#define GL_COLORDODGE_KHR 0x9299
+#define GL_COLORBURN_KHR 0x929A
+#define GL_HARDLIGHT_KHR 0x929B
+#define GL_SOFTLIGHT_KHR 0x929C
+#define GL_DIFFERENCE_KHR 0x929E
+#define GL_EXCLUSION_KHR 0x92A0
+#define GL_HSL_HUE_KHR 0x92AD
+#define GL_HSL_SATURATION_KHR 0x92AE
+#define GL_HSL_COLOR_KHR 0x92AF
+#define GL_HSL_LUMINOSITY_KHR 0x92B0
+typedef void (GL_APIENTRYP PFNGLBLENDBARRIERKHRPROC) (void);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBlendBarrierKHR (void);
+#endif
+#endif /* GL_KHR_blend_equation_advanced */
+
+#ifndef GL_KHR_blend_equation_advanced_coherent
+#define GL_KHR_blend_equation_advanced_coherent 1
+#define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285
+#endif /* GL_KHR_blend_equation_advanced_coherent */
+
+#ifndef GL_KHR_context_flush_control
+#define GL_KHR_context_flush_control 1
+#define GL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x82FB
+#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x82FC
+#endif /* GL_KHR_context_flush_control */
+
+#ifndef GL_KHR_debug
+#define GL_KHR_debug 1
+typedef void (GL_APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,void *userParam);
+//#define GL_SAMPLER 0x82E6
+#define GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR 0x8242
+#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_KHR 0x8243
+#define GL_DEBUG_CALLBACK_FUNCTION_KHR 0x8244
+#define GL_DEBUG_CALLBACK_USER_PARAM_KHR 0x8245
+#define GL_DEBUG_SOURCE_API_KHR 0x8246
+#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR 0x8247
+#define GL_DEBUG_SOURCE_SHADER_COMPILER_KHR 0x8248
+#define GL_DEBUG_SOURCE_THIRD_PARTY_KHR 0x8249
+#define GL_DEBUG_SOURCE_APPLICATION_KHR 0x824A
+#define GL_DEBUG_SOURCE_OTHER_KHR 0x824B
+#define GL_DEBUG_TYPE_ERROR_KHR 0x824C
+#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR 0x824D
+#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR 0x824E
+#define GL_DEBUG_TYPE_PORTABILITY_KHR 0x824F
+#define GL_DEBUG_TYPE_PERFORMANCE_KHR 0x8250
+#define GL_DEBUG_TYPE_OTHER_KHR 0x8251
+#define GL_DEBUG_TYPE_MARKER_KHR 0x8268
+#define GL_DEBUG_TYPE_PUSH_GROUP_KHR 0x8269
+#define GL_DEBUG_TYPE_POP_GROUP_KHR 0x826A
+#define GL_DEBUG_SEVERITY_NOTIFICATION_KHR 0x826B
+#define GL_MAX_DEBUG_GROUP_STACK_DEPTH_KHR 0x826C
+#define GL_DEBUG_GROUP_STACK_DEPTH_KHR 0x826D
+#define GL_BUFFER_KHR 0x82E0
+#define GL_SHADER_KHR 0x82E1
+#define GL_PROGRAM_KHR 0x82E2
+#define GL_VERTEX_ARRAY_KHR 0x8074
+#define GL_QUERY_KHR 0x82E3
+#define GL_SAMPLER_KHR 0x82E6
+#define GL_MAX_LABEL_LENGTH_KHR 0x82E8
+#define GL_MAX_DEBUG_MESSAGE_LENGTH_KHR 0x9143
+#define GL_MAX_DEBUG_LOGGED_MESSAGES_KHR 0x9144
+#define GL_DEBUG_LOGGED_MESSAGES_KHR 0x9145
+#define GL_DEBUG_SEVERITY_HIGH_KHR 0x9146
+#define GL_DEBUG_SEVERITY_MEDIUM_KHR 0x9147
+#define GL_DEBUG_SEVERITY_LOW_KHR 0x9148
+#define GL_DEBUG_OUTPUT_KHR 0x92E0
+#define GL_CONTEXT_FLAG_DEBUG_BIT_KHR 0x00000002
+#define GL_STACK_OVERFLOW_KHR 0x0503
+#define GL_STACK_UNDERFLOW_KHR 0x0504
+typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECONTROLKHRPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
+typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGEINSERTKHRPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
+typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECALLBACKKHRPROC) (GLDEBUGPROCKHR callback, void *userParam);
+typedef GLuint (GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGKHRPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
+typedef void (GL_APIENTRYP PFNGLPUSHDEBUGGROUPKHRPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message);
+typedef void (GL_APIENTRYP PFNGLPOPDEBUGGROUPKHRPROC) (void);
+typedef void (GL_APIENTRYP PFNGLOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
+typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
+typedef void (GL_APIENTRYP PFNGLOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei length, const GLchar *label);
+typedef void (GL_APIENTRYP PFNGLGETOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
+typedef void (GL_APIENTRYP PFNGLGETPOINTERVKHRPROC) (GLenum pname, void **params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDebugMessageControlKHR (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
+GL_APICALL void GL_APIENTRY glDebugMessageInsertKHR (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
+GL_APICALL void GL_APIENTRY glDebugMessageCallbackKHR (GLDEBUGPROCKHR callback, const void *userParam);
+GL_APICALL GLuint GL_APIENTRY glGetDebugMessageLogKHR (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
+GL_APICALL void GL_APIENTRY glPushDebugGroupKHR (GLenum source, GLuint id, GLsizei length, const GLchar *message);
+GL_APICALL void GL_APIENTRY glPopDebugGroupKHR (void);
+GL_APICALL void GL_APIENTRY glObjectLabelKHR (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
+GL_APICALL void GL_APIENTRY glGetObjectLabelKHR (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
+GL_APICALL void GL_APIENTRY glObjectPtrLabelKHR (const void *ptr, GLsizei length, const GLchar *label);
+GL_APICALL void GL_APIENTRY glGetObjectPtrLabelKHR (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
+GL_APICALL void GL_APIENTRY glGetPointervKHR (GLenum pname, void **params);
+#endif
+#endif /* GL_KHR_debug */
+
+#ifndef GL_KHR_robust_buffer_access_behavior
+#define GL_KHR_robust_buffer_access_behavior 1
+#endif /* GL_KHR_robust_buffer_access_behavior */
+
+#ifndef GL_KHR_robustness
+#define GL_KHR_robustness 1
+#define GL_CONTEXT_ROBUST_ACCESS_KHR 0x90F3
+#define GL_LOSE_CONTEXT_ON_RESET_KHR 0x8252
+#define GL_GUILTY_CONTEXT_RESET_KHR 0x8253
+#define GL_INNOCENT_CONTEXT_RESET_KHR 0x8254
+#define GL_UNKNOWN_CONTEXT_RESET_KHR 0x8255
+#define GL_RESET_NOTIFICATION_STRATEGY_KHR 0x8256
+#define GL_NO_RESET_NOTIFICATION_KHR 0x8261
+#define GL_CONTEXT_LOST_KHR 0x0507
+typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSKHRPROC) (void);
+typedef void (GL_APIENTRYP PFNGLREADNPIXELSKHRPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMUIVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusKHR (void);
+GL_APICALL void GL_APIENTRY glReadnPixelsKHR (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+GL_APICALL void GL_APIENTRY glGetnUniformfvKHR (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetnUniformivKHR (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+GL_APICALL void GL_APIENTRY glGetnUniformuivKHR (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
+#endif
+#endif /* GL_KHR_robustness */
+
+#ifndef GL_KHR_texture_compression_astc_hdr
+#define GL_KHR_texture_compression_astc_hdr 1
+#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0
+#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1
+#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2
+#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3
+#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4
+#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5
+#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6
+#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7
+#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8
+#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9
+#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA
+#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB
+#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC
+#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD
+#endif /* GL_KHR_texture_compression_astc_hdr */
+
+#ifndef GL_KHR_texture_compression_astc_ldr
+#define GL_KHR_texture_compression_astc_ldr 1
+#endif /* GL_KHR_texture_compression_astc_ldr */
+
+#ifndef GL_OES_EGL_image
+#define GL_OES_EGL_image 1
+typedef void *GLeglImageOES;
+typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
+typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image);
+GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image);
+#endif
+#endif /* GL_OES_EGL_image */
+
+#ifndef GL_OES_EGL_image_external
+#define GL_OES_EGL_image_external 1
+#define GL_TEXTURE_EXTERNAL_OES 0x8D65
+#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67
+#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68
+#define GL_SAMPLER_EXTERNAL_OES 0x8D66
+#endif /* GL_OES_EGL_image_external */
+
+#ifndef GL_OES_compressed_ETC1_RGB8_sub_texture
+#define GL_OES_compressed_ETC1_RGB8_sub_texture 1
+#endif /* GL_OES_compressed_ETC1_RGB8_sub_texture */
+
+#ifndef GL_OES_compressed_ETC1_RGB8_texture
+#define GL_OES_compressed_ETC1_RGB8_texture 1
+#define GL_ETC1_RGB8_OES 0x8D64
+#endif /* GL_OES_compressed_ETC1_RGB8_texture */
+
+#ifndef GL_OES_compressed_paletted_texture
+#define GL_OES_compressed_paletted_texture 1
+#define GL_PALETTE4_RGB8_OES 0x8B90
+#define GL_PALETTE4_RGBA8_OES 0x8B91
+#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
+#define GL_PALETTE4_RGBA4_OES 0x8B93
+#define GL_PALETTE4_RGB5_A1_OES 0x8B94
+#define GL_PALETTE8_RGB8_OES 0x8B95
+#define GL_PALETTE8_RGBA8_OES 0x8B96
+#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
+#define GL_PALETTE8_RGBA4_OES 0x8B98
+#define GL_PALETTE8_RGB5_A1_OES 0x8B99
+#endif /* GL_OES_compressed_paletted_texture */
+
+#ifndef GL_OES_depth24
+#define GL_OES_depth24 1
+#define GL_DEPTH_COMPONENT24_OES 0x81A6
+#endif /* GL_OES_depth24 */
+
+#ifndef GL_OES_depth32
+#define GL_OES_depth32 1
+#define GL_DEPTH_COMPONENT32_OES 0x81A7
+#endif /* GL_OES_depth32 */
+
+#ifndef GL_OES_depth_texture
+#define GL_OES_depth_texture 1
+#endif /* GL_OES_depth_texture */
+
+#ifndef GL_OES_element_index_uint
+#define GL_OES_element_index_uint 1
+#endif /* GL_OES_element_index_uint */
+
+#ifndef GL_OES_fbo_render_mipmap
+#define GL_OES_fbo_render_mipmap 1
+#endif /* GL_OES_fbo_render_mipmap */
+
+#ifndef GL_OES_fragment_precision_high
+#define GL_OES_fragment_precision_high 1
+#endif /* GL_OES_fragment_precision_high */
+
+#ifndef GL_OES_get_program_binary
+#define GL_OES_get_program_binary 1
+#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741
+#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE
+#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
+typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLint length);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
+GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const void *binary, GLint length);
+#endif
+#endif /* GL_OES_get_program_binary */
+
+#ifndef GL_OES_mapbuffer
+#define GL_OES_mapbuffer 1
+#define GL_WRITE_ONLY_OES 0x88B9
+#define GL_BUFFER_ACCESS_OES 0x88BB
+#define GL_BUFFER_MAPPED_OES 0x88BC
+#define GL_BUFFER_MAP_POINTER_OES 0x88BD
+typedef void *(GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access);
+typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, void **params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void *GL_APIENTRY glMapBufferOES (GLenum target, GLenum access);
+GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target);
+GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, void **params);
+#endif
+#endif /* GL_OES_mapbuffer */
+
+#ifndef GL_OES_packed_depth_stencil
+#define GL_OES_packed_depth_stencil 1
+#define GL_DEPTH_STENCIL_OES 0x84F9
+#define GL_UNSIGNED_INT_24_8_OES 0x84FA
+#define GL_DEPTH24_STENCIL8_OES 0x88F0
+#endif /* GL_OES_packed_depth_stencil */
+
+#ifndef GL_OES_required_internalformat
+#define GL_OES_required_internalformat 1
+#define GL_ALPHA8_OES 0x803C
+#define GL_DEPTH_COMPONENT16_OES 0x81A5
+#define GL_LUMINANCE4_ALPHA4_OES 0x8043
+#define GL_LUMINANCE8_ALPHA8_OES 0x8045
+#define GL_LUMINANCE8_OES 0x8040
+#define GL_RGBA4_OES 0x8056
+#define GL_RGB5_A1_OES 0x8057
+#define GL_RGB565_OES 0x8D62
+#define GL_RGB8_OES 0x8051
+#define GL_RGBA8_OES 0x8058
+#define GL_RGB10_EXT 0x8052
+#define GL_RGB10_A2_EXT 0x8059
+#endif /* GL_OES_required_internalformat */
+
+#ifndef GL_OES_rgb8_rgba8
+#define GL_OES_rgb8_rgba8 1
+#endif /* GL_OES_rgb8_rgba8 */
+
+#ifndef GL_OES_sample_shading
+#define GL_OES_sample_shading 1
+#define GL_SAMPLE_SHADING_OES 0x8C36
+#define GL_MIN_SAMPLE_SHADING_VALUE_OES 0x8C37
+typedef void (GL_APIENTRYP PFNGLMINSAMPLESHADINGOESPROC) (GLfloat value);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glMinSampleShadingOES (GLfloat value);
+#endif
+#endif /* GL_OES_sample_shading */
+
+#ifndef GL_OES_sample_variables
+#define GL_OES_sample_variables 1
+#endif /* GL_OES_sample_variables */
+
+#ifndef GL_OES_shader_image_atomic
+#define GL_OES_shader_image_atomic 1
+#endif /* GL_OES_shader_image_atomic */
+
+#ifndef GL_OES_shader_multisample_interpolation
+#define GL_OES_shader_multisample_interpolation 1
+#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5B
+#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5C
+#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS_OES 0x8E5D
+#endif /* GL_OES_shader_multisample_interpolation */
+
+#ifndef GL_OES_standard_derivatives
+#define GL_OES_standard_derivatives 1
+#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B
+#endif /* GL_OES_standard_derivatives */
+
+#ifndef GL_OES_stencil1
+#define GL_OES_stencil1 1
+#define GL_STENCIL_INDEX1_OES 0x8D46
+#endif /* GL_OES_stencil1 */
+
+#ifndef GL_OES_stencil4
+#define GL_OES_stencil4 1
+#define GL_STENCIL_INDEX4_OES 0x8D47
+#endif /* GL_OES_stencil4 */
+
+#ifndef GL_OES_surfaceless_context
+#define GL_OES_surfaceless_context 1
+#define GL_FRAMEBUFFER_UNDEFINED_OES 0x8219
+#endif /* GL_OES_surfaceless_context */
+
+#ifndef GL_OES_texture_3D
+#define GL_OES_texture_3D 1
+#define GL_TEXTURE_WRAP_R_OES 0x8072
+#define GL_TEXTURE_3D_OES 0x806F
+#define GL_TEXTURE_BINDING_3D_OES 0x806A
+#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073
+#define GL_SAMPLER_3D_OES 0x8B5F
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4
+typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
+typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+
+// Chromium-specific define to account for issues in gles2_conform_test
+// TODO (bajones): This symbol should be updated to the correct version in the
+// conformance test upstream and this hack removed. crbug.com/329708
+#define PFNGLFRAMEBUFFERTEXTURE3DOES PFNGLFRAMEBUFFERTEXTURE3DOESPROC
+
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
+GL_APICALL void GL_APIENTRY glTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
+GL_APICALL void GL_APIENTRY glCopyTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glCompressedTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
+GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+#endif
+#endif /* GL_OES_texture_3D */
+
+#ifndef GL_OES_texture_compression_astc
+#define GL_OES_texture_compression_astc 1
+#define GL_COMPRESSED_RGBA_ASTC_3x3x3_OES 0x93C0
+#define GL_COMPRESSED_RGBA_ASTC_4x3x3_OES 0x93C1
+#define GL_COMPRESSED_RGBA_ASTC_4x4x3_OES 0x93C2
+#define GL_COMPRESSED_RGBA_ASTC_4x4x4_OES 0x93C3
+#define GL_COMPRESSED_RGBA_ASTC_5x4x4_OES 0x93C4
+#define GL_COMPRESSED_RGBA_ASTC_5x5x4_OES 0x93C5
+#define GL_COMPRESSED_RGBA_ASTC_5x5x5_OES 0x93C6
+#define GL_COMPRESSED_RGBA_ASTC_6x5x5_OES 0x93C7
+#define GL_COMPRESSED_RGBA_ASTC_6x6x5_OES 0x93C8
+#define GL_COMPRESSED_RGBA_ASTC_6x6x6_OES 0x93C9
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES 0x93E0
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES 0x93E1
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES 0x93E2
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES 0x93E3
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES 0x93E4
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES 0x93E5
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES 0x93E6
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES 0x93E7
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES 0x93E8
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES 0x93E9
+#endif /* GL_OES_texture_compression_astc */
+
+#ifndef GL_OES_texture_float
+#define GL_OES_texture_float 1
+#endif /* GL_OES_texture_float */
+
+#ifndef GL_OES_texture_float_linear
+#define GL_OES_texture_float_linear 1
+#endif /* GL_OES_texture_float_linear */
+
+#ifndef GL_OES_texture_half_float
+#define GL_OES_texture_half_float 1
+#define GL_HALF_FLOAT_OES 0x8D61
+#endif /* GL_OES_texture_half_float */
+
+#ifndef GL_OES_texture_half_float_linear
+#define GL_OES_texture_half_float_linear 1
+#endif /* GL_OES_texture_half_float_linear */
+
+#ifndef GL_OES_texture_npot
+#define GL_OES_texture_npot 1
+#endif /* GL_OES_texture_npot */
+
+#ifndef GL_OES_texture_stencil8
+#define GL_OES_texture_stencil8 1
+#define GL_STENCIL_INDEX_OES 0x1901
+#define GL_STENCIL_INDEX8_OES 0x8D48
+#endif /* GL_OES_texture_stencil8 */
+
+#ifndef GL_OES_texture_storage_multisample_2d_array
+#define GL_OES_texture_storage_multisample_2d_array 1
+#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES 0x9102
+#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY_OES 0x9105
+#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910B
+#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910C
+#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910D
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEOESPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexStorage3DMultisampleOES (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
+#endif
+#endif /* GL_OES_texture_storage_multisample_2d_array */
+
+#ifndef GL_OES_vertex_array_object
+#define GL_OES_vertex_array_object 1
+#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5
+typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array);
+typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays);
+typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays);
+typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBindVertexArrayOES (GLuint array);
+GL_APICALL void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays);
+GL_APICALL void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays);
+GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array);
+#endif
+#endif /* GL_OES_vertex_array_object */
+
+#ifndef GL_OES_vertex_half_float
+#define GL_OES_vertex_half_float 1
+#endif /* GL_OES_vertex_half_float */
+
+#ifndef GL_OES_vertex_type_10_10_10_2
+#define GL_OES_vertex_type_10_10_10_2 1
+#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6
+#define GL_INT_10_10_10_2_OES 0x8DF7
+#endif /* GL_OES_vertex_type_10_10_10_2 */
+
+#ifndef GL_AMD_compressed_3DC_texture
+#define GL_AMD_compressed_3DC_texture 1
+#define GL_3DC_X_AMD 0x87F9
+#define GL_3DC_XY_AMD 0x87FA
+#endif /* GL_AMD_compressed_3DC_texture */
+
+#ifndef GL_AMD_compressed_ATC_texture
+#define GL_AMD_compressed_ATC_texture 1
+#define GL_ATC_RGB_AMD 0x8C92
+#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93
+#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE
+#endif /* GL_AMD_compressed_ATC_texture */
+
+#ifndef GL_AMD_performance_monitor
+#define GL_AMD_performance_monitor 1
+#define GL_COUNTER_TYPE_AMD 0x8BC0
+#define GL_COUNTER_RANGE_AMD 0x8BC1
+#define GL_UNSIGNED_INT64_AMD 0x8BC2
+#define GL_PERCENTAGE_AMD 0x8BC3
+#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4
+#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5
+#define GL_PERFMON_RESULT_AMD 0x8BC6
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, void *data);
+typedef void (GL_APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
+typedef void (GL_APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
+typedef void (GL_APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList);
+typedef void (GL_APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor);
+typedef void (GL_APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, void *data);
+GL_APICALL void GL_APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors);
+GL_APICALL void GL_APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors);
+GL_APICALL void GL_APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList);
+GL_APICALL void GL_APIENTRY glBeginPerfMonitorAMD (GLuint monitor);
+GL_APICALL void GL_APIENTRY glEndPerfMonitorAMD (GLuint monitor);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
+#endif
+#endif /* GL_AMD_performance_monitor */
+
+#ifndef GL_AMD_program_binary_Z400
+#define GL_AMD_program_binary_Z400 1
+#define GL_Z400_BINARY_AMD 0x8740
+#endif /* GL_AMD_program_binary_Z400 */
+
+#ifndef GL_ANDROID_extension_pack_es31a
+#define GL_ANDROID_extension_pack_es31a 1
+#endif /* GL_ANDROID_extension_pack_es31a */
+
+#ifndef GL_ANGLE_depth_texture
+#define GL_ANGLE_depth_texture 1
+#endif /* GL_ANGLE_depth_texture */
+
+#ifndef GL_ANGLE_framebuffer_blit
+#define GL_ANGLE_framebuffer_blit 1
+#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8
+#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9
+#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6
+#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA
+typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERANGLEPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBlitFramebufferANGLE (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#endif
+#endif /* GL_ANGLE_framebuffer_blit */
+
+#ifndef GL_ANGLE_framebuffer_multisample
+#define GL_ANGLE_framebuffer_multisample 1
+#define GL_RENDERBUFFER_SAMPLES_ANGLE 0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56
+#define GL_MAX_SAMPLES_ANGLE 0x8D57
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+#endif
+#endif /* GL_ANGLE_framebuffer_multisample */
+
+#ifndef GL_ANGLE_instanced_arrays
+#define GL_ANGLE_instanced_arrays 1
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE (GLuint index, GLuint divisor);
+#endif
+#endif /* GL_ANGLE_instanced_arrays */
+
+#ifndef GL_ANGLE_pack_reverse_row_order
+#define GL_ANGLE_pack_reverse_row_order 1
+#define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4
+#endif /* GL_ANGLE_pack_reverse_row_order */
+
+#ifndef GL_ANGLE_program_binary
+#define GL_ANGLE_program_binary 1
+#define GL_PROGRAM_BINARY_ANGLE 0x93A6
+#endif /* GL_ANGLE_program_binary */
+
+#ifndef GL_ANGLE_texture_compression_dxt3
+#define GL_ANGLE_texture_compression_dxt3 1
+#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2
+#endif /* GL_ANGLE_texture_compression_dxt3 */
+
+#ifndef GL_ANGLE_texture_compression_dxt5
+#define GL_ANGLE_texture_compression_dxt5 1
+#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3
+#endif /* GL_ANGLE_texture_compression_dxt5 */
+
+#ifndef GL_ANGLE_texture_usage
+#define GL_ANGLE_texture_usage 1
+#define GL_TEXTURE_USAGE_ANGLE 0x93A2
+#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3
+#endif /* GL_ANGLE_texture_usage */
+
+#ifndef GL_ANGLE_translated_shader_source
+#define GL_ANGLE_translated_shader_source 1
+#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0
+typedef void (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
+#endif
+#endif /* GL_ANGLE_translated_shader_source */
+
+#ifndef GL_APPLE_clip_distance
+#define GL_APPLE_clip_distance 1
+#define GL_MAX_CLIP_DISTANCES_APPLE 0x0D32
+#define GL_CLIP_DISTANCE0_APPLE 0x3000
+#define GL_CLIP_DISTANCE1_APPLE 0x3001
+#define GL_CLIP_DISTANCE2_APPLE 0x3002
+#define GL_CLIP_DISTANCE3_APPLE 0x3003
+#define GL_CLIP_DISTANCE4_APPLE 0x3004
+#define GL_CLIP_DISTANCE5_APPLE 0x3005
+#define GL_CLIP_DISTANCE6_APPLE 0x3006
+#define GL_CLIP_DISTANCE7_APPLE 0x3007
+#endif /* GL_APPLE_clip_distance */
+
+#ifndef GL_APPLE_color_buffer_packed_float
+#define GL_APPLE_color_buffer_packed_float 1
+#endif /* GL_APPLE_color_buffer_packed_float */
+
+#ifndef GL_APPLE_copy_texture_levels
+#define GL_APPLE_copy_texture_levels 1
+typedef void (GL_APIENTRYP PFNGLCOPYTEXTURELEVELSAPPLEPROC) (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCopyTextureLevelsAPPLE (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount);
+#endif
+#endif /* GL_APPLE_copy_texture_levels */
+
+#ifndef GL_APPLE_framebuffer_multisample
+#define GL_APPLE_framebuffer_multisample 1
+#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56
+#define GL_MAX_SAMPLES_APPLE 0x8D57
+#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8
+#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9
+#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6
+#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void);
+#endif
+#endif /* GL_APPLE_framebuffer_multisample */
+
+#ifndef GL_APPLE_rgb_422
+#define GL_APPLE_rgb_422 1
+#define GL_RGB_422_APPLE 0x8A1F
+#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA
+#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB
+#define GL_RGB_RAW_422_APPLE 0x8A51
+#endif /* GL_APPLE_rgb_422 */
+
+#ifndef GL_APPLE_sync
+#define GL_APPLE_sync 1
+#define GL_SYNC_OBJECT_APPLE 0x8A53
+#define GL_MAX_SERVER_WAIT_TIMEOUT_APPLE 0x9111
+#define GL_OBJECT_TYPE_APPLE 0x9112
+#define GL_SYNC_CONDITION_APPLE 0x9113
+#define GL_SYNC_STATUS_APPLE 0x9114
+#define GL_SYNC_FLAGS_APPLE 0x9115
+#define GL_SYNC_FENCE_APPLE 0x9116
+#define GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE 0x9117
+#define GL_UNSIGNALED_APPLE 0x9118
+#define GL_SIGNALED_APPLE 0x9119
+#define GL_ALREADY_SIGNALED_APPLE 0x911A
+#define GL_TIMEOUT_EXPIRED_APPLE 0x911B
+#define GL_CONDITION_SATISFIED_APPLE 0x911C
+#define GL_WAIT_FAILED_APPLE 0x911D
+#define GL_SYNC_FLUSH_COMMANDS_BIT_APPLE 0x00000001
+#define GL_TIMEOUT_IGNORED_APPLE 0xFFFFFFFFFFFFFFFFull
+typedef GLsync (GL_APIENTRYP PFNGLFENCESYNCAPPLEPROC) (GLenum condition, GLbitfield flags);
+typedef GLboolean (GL_APIENTRYP PFNGLISSYNCAPPLEPROC) (GLsync sync);
+typedef void (GL_APIENTRYP PFNGLDELETESYNCAPPLEPROC) (GLsync sync);
+typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+typedef void (GL_APIENTRYP PFNGLWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+typedef void (GL_APIENTRYP PFNGLGETINTEGER64VAPPLEPROC) (GLenum pname, GLint64 *params);
+typedef void (GL_APIENTRYP PFNGLGETSYNCIVAPPLEPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL GLsync GL_APIENTRY glFenceSyncAPPLE (GLenum condition, GLbitfield flags);
+GL_APICALL GLboolean GL_APIENTRY glIsSyncAPPLE (GLsync sync);
+GL_APICALL void GL_APIENTRY glDeleteSyncAPPLE (GLsync sync);
+GL_APICALL GLenum GL_APIENTRY glClientWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_APICALL void GL_APIENTRY glWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_APICALL void GL_APIENTRY glGetInteger64vAPPLE (GLenum pname, GLint64 *params);
+GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+#endif
+#endif /* GL_APPLE_sync */
+
+#ifndef GL_APPLE_texture_format_BGRA8888
+#define GL_APPLE_texture_format_BGRA8888 1
+#define GL_BGRA_EXT 0x80E1
+#define GL_BGRA8_EXT 0x93A1
+#endif /* GL_APPLE_texture_format_BGRA8888 */
+
+#ifndef GL_APPLE_texture_max_level
+#define GL_APPLE_texture_max_level 1
+#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D
+#endif /* GL_APPLE_texture_max_level */
+
+#ifndef GL_APPLE_texture_packed_float
+#define GL_APPLE_texture_packed_float 1
+#define GL_UNSIGNED_INT_10F_11F_11F_REV_APPLE 0x8C3B
+#define GL_UNSIGNED_INT_5_9_9_9_REV_APPLE 0x8C3E
+#define GL_R11F_G11F_B10F_APPLE 0x8C3A
+#define GL_RGB9_E5_APPLE 0x8C3D
+#endif /* GL_APPLE_texture_packed_float */
+
+#ifndef GL_ARM_mali_program_binary
+#define GL_ARM_mali_program_binary 1
+#define GL_MALI_PROGRAM_BINARY_ARM 0x8F61
+#endif /* GL_ARM_mali_program_binary */
+
+#ifndef GL_ARM_mali_shader_binary
+#define GL_ARM_mali_shader_binary 1
+#define GL_MALI_SHADER_BINARY_ARM 0x8F60
+#endif /* GL_ARM_mali_shader_binary */
+
+#ifndef GL_ARM_rgba8
+#define GL_ARM_rgba8 1
+#endif /* GL_ARM_rgba8 */
+
+#ifndef GL_ARM_shader_framebuffer_fetch
+#define GL_ARM_shader_framebuffer_fetch 1
+#define GL_FETCH_PER_SAMPLE_ARM 0x8F65
+#define GL_FRAGMENT_SHADER_FRAMEBUFFER_FETCH_MRT_ARM 0x8F66
+#endif /* GL_ARM_shader_framebuffer_fetch */
+
+#ifndef GL_ARM_shader_framebuffer_fetch_depth_stencil
+#define GL_ARM_shader_framebuffer_fetch_depth_stencil 1
+#endif /* GL_ARM_shader_framebuffer_fetch_depth_stencil */
+
+#ifndef GL_DMP_program_binary
+#define GL_DMP_program_binary 1
+#define GL_SMAPHS30_PROGRAM_BINARY_DMP 0x9251
+#define GL_SMAPHS_PROGRAM_BINARY_DMP 0x9252
+#define GL_DMP_PROGRAM_BINARY_DMP 0x9253
+#endif /* GL_DMP_program_binary */
+
+#ifndef GL_DMP_shader_binary
+#define GL_DMP_shader_binary 1
+#define GL_SHADER_BINARY_DMP 0x9250
+#endif /* GL_DMP_shader_binary */
+
+#ifndef GL_EXT_blend_minmax
+#define GL_EXT_blend_minmax 1
+#define GL_MIN_EXT 0x8007
+#define GL_MAX_EXT 0x8008
+#endif /* GL_EXT_blend_minmax */
+
+#ifndef GL_EXT_color_buffer_half_float
+#define GL_EXT_color_buffer_half_float 1
+#define GL_RGBA16F_EXT 0x881A
+#define GL_RGB16F_EXT 0x881B
+#define GL_RG16F_EXT 0x822F
+#define GL_R16F_EXT 0x822D
+#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT 0x8211
+#define GL_UNSIGNED_NORMALIZED_EXT 0x8C17
+#endif /* GL_EXT_color_buffer_half_float */
+
+#ifndef GL_EXT_copy_image
+#define GL_EXT_copy_image 1
+typedef void (GL_APIENTRYP PFNGLCOPYIMAGESUBDATAEXTPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCopyImageSubDataEXT (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
+#endif
+#endif /* GL_EXT_copy_image */
+
+#ifndef GL_EXT_debug_label
+#define GL_EXT_debug_label 1
+#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F
+#define GL_PROGRAM_OBJECT_EXT 0x8B40
+#define GL_SHADER_OBJECT_EXT 0x8B48
+#define GL_BUFFER_OBJECT_EXT 0x9151
+#define GL_QUERY_OBJECT_EXT 0x9153
+#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154
+#define GL_TRANSFORM_FEEDBACK 0x8E22
+typedef void (GL_APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label);
+typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label);
+GL_APICALL void GL_APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
+#endif
+#endif /* GL_EXT_debug_label */
+
+#ifndef GL_EXT_debug_marker
+#define GL_EXT_debug_marker 1
+typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker);
+typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker);
+typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker);
+GL_APICALL void GL_APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker);
+GL_APICALL void GL_APIENTRY glPopGroupMarkerEXT (void);
+#endif
+#endif /* GL_EXT_debug_marker */
+
+#ifndef GL_EXT_discard_framebuffer
+#define GL_EXT_discard_framebuffer 1
+#define GL_COLOR_EXT 0x1800
+#define GL_DEPTH_EXT 0x1801
+#define GL_STENCIL_EXT 0x1802
+typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments);
+#endif
+#endif /* GL_EXT_discard_framebuffer */
+
+#ifndef GL_EXT_disjoint_timer_query
+#define GL_EXT_disjoint_timer_query 1
+#define GL_QUERY_COUNTER_BITS_EXT 0x8864
+#define GL_CURRENT_QUERY_EXT 0x8865
+#define GL_QUERY_RESULT_EXT 0x8866
+#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867
+#define GL_TIME_ELAPSED_EXT 0x88BF
+#define GL_TIMESTAMP_EXT 0x8E28
+#define GL_GPU_DISJOINT_EXT 0x8FBB
+typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids);
+typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint *ids);
+typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTPROC) (GLuint id);
+typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTPROC) (GLenum target, GLuint id);
+typedef void (GL_APIENTRYP PFNGLENDQUERYEXTPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLQUERYCOUNTEREXTPROC) (GLuint id, GLenum target);
+typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTIVEXTPROC) (GLuint id, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64 *params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64 *params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGenQueriesEXT (GLsizei n, GLuint *ids);
+GL_APICALL void GL_APIENTRY glDeleteQueriesEXT (GLsizei n, const GLuint *ids);
+GL_APICALL GLboolean GL_APIENTRY glIsQueryEXT (GLuint id);
+GL_APICALL void GL_APIENTRY glBeginQueryEXT (GLenum target, GLuint id);
+GL_APICALL void GL_APIENTRY glEndQueryEXT (GLenum target);
+GL_APICALL void GL_APIENTRY glQueryCounterEXT (GLuint id, GLenum target);
+GL_APICALL void GL_APIENTRY glGetQueryivEXT (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetQueryObjectivEXT (GLuint id, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXT (GLuint id, GLenum pname, GLuint *params);
+GL_APICALL void GL_APIENTRY glGetQueryObjecti64vEXT (GLuint id, GLenum pname, GLint64 *params);
+GL_APICALL void GL_APIENTRY glGetQueryObjectui64vEXT (GLuint id, GLenum pname, GLuint64 *params);
+#endif
+#endif /* GL_EXT_disjoint_timer_query */
+
+#ifndef GL_EXT_draw_buffers
+#define GL_EXT_draw_buffers 1
+#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF
+#define GL_MAX_DRAW_BUFFERS_EXT 0x8824
+#define GL_DRAW_BUFFER0_EXT 0x8825
+#define GL_DRAW_BUFFER1_EXT 0x8826
+#define GL_DRAW_BUFFER2_EXT 0x8827
+#define GL_DRAW_BUFFER3_EXT 0x8828
+#define GL_DRAW_BUFFER4_EXT 0x8829
+#define GL_DRAW_BUFFER5_EXT 0x882A
+#define GL_DRAW_BUFFER6_EXT 0x882B
+#define GL_DRAW_BUFFER7_EXT 0x882C
+#define GL_DRAW_BUFFER8_EXT 0x882D
+#define GL_DRAW_BUFFER9_EXT 0x882E
+#define GL_DRAW_BUFFER10_EXT 0x882F
+#define GL_DRAW_BUFFER11_EXT 0x8830
+#define GL_DRAW_BUFFER12_EXT 0x8831
+#define GL_DRAW_BUFFER13_EXT 0x8832
+#define GL_DRAW_BUFFER14_EXT 0x8833
+#define GL_DRAW_BUFFER15_EXT 0x8834
+#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
+#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1
+#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2
+#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3
+#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4
+#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5
+#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6
+#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7
+#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8
+#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9
+#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA
+#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB
+#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC
+#define GL_COLOR_ATTACHMENT13_EXT 0x8CED
+#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE
+#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF
+typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSEXTPROC) (GLsizei n, const GLenum *bufs);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawBuffersEXT (GLsizei n, const GLenum *bufs);
+#endif
+#endif /* GL_EXT_draw_buffers */
+
+#ifndef GL_EXT_draw_buffers_indexed
+#define GL_EXT_draw_buffers_indexed 1
+#define GL_MIN 0x8007
+#define GL_MAX 0x8008
+typedef void (GL_APIENTRYP PFNGLENABLEIEXTPROC) (GLenum target, GLuint index);
+typedef void (GL_APIENTRYP PFNGLDISABLEIEXTPROC) (GLenum target, GLuint index);
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONIEXTPROC) (GLuint buf, GLenum mode);
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEIEXTPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
+typedef void (GL_APIENTRYP PFNGLBLENDFUNCIEXTPROC) (GLuint buf, GLenum src, GLenum dst);
+typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEIEXTPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+typedef void (GL_APIENTRYP PFNGLCOLORMASKIEXTPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
+typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDIEXTPROC) (GLenum target, GLuint index);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glEnableiEXT (GLenum target, GLuint index);
+GL_APICALL void GL_APIENTRY glDisableiEXT (GLenum target, GLuint index);
+GL_APICALL void GL_APIENTRY glBlendEquationiEXT (GLuint buf, GLenum mode);
+GL_APICALL void GL_APIENTRY glBlendEquationSeparateiEXT (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
+GL_APICALL void GL_APIENTRY glBlendFunciEXT (GLuint buf, GLenum src, GLenum dst);
+GL_APICALL void GL_APIENTRY glBlendFuncSeparateiEXT (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+GL_APICALL void GL_APIENTRY glColorMaskiEXT (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
+GL_APICALL GLboolean GL_APIENTRY glIsEnablediEXT (GLenum target, GLuint index);
+#endif
+#endif /* GL_EXT_draw_buffers_indexed */
+
+#ifndef GL_EXT_draw_instanced
+#define GL_EXT_draw_instanced 1
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawArraysInstancedEXT (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
+GL_APICALL void GL_APIENTRY glDrawElementsInstancedEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+#endif
+#endif /* GL_EXT_draw_instanced */
+
+#ifndef GL_EXT_geometry_point_size
+#define GL_EXT_geometry_point_size 1
+#endif /* GL_EXT_geometry_point_size */
+
+#ifndef GL_EXT_geometry_shader
+#define GL_EXT_geometry_shader 1
+#define GL_GEOMETRY_SHADER_EXT 0x8DD9
+#define GL_GEOMETRY_SHADER_BIT_EXT 0x00000004
+#define GL_GEOMETRY_LINKED_VERTICES_OUT_EXT 0x8916
+#define GL_GEOMETRY_LINKED_INPUT_TYPE_EXT 0x8917
+#define GL_GEOMETRY_LINKED_OUTPUT_TYPE_EXT 0x8918
+#define GL_GEOMETRY_SHADER_INVOCATIONS_EXT 0x887F
+#define GL_LAYER_PROVOKING_VERTEX_EXT 0x825E
+#ifndef GL_EXT_geometry_shader4
+#define GL_LINES_ADJACENCY_EXT 0x000A
+#define GL_LINE_STRIP_ADJACENCY_EXT 0x000B
+#define GL_TRIANGLES_ADJACENCY_EXT 0x000C
+#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0x000D
+#endif /* GL_EXT_geometry_shader4 */
+#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF
+#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT 0x8A2C
+#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8A32
+#define GL_MAX_GEOMETRY_INPUT_COMPONENTS_EXT 0x9123
+#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_EXT 0x9124
+#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0
+#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1
+#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS_EXT 0x8E5A
+#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29
+#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT 0x92CF
+#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS_EXT 0x92D5
+#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT 0x90CD
+#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT 0x90D7
+#define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D
+#define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E
+#define GL_UNDEFINED_VERTEX_EXT 0x8260
+#define GL_PRIMITIVES_GENERATED_EXT 0x8C87
+#define GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT 0x9312
+#define GL_MAX_FRAMEBUFFER_LAYERS_EXT 0x9317
+#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8
+#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7
+#define GL_REFERENCED_BY_GEOMETRY_SHADER_EXT 0x9309
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glFramebufferTextureEXT (GLenum target, GLenum attachment, GLuint texture, GLint level);
+#endif
+#endif /* GL_EXT_geometry_shader */
+
+#ifndef GL_EXT_gpu_shader5
+#define GL_EXT_gpu_shader5 1
+#endif /* GL_EXT_gpu_shader5 */
+
+#ifndef GL_EXT_instanced_arrays
+#define GL_EXT_instanced_arrays 1
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_EXT 0x88FE
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISOREXTPROC) (GLuint index, GLuint divisor);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glVertexAttribDivisorEXT (GLuint index, GLuint divisor);
+#endif
+#endif /* GL_EXT_instanced_arrays */
+
+#ifndef GL_EXT_map_buffer_range
+#define GL_EXT_map_buffer_range 1
+#define GL_MAP_READ_BIT_EXT 0x0001
+#define GL_MAP_WRITE_BIT_EXT 0x0002
+#define GL_MAP_INVALIDATE_RANGE_BIT_EXT 0x0004
+#define GL_MAP_INVALIDATE_BUFFER_BIT_EXT 0x0008
+#define GL_MAP_FLUSH_EXPLICIT_BIT_EXT 0x0010
+#define GL_MAP_UNSYNCHRONIZED_BIT_EXT 0x0020
+typedef void *(GL_APIENTRYP PFNGLMAPBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void *GL_APIENTRY glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+GL_APICALL void GL_APIENTRY glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length);
+#endif
+#endif /* GL_EXT_map_buffer_range */
+
+#ifndef GL_EXT_multi_draw_arrays
+#define GL_EXT_multi_draw_arrays 1
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
+GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount);
+#endif
+#endif /* GL_EXT_multi_draw_arrays */
+
+#ifndef GL_EXT_multisampled_render_to_texture
+#define GL_EXT_multisampled_render_to_texture 1
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C
+#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
+#define GL_MAX_SAMPLES_EXT 0x8D57
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
+#endif
+#endif /* GL_EXT_multisampled_render_to_texture */
+
+#ifndef GL_EXT_multiview_draw_buffers
+#define GL_EXT_multiview_draw_buffers 1
+#define GL_COLOR_ATTACHMENT_EXT 0x90F0
+#define GL_MULTIVIEW_EXT 0x90F1
+#define GL_DRAW_BUFFER_EXT 0x0C01
+#define GL_READ_BUFFER_EXT 0x0C02
+#define GL_MAX_MULTIVIEW_BUFFERS_EXT 0x90F2
+typedef void (GL_APIENTRYP PFNGLREADBUFFERINDEXEDEXTPROC) (GLenum src, GLint index);
+typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSINDEXEDEXTPROC) (GLint n, const GLenum *location, const GLint *indices);
+typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VEXTPROC) (GLenum target, GLuint index, GLint *data);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glReadBufferIndexedEXT (GLenum src, GLint index);
+GL_APICALL void GL_APIENTRY glDrawBuffersIndexedEXT (GLint n, const GLenum *location, const GLint *indices);
+GL_APICALL void GL_APIENTRY glGetIntegeri_vEXT (GLenum target, GLuint index, GLint *data);
+#endif
+#endif /* GL_EXT_multiview_draw_buffers */
+
+#ifndef GL_EXT_occlusion_query_boolean
+#define GL_EXT_occlusion_query_boolean 1
+#define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F
+#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A
+#endif /* GL_EXT_occlusion_query_boolean */
+
+#ifndef GL_EXT_primitive_bounding_box
+#define GL_EXT_primitive_bounding_box 1
+#define GL_PRIMITIVE_BOUNDING_BOX_EXT 0x92BE
+typedef void (GL_APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXEXTPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glPrimitiveBoundingBoxEXT (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
+#endif
+#endif /* GL_EXT_primitive_bounding_box */
+
+#ifndef GL_EXT_pvrtc_sRGB
+#define GL_EXT_pvrtc_sRGB 1
+#define GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT 0x8A54
+#define GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT 0x8A55
+#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT 0x8A56
+#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT 0x8A57
+#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2_IMG 0x93F0
+#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV2_IMG 0x93F1
+#endif /* GL_EXT_pvrtc_sRGB */
+
+#ifndef GL_EXT_read_format_bgra
+#define GL_EXT_read_format_bgra 1
+#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365
+#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366
+#endif /* GL_EXT_read_format_bgra */
+
+#ifndef GL_EXT_robustness
+#define GL_EXT_robustness 1
+#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253
+#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254
+#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255
+#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3
+#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256
+#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252
+#define GL_NO_RESET_NOTIFICATION_EXT 0x8261
+typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void);
+typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void);
+GL_APICALL void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+GL_APICALL void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+#endif
+#endif /* GL_EXT_robustness */
+
+#ifndef GL_EXT_sRGB
+#define GL_EXT_sRGB 1
+#define GL_SRGB_EXT 0x8C40
+#define GL_SRGB_ALPHA_EXT 0x8C42
+#define GL_SRGB8_ALPHA8_EXT 0x8C43
+#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210
+#endif /* GL_EXT_sRGB */
+
+#ifndef GL_EXT_sRGB_write_control
+#define GL_EXT_sRGB_write_control 1
+#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9
+#endif /* GL_EXT_sRGB_write_control */
+
+#ifndef GL_EXT_separate_shader_objects
+#define GL_EXT_separate_shader_objects 1
+#define GL_ACTIVE_PROGRAM_EXT 0x8259
+#define GL_VERTEX_SHADER_BIT_EXT 0x00000001
+#define GL_FRAGMENT_SHADER_BIT_EXT 0x00000002
+#define GL_ALL_SHADER_BITS_EXT 0xFFFFFFFF
+#define GL_PROGRAM_SEPARABLE_EXT 0x8258
+#define GL_PROGRAM_PIPELINE_BINDING_EXT 0x825A
+typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMEXTPROC) (GLuint pipeline, GLuint program);
+typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
+typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar **strings);
+typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESEXTPROC) (GLsizei n, const GLuint *pipelines);
+typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESEXTPROC) (GLsizei n, GLuint *pipelines);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVEXTPROC) (GLuint pipeline, GLenum pname, GLint *params);
+typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
+typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat v0);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint v0);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESEXTPROC) (GLuint pipeline, GLbitfield stages, GLuint program);
+typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIEXTPROC) (GLuint program, GLint location, GLuint v0);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glActiveShaderProgramEXT (GLuint pipeline, GLuint program);
+GL_APICALL void GL_APIENTRY glBindProgramPipelineEXT (GLuint pipeline);
+GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramvEXT (GLenum type, GLsizei count, const GLchar **strings);
+GL_APICALL void GL_APIENTRY glDeleteProgramPipelinesEXT (GLsizei n, const GLuint *pipelines);
+GL_APICALL void GL_APIENTRY glGenProgramPipelinesEXT (GLsizei n, GLuint *pipelines);
+GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLogEXT (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GL_APICALL void GL_APIENTRY glGetProgramPipelineivEXT (GLuint pipeline, GLenum pname, GLint *params);
+GL_APICALL GLboolean GL_APIENTRY glIsProgramPipelineEXT (GLuint pipeline);
+GL_APICALL void GL_APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value);
+GL_APICALL void GL_APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat v0);
+GL_APICALL void GL_APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint v0);
+GL_APICALL void GL_APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1);
+GL_APICALL void GL_APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint v0, GLint v1);
+GL_APICALL void GL_APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+GL_APICALL void GL_APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
+GL_APICALL void GL_APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+GL_APICALL void GL_APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+GL_APICALL void GL_APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUseProgramStagesEXT (GLuint pipeline, GLbitfield stages, GLuint program);
+GL_APICALL void GL_APIENTRY glValidateProgramPipelineEXT (GLuint pipeline);
+GL_APICALL void GL_APIENTRY glProgramUniform1uiEXT (GLuint program, GLint location, GLuint v0);
+GL_APICALL void GL_APIENTRY glProgramUniform2uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1);
+GL_APICALL void GL_APIENTRY glProgramUniform3uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
+GL_APICALL void GL_APIENTRY glProgramUniform4uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+GL_APICALL void GL_APIENTRY glProgramUniform1uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+#endif
+#endif /* GL_EXT_separate_shader_objects */
+
+#ifndef GL_EXT_shader_framebuffer_fetch
+#define GL_EXT_shader_framebuffer_fetch 1
+#define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT 0x8A52
+#endif /* GL_EXT_shader_framebuffer_fetch */
+
+#ifndef GL_EXT_shader_implicit_conversions
+#define GL_EXT_shader_implicit_conversions 1
+#endif /* GL_EXT_shader_implicit_conversions */
+
+#ifndef GL_EXT_shader_integer_mix
+#define GL_EXT_shader_integer_mix 1
+#endif /* GL_EXT_shader_integer_mix */
+
+#ifndef GL_EXT_shader_io_blocks
+#define GL_EXT_shader_io_blocks 1
+#endif /* GL_EXT_shader_io_blocks */
+
+#ifndef GL_EXT_shader_pixel_local_storage
+#define GL_EXT_shader_pixel_local_storage 1
+#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_FAST_SIZE_EXT 0x8F63
+#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_SIZE_EXT 0x8F67
+#define GL_SHADER_PIXEL_LOCAL_STORAGE_EXT 0x8F64
+#endif /* GL_EXT_shader_pixel_local_storage */
+
+#ifndef GL_EXT_shader_texture_lod
+#define GL_EXT_shader_texture_lod 1
+#endif /* GL_EXT_shader_texture_lod */
+
+#ifndef GL_EXT_shadow_samplers
+#define GL_EXT_shadow_samplers 1
+#define GL_TEXTURE_COMPARE_MODE_EXT 0x884C
+#define GL_TEXTURE_COMPARE_FUNC_EXT 0x884D
+#define GL_COMPARE_REF_TO_TEXTURE_EXT 0x884E
+#define GL_SAMPLER_2D_SHADOW_EXT 0x8B62
+#endif /* GL_EXT_shadow_samplers */
+
+#ifndef GL_EXT_tessellation_point_size
+#define GL_EXT_tessellation_point_size 1
+#endif /* GL_EXT_tessellation_point_size */
+
+#ifndef GL_EXT_tessellation_shader
+#define GL_EXT_tessellation_shader 1
+#define GL_PATCHES_EXT 0x000E
+#define GL_PATCH_VERTICES_EXT 0x8E72
+#define GL_TESS_CONTROL_OUTPUT_VERTICES_EXT 0x8E75
+#define GL_TESS_GEN_MODE_EXT 0x8E76
+#define GL_TESS_GEN_SPACING_EXT 0x8E77
+#define GL_TESS_GEN_VERTEX_ORDER_EXT 0x8E78
+#define GL_TESS_GEN_POINT_MODE_EXT 0x8E79
+#define GL_ISOLINES_EXT 0x8E7A
+#define GL_QUADS_EXT 0x0007
+#define GL_FRACTIONAL_ODD_EXT 0x8E7B
+#define GL_FRACTIONAL_EVEN_EXT 0x8E7C
+#define GL_MAX_PATCH_VERTICES_EXT 0x8E7D
+#define GL_MAX_TESS_GEN_LEVEL_EXT 0x8E7E
+#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_EXT 0x8E7F
+#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT 0x8E80
+#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_EXT 0x8E81
+#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_EXT 0x8E82
+#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_EXT 0x8E83
+#define GL_MAX_TESS_PATCH_COMPONENTS_EXT 0x8E84
+#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_EXT 0x8E85
+#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_EXT 0x8E86
+#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_EXT 0x8E89
+#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_EXT 0x8E8A
+#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_EXT 0x886C
+#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_EXT 0x886D
+#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_EXT 0x8E1E
+#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT 0x8E1F
+#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_EXT 0x92CD
+#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_EXT 0x92CE
+#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_EXT 0x92D3
+#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_EXT 0x92D4
+#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_EXT 0x90CB
+#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_EXT 0x90CC
+#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_EXT 0x90D8
+#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_EXT 0x90D9
+#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221
+#define GL_IS_PER_PATCH_EXT 0x92E7
+#define GL_REFERENCED_BY_TESS_CONTROL_SHADER_EXT 0x9307
+#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER_EXT 0x9308
+#define GL_TESS_CONTROL_SHADER_EXT 0x8E88
+#define GL_TESS_EVALUATION_SHADER_EXT 0x8E87
+#define GL_TESS_CONTROL_SHADER_BIT_EXT 0x00000008
+#define GL_TESS_EVALUATION_SHADER_BIT_EXT 0x00000010
+typedef void (GL_APIENTRYP PFNGLPATCHPARAMETERIEXTPROC) (GLenum pname, GLint value);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glPatchParameteriEXT (GLenum pname, GLint value);
+#endif
+#endif /* GL_EXT_tessellation_shader */
+
+#ifndef GL_EXT_texture_border_clamp
+#define GL_EXT_texture_border_clamp 1
+#define GL_TEXTURE_BORDER_COLOR_EXT 0x1004
+#define GL_CLAMP_TO_BORDER_EXT 0x812D
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIIVEXTPROC) (GLuint sampler, GLenum pname, const GLint *param);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIUIVEXTPROC) (GLuint sampler, GLenum pname, const GLuint *param);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIIVEXTPROC) (GLuint sampler, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVEXTPROC) (GLuint sampler, GLenum pname, GLuint *params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexParameterIivEXT (GLenum target, GLenum pname, const GLint *params);
+GL_APICALL void GL_APIENTRY glTexParameterIuivEXT (GLenum target, GLenum pname, const GLuint *params);
+GL_APICALL void GL_APIENTRY glGetTexParameterIivEXT (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetTexParameterIuivEXT (GLenum target, GLenum pname, GLuint *params);
+GL_APICALL void GL_APIENTRY glSamplerParameterIivEXT (GLuint sampler, GLenum pname, const GLint *param);
+GL_APICALL void GL_APIENTRY glSamplerParameterIuivEXT (GLuint sampler, GLenum pname, const GLuint *param);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterIivEXT (GLuint sampler, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterIuivEXT (GLuint sampler, GLenum pname, GLuint *params);
+#endif
+#endif /* GL_EXT_texture_border_clamp */
+
+#ifndef GL_EXT_texture_buffer
+#define GL_EXT_texture_buffer 1
+#define GL_TEXTURE_BUFFER_EXT 0x8C2A
+#define GL_TEXTURE_BUFFER_BINDING_EXT 0x8C2A
+#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B
+#define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C
+#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D
+#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_EXT 0x919F
+#define GL_SAMPLER_BUFFER_EXT 0x8DC2
+#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0
+#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8
+#define GL_IMAGE_BUFFER_EXT 0x9051
+#define GL_INT_IMAGE_BUFFER_EXT 0x905C
+#define GL_UNSIGNED_INT_IMAGE_BUFFER_EXT 0x9067
+#define GL_TEXTURE_BUFFER_OFFSET_EXT 0x919D
+#define GL_TEXTURE_BUFFER_SIZE_EXT 0x919E
+typedef void (GL_APIENTRYP PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer);
+typedef void (GL_APIENTRYP PFNGLTEXBUFFERRANGEEXTPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexBufferEXT (GLenum target, GLenum internalformat, GLuint buffer);
+GL_APICALL void GL_APIENTRY glTexBufferRangeEXT (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
+#endif
+#endif /* GL_EXT_texture_buffer */
+
+#ifndef GL_EXT_texture_compression_dxt1
+#define GL_EXT_texture_compression_dxt1 1
+#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
+#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
+#endif /* GL_EXT_texture_compression_dxt1 */
+
+#ifndef GL_EXT_texture_compression_s3tc
+#define GL_EXT_texture_compression_s3tc 1
+#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
+#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
+#endif /* GL_EXT_texture_compression_s3tc */
+
+#ifndef GL_EXT_texture_cube_map_array
+#define GL_EXT_texture_cube_map_array 1
+#define GL_TEXTURE_CUBE_MAP_ARRAY_EXT 0x9009
+#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_EXT 0x900A
+#define GL_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900C
+#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_EXT 0x900D
+#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900E
+#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900F
+#define GL_IMAGE_CUBE_MAP_ARRAY_EXT 0x9054
+#define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x905F
+#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A
+#endif /* GL_EXT_texture_cube_map_array */
+
+#ifndef GL_EXT_texture_filter_anisotropic
+#define GL_EXT_texture_filter_anisotropic 1
+#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
+#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
+#endif /* GL_EXT_texture_filter_anisotropic */
+
+#ifndef GL_EXT_texture_format_BGRA8888
+#define GL_EXT_texture_format_BGRA8888 1
+#endif /* GL_EXT_texture_format_BGRA8888 */
+
+#ifndef GL_EXT_texture_rg
+#define GL_EXT_texture_rg 1
+#define GL_RED_EXT 0x1903
+#define GL_RG_EXT 0x8227
+#define GL_R8_EXT 0x8229
+#define GL_RG8_EXT 0x822B
+#endif /* GL_EXT_texture_rg */
+
+#ifndef GL_EXT_texture_sRGB_decode
+#define GL_EXT_texture_sRGB_decode 1
+#define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48
+#define GL_DECODE_EXT 0x8A49
+#define GL_SKIP_DECODE_EXT 0x8A4A
+#endif /* GL_EXT_texture_sRGB_decode */
+
+#ifndef GL_EXT_texture_storage
+#define GL_EXT_texture_storage 1
+#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F
+#define GL_ALPHA8_EXT 0x803C
+#define GL_LUMINANCE8_EXT 0x8040
+#define GL_LUMINANCE8_ALPHA8_EXT 0x8045
+#define GL_RGBA32F_EXT 0x8814
+#define GL_RGB32F_EXT 0x8815
+#define GL_ALPHA32F_EXT 0x8816
+#define GL_LUMINANCE32F_EXT 0x8818
+#define GL_LUMINANCE_ALPHA32F_EXT 0x8819
+#define GL_ALPHA16F_EXT 0x881C
+#define GL_LUMINANCE16F_EXT 0x881E
+#define GL_LUMINANCE_ALPHA16F_EXT 0x881F
+#define GL_R32F_EXT 0x822E
+#define GL_RG32F_EXT 0x8230
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+GL_APICALL void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+GL_APICALL void GL_APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+GL_APICALL void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+#endif
+#endif /* GL_EXT_texture_storage */
+
+#ifndef GL_EXT_texture_type_2_10_10_10_REV
+#define GL_EXT_texture_type_2_10_10_10_REV 1
+#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368
+#endif /* GL_EXT_texture_type_2_10_10_10_REV */
+
+#ifndef GL_EXT_texture_view
+#define GL_EXT_texture_view 1
+#define GL_TEXTURE_VIEW_MIN_LEVEL_EXT 0x82DB
+#define GL_TEXTURE_VIEW_NUM_LEVELS_EXT 0x82DC
+#define GL_TEXTURE_VIEW_MIN_LAYER_EXT 0x82DD
+#define GL_TEXTURE_VIEW_NUM_LAYERS_EXT 0x82DE
+#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF
+typedef void (GL_APIENTRYP PFNGLTEXTUREVIEWEXTPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTextureViewEXT (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
+#endif
+#endif /* GL_EXT_texture_view */
+
+#ifndef GL_EXT_unpack_subimage
+#define GL_EXT_unpack_subimage 1
+#define GL_UNPACK_ROW_LENGTH_EXT 0x0CF2
+#define GL_UNPACK_SKIP_ROWS_EXT 0x0CF3
+#define GL_UNPACK_SKIP_PIXELS_EXT 0x0CF4
+#endif /* GL_EXT_unpack_subimage */
+
+#ifndef GL_FJ_shader_binary_GCCSO
+#define GL_FJ_shader_binary_GCCSO 1
+#define GL_GCCSO_SHADER_BINARY_FJ 0x9260
+#endif /* GL_FJ_shader_binary_GCCSO */
+
+#ifndef GL_IMG_multisampled_render_to_texture
+#define GL_IMG_multisampled_render_to_texture 1
+#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134
+#define GL_MAX_SAMPLES_IMG 0x9135
+#define GL_TEXTURE_SAMPLES_IMG 0x9136
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
+#endif
+#endif /* GL_IMG_multisampled_render_to_texture */
+
+#ifndef GL_IMG_program_binary
+#define GL_IMG_program_binary 1
+#define GL_SGX_PROGRAM_BINARY_IMG 0x9130
+#endif /* GL_IMG_program_binary */
+
+#ifndef GL_IMG_read_format
+#define GL_IMG_read_format 1
+#define GL_BGRA_IMG 0x80E1
+#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365
+#endif /* GL_IMG_read_format */
+
+#ifndef GL_IMG_shader_binary
+#define GL_IMG_shader_binary 1
+#define GL_SGX_BINARY_IMG 0x8C0A
+#endif /* GL_IMG_shader_binary */
+
+#ifndef GL_IMG_texture_compression_pvrtc
+#define GL_IMG_texture_compression_pvrtc 1
+#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
+#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
+#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
+#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
+#endif /* GL_IMG_texture_compression_pvrtc */
+
+#ifndef GL_IMG_texture_compression_pvrtc2
+#define GL_IMG_texture_compression_pvrtc2 1
+#define GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG 0x9137
+#define GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG 0x9138
+#endif /* GL_IMG_texture_compression_pvrtc2 */
+
+#ifndef GL_INTEL_performance_query
+#define GL_INTEL_performance_query 1
+#define GL_PERFQUERY_SINGLE_CONTEXT_INTEL 0x00000000
+#define GL_PERFQUERY_GLOBAL_CONTEXT_INTEL 0x00000001
+#define GL_PERFQUERY_WAIT_INTEL 0x83FB
+#define GL_PERFQUERY_FLUSH_INTEL 0x83FA
+#define GL_PERFQUERY_DONOT_FLUSH_INTEL 0x83F9
+#define GL_PERFQUERY_COUNTER_EVENT_INTEL 0x94F0
+#define GL_PERFQUERY_COUNTER_DURATION_NORM_INTEL 0x94F1
+#define GL_PERFQUERY_COUNTER_DURATION_RAW_INTEL 0x94F2
+#define GL_PERFQUERY_COUNTER_THROUGHPUT_INTEL 0x94F3
+#define GL_PERFQUERY_COUNTER_RAW_INTEL 0x94F4
+#define GL_PERFQUERY_COUNTER_TIMESTAMP_INTEL 0x94F5
+#define GL_PERFQUERY_COUNTER_DATA_UINT32_INTEL 0x94F8
+#define GL_PERFQUERY_COUNTER_DATA_UINT64_INTEL 0x94F9
+#define GL_PERFQUERY_COUNTER_DATA_FLOAT_INTEL 0x94FA
+#define GL_PERFQUERY_COUNTER_DATA_DOUBLE_INTEL 0x94FB
+#define GL_PERFQUERY_COUNTER_DATA_BOOL32_INTEL 0x94FC
+#define GL_PERFQUERY_QUERY_NAME_LENGTH_MAX_INTEL 0x94FD
+#define GL_PERFQUERY_COUNTER_NAME_LENGTH_MAX_INTEL 0x94FE
+#define GL_PERFQUERY_COUNTER_DESC_LENGTH_MAX_INTEL 0x94FF
+#define GL_PERFQUERY_GPA_EXTENDED_COUNTERS_INTEL 0x9500
+typedef void (GL_APIENTRYP PFNGLBEGINPERFQUERYINTELPROC) (GLuint queryHandle);
+typedef void (GL_APIENTRYP PFNGLCREATEPERFQUERYINTELPROC) (GLuint queryId, GLuint *queryHandle);
+typedef void (GL_APIENTRYP PFNGLDELETEPERFQUERYINTELPROC) (GLuint queryHandle);
+typedef void (GL_APIENTRYP PFNGLENDPERFQUERYINTELPROC) (GLuint queryHandle);
+typedef void (GL_APIENTRYP PFNGLGETFIRSTPERFQUERYIDINTELPROC) (GLuint *queryId);
+typedef void (GL_APIENTRYP PFNGLGETNEXTPERFQUERYIDINTELPROC) (GLuint queryId, GLuint *nextQueryId);
+typedef void (GL_APIENTRYP PFNGLGETPERFCOUNTERINFOINTELPROC) (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue);
+typedef void (GL_APIENTRYP PFNGLGETPERFQUERYDATAINTELPROC) (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid *data, GLuint *bytesWritten);
+typedef void (GL_APIENTRYP PFNGLGETPERFQUERYIDBYNAMEINTELPROC) (GLchar *queryName, GLuint *queryId);
+typedef void (GL_APIENTRYP PFNGLGETPERFQUERYINFOINTELPROC) (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBeginPerfQueryINTEL (GLuint queryHandle);
+GL_APICALL void GL_APIENTRY glCreatePerfQueryINTEL (GLuint queryId, GLuint *queryHandle);
+GL_APICALL void GL_APIENTRY glDeletePerfQueryINTEL (GLuint queryHandle);
+GL_APICALL void GL_APIENTRY glEndPerfQueryINTEL (GLuint queryHandle);
+GL_APICALL void GL_APIENTRY glGetFirstPerfQueryIdINTEL (GLuint *queryId);
+GL_APICALL void GL_APIENTRY glGetNextPerfQueryIdINTEL (GLuint queryId, GLuint *nextQueryId);
+GL_APICALL void GL_APIENTRY glGetPerfCounterInfoINTEL (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue);
+GL_APICALL void GL_APIENTRY glGetPerfQueryDataINTEL (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid *data, GLuint *bytesWritten);
+GL_APICALL void GL_APIENTRY glGetPerfQueryIdByNameINTEL (GLchar *queryName, GLuint *queryId);
+GL_APICALL void GL_APIENTRY glGetPerfQueryInfoINTEL (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask);
+#endif
+#endif /* GL_INTEL_performance_query */
+
+#ifndef GL_NV_blend_equation_advanced
+#define GL_NV_blend_equation_advanced 1
+#define GL_BLEND_OVERLAP_NV 0x9281
+#define GL_BLEND_PREMULTIPLIED_SRC_NV 0x9280
+#define GL_BLUE_NV 0x1905
+#define GL_COLORBURN_NV 0x929A
+#define GL_COLORDODGE_NV 0x9299
+#define GL_CONJOINT_NV 0x9284
+#define GL_CONTRAST_NV 0x92A1
+#define GL_DARKEN_NV 0x9297
+#define GL_DIFFERENCE_NV 0x929E
+#define GL_DISJOINT_NV 0x9283
+#define GL_DST_ATOP_NV 0x928F
+#define GL_DST_IN_NV 0x928B
+#define GL_DST_NV 0x9287
+#define GL_DST_OUT_NV 0x928D
+#define GL_DST_OVER_NV 0x9289
+#define GL_EXCLUSION_NV 0x92A0
+#define GL_GREEN_NV 0x1904
+#define GL_HARDLIGHT_NV 0x929B
+#define GL_HARDMIX_NV 0x92A9
+#define GL_HSL_COLOR_NV 0x92AF
+#define GL_HSL_HUE_NV 0x92AD
+#define GL_HSL_LUMINOSITY_NV 0x92B0
+#define GL_HSL_SATURATION_NV 0x92AE
+#define GL_INVERT_OVG_NV 0x92B4
+#define GL_INVERT_RGB_NV 0x92A3
+#define GL_LIGHTEN_NV 0x9298
+#define GL_LINEARBURN_NV 0x92A5
+#define GL_LINEARDODGE_NV 0x92A4
+#define GL_LINEARLIGHT_NV 0x92A7
+#define GL_MINUS_CLAMPED_NV 0x92B3
+#define GL_MINUS_NV 0x929F
+#define GL_MULTIPLY_NV 0x9294
+#define GL_OVERLAY_NV 0x9296
+#define GL_PINLIGHT_NV 0x92A8
+#define GL_PLUS_CLAMPED_ALPHA_NV 0x92B2
+#define GL_PLUS_CLAMPED_NV 0x92B1
+#define GL_PLUS_DARKER_NV 0x9292
+#define GL_PLUS_NV 0x9291
+#define GL_RED_NV 0x1903
+#define GL_SCREEN_NV 0x9295
+#define GL_SOFTLIGHT_NV 0x929C
+#define GL_SRC_ATOP_NV 0x928E
+#define GL_SRC_IN_NV 0x928A
+#define GL_SRC_NV 0x9286
+#define GL_SRC_OUT_NV 0x928C
+#define GL_SRC_OVER_NV 0x9288
+#define GL_UNCORRELATED_NV 0x9282
+#define GL_VIVIDLIGHT_NV 0x92A6
+#define GL_XOR_NV 0x1506
+typedef void (GL_APIENTRYP PFNGLBLENDPARAMETERINVPROC) (GLenum pname, GLint value);
+typedef void (GL_APIENTRYP PFNGLBLENDBARRIERNVPROC) (void);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBlendParameteriNV (GLenum pname, GLint value);
+GL_APICALL void GL_APIENTRY glBlendBarrierNV (void);
+#endif
+#endif /* GL_NV_blend_equation_advanced */
+
+#ifndef GL_NV_blend_equation_advanced_coherent
+#define GL_NV_blend_equation_advanced_coherent 1
+#define GL_BLEND_ADVANCED_COHERENT_NV 0x9285
+#endif /* GL_NV_blend_equation_advanced_coherent */
+
+#ifndef GL_NV_copy_buffer
+#define GL_NV_copy_buffer 1
+#define GL_COPY_READ_BUFFER_NV 0x8F36
+#define GL_COPY_WRITE_BUFFER_NV 0x8F37
+typedef void (GL_APIENTRYP PFNGLCOPYBUFFERSUBDATANVPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCopyBufferSubDataNV (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+#endif
+#endif /* GL_NV_copy_buffer */
+
+#ifndef GL_NV_coverage_sample
+#define GL_NV_coverage_sample 1
+#define GL_COVERAGE_COMPONENT_NV 0x8ED0
+#define GL_COVERAGE_COMPONENT4_NV 0x8ED1
+#define GL_COVERAGE_ATTACHMENT_NV 0x8ED2
+#define GL_COVERAGE_BUFFERS_NV 0x8ED3
+#define GL_COVERAGE_SAMPLES_NV 0x8ED4
+#define GL_COVERAGE_ALL_FRAGMENTS_NV 0x8ED5
+#define GL_COVERAGE_EDGE_FRAGMENTS_NV 0x8ED6
+#define GL_COVERAGE_AUTOMATIC_NV 0x8ED7
+#define GL_COVERAGE_BUFFER_BIT_NV 0x00008000
+typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask);
+typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCoverageMaskNV (GLboolean mask);
+GL_APICALL void GL_APIENTRY glCoverageOperationNV (GLenum operation);
+#endif
+#endif /* GL_NV_coverage_sample */
+
+#ifndef GL_NV_depth_nonlinear
+#define GL_NV_depth_nonlinear 1
+#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C
+#endif /* GL_NV_depth_nonlinear */
+
+#ifndef GL_NV_draw_buffers
+#define GL_NV_draw_buffers 1
+#define GL_MAX_DRAW_BUFFERS_NV 0x8824
+#define GL_DRAW_BUFFER0_NV 0x8825
+#define GL_DRAW_BUFFER1_NV 0x8826
+#define GL_DRAW_BUFFER2_NV 0x8827
+#define GL_DRAW_BUFFER3_NV 0x8828
+#define GL_DRAW_BUFFER4_NV 0x8829
+#define GL_DRAW_BUFFER5_NV 0x882A
+#define GL_DRAW_BUFFER6_NV 0x882B
+#define GL_DRAW_BUFFER7_NV 0x882C
+#define GL_DRAW_BUFFER8_NV 0x882D
+#define GL_DRAW_BUFFER9_NV 0x882E
+#define GL_DRAW_BUFFER10_NV 0x882F
+#define GL_DRAW_BUFFER11_NV 0x8830
+#define GL_DRAW_BUFFER12_NV 0x8831
+#define GL_DRAW_BUFFER13_NV 0x8832
+#define GL_DRAW_BUFFER14_NV 0x8833
+#define GL_DRAW_BUFFER15_NV 0x8834
+#define GL_COLOR_ATTACHMENT0_NV 0x8CE0
+#define GL_COLOR_ATTACHMENT1_NV 0x8CE1
+#define GL_COLOR_ATTACHMENT2_NV 0x8CE2
+#define GL_COLOR_ATTACHMENT3_NV 0x8CE3
+#define GL_COLOR_ATTACHMENT4_NV 0x8CE4
+#define GL_COLOR_ATTACHMENT5_NV 0x8CE5
+#define GL_COLOR_ATTACHMENT6_NV 0x8CE6
+#define GL_COLOR_ATTACHMENT7_NV 0x8CE7
+#define GL_COLOR_ATTACHMENT8_NV 0x8CE8
+#define GL_COLOR_ATTACHMENT9_NV 0x8CE9
+#define GL_COLOR_ATTACHMENT10_NV 0x8CEA
+#define GL_COLOR_ATTACHMENT11_NV 0x8CEB
+#define GL_COLOR_ATTACHMENT12_NV 0x8CEC
+#define GL_COLOR_ATTACHMENT13_NV 0x8CED
+#define GL_COLOR_ATTACHMENT14_NV 0x8CEE
+#define GL_COLOR_ATTACHMENT15_NV 0x8CEF
+typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSNVPROC) (GLsizei n, const GLenum *bufs);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawBuffersNV (GLsizei n, const GLenum *bufs);
+#endif
+#endif /* GL_NV_draw_buffers */
+
+#ifndef GL_NV_draw_instanced
+#define GL_NV_draw_instanced 1
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDNVPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDNVPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawArraysInstancedNV (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+GL_APICALL void GL_APIENTRY glDrawElementsInstancedNV (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+#endif
+#endif /* GL_NV_draw_instanced */
+
+#ifndef GL_NV_explicit_attrib_location
+#define GL_NV_explicit_attrib_location 1
+#endif /* GL_NV_explicit_attrib_location */
+
+#ifndef GL_NV_fbo_color_attachments
+#define GL_NV_fbo_color_attachments 1
+#define GL_MAX_COLOR_ATTACHMENTS_NV 0x8CDF
+#endif /* GL_NV_fbo_color_attachments */
+
+#ifndef GL_NV_fence
+#define GL_NV_fence 1
+#define GL_ALL_COMPLETED_NV 0x84F2
+#define GL_FENCE_STATUS_NV 0x84F3
+#define GL_FENCE_CONDITION_NV 0x84F4
+typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences);
+typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences);
+typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence);
+typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence);
+typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence);
+typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDeleteFencesNV (GLsizei n, const GLuint *fences);
+GL_APICALL void GL_APIENTRY glGenFencesNV (GLsizei n, GLuint *fences);
+GL_APICALL GLboolean GL_APIENTRY glIsFenceNV (GLuint fence);
+GL_APICALL GLboolean GL_APIENTRY glTestFenceNV (GLuint fence);
+GL_APICALL void GL_APIENTRY glGetFenceivNV (GLuint fence, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glFinishFenceNV (GLuint fence);
+GL_APICALL void GL_APIENTRY glSetFenceNV (GLuint fence, GLenum condition);
+#endif
+#endif /* GL_NV_fence */
+
+#ifndef GL_NV_framebuffer_blit
+#define GL_NV_framebuffer_blit 1
+#define GL_READ_FRAMEBUFFER_NV 0x8CA8
+#define GL_DRAW_FRAMEBUFFER_NV 0x8CA9
+#define GL_DRAW_FRAMEBUFFER_BINDING_NV 0x8CA6
+#define GL_READ_FRAMEBUFFER_BINDING_NV 0x8CAA
+typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERNVPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBlitFramebufferNV (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#endif
+#endif /* GL_NV_framebuffer_blit */
+
+#ifndef GL_NV_framebuffer_multisample
+#define GL_NV_framebuffer_multisample 1
+#define GL_RENDERBUFFER_SAMPLES_NV 0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_NV 0x8D56
+#define GL_MAX_SAMPLES_NV 0x8D57
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLENVPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleNV (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+#endif
+#endif /* GL_NV_framebuffer_multisample */
+
+#ifndef GL_NV_generate_mipmap_sRGB
+#define GL_NV_generate_mipmap_sRGB 1
+#endif /* GL_NV_generate_mipmap_sRGB */
+
+#ifndef GL_NV_instanced_arrays
+#define GL_NV_instanced_arrays 1
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_NV 0x88FE
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORNVPROC) (GLuint index, GLuint divisor);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glVertexAttribDivisorNV (GLuint index, GLuint divisor);
+#endif
+#endif /* GL_NV_instanced_arrays */
+
+#ifndef GL_NV_non_square_matrices
+#define GL_NV_non_square_matrices 1
+#define GL_FLOAT_MAT2x3_NV 0x8B65
+#define GL_FLOAT_MAT2x4_NV 0x8B66
+#define GL_FLOAT_MAT3x2_NV 0x8B67
+#define GL_FLOAT_MAT3x4_NV 0x8B68
+#define GL_FLOAT_MAT4x2_NV 0x8B69
+#define GL_FLOAT_MAT4x3_NV 0x8B6A
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X3FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X2FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X4FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X2FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X4FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X3FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glUniformMatrix2x3fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3x2fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix2x4fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4x2fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3x4fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4x3fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+#endif
+#endif /* GL_NV_non_square_matrices */
+
+#ifndef GL_NV_read_buffer
+#define GL_NV_read_buffer 1
+#define GL_READ_BUFFER_NV 0x0C02
+typedef void (GL_APIENTRYP PFNGLREADBUFFERNVPROC) (GLenum mode);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glReadBufferNV (GLenum mode);
+#endif
+#endif /* GL_NV_read_buffer */
+
+#ifndef GL_NV_read_buffer_front
+#define GL_NV_read_buffer_front 1
+#endif /* GL_NV_read_buffer_front */
+
+#ifndef GL_NV_read_depth
+#define GL_NV_read_depth 1
+#endif /* GL_NV_read_depth */
+
+#ifndef GL_NV_read_depth_stencil
+#define GL_NV_read_depth_stencil 1
+#endif /* GL_NV_read_depth_stencil */
+
+#ifndef GL_NV_read_stencil
+#define GL_NV_read_stencil 1
+#endif /* GL_NV_read_stencil */
+
+#ifndef GL_NV_sRGB_formats
+#define GL_NV_sRGB_formats 1
+#define GL_SLUMINANCE_NV 0x8C46
+#define GL_SLUMINANCE_ALPHA_NV 0x8C44
+#define GL_SRGB8_NV 0x8C41
+#define GL_SLUMINANCE8_NV 0x8C47
+#define GL_SLUMINANCE8_ALPHA8_NV 0x8C45
+#define GL_COMPRESSED_SRGB_S3TC_DXT1_NV 0x8C4C
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV 0x8C4D
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV 0x8C4E
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV 0x8C4F
+#define GL_ETC1_SRGB8_NV 0x88EE
+#endif /* GL_NV_sRGB_formats */
+
+#ifndef GL_NV_shadow_samplers_array
+#define GL_NV_shadow_samplers_array 1
+#define GL_SAMPLER_2D_ARRAY_SHADOW_NV 0x8DC4
+#endif /* GL_NV_shadow_samplers_array */
+
+#ifndef GL_NV_shadow_samplers_cube
+#define GL_NV_shadow_samplers_cube 1
+#define GL_SAMPLER_CUBE_SHADOW_NV 0x8DC5
+#endif /* GL_NV_shadow_samplers_cube */
+
+#ifndef GL_NV_texture_border_clamp
+#define GL_NV_texture_border_clamp 1
+#define GL_TEXTURE_BORDER_COLOR_NV 0x1004
+#define GL_CLAMP_TO_BORDER_NV 0x812D
+#endif /* GL_NV_texture_border_clamp */
+
+#ifndef GL_NV_texture_compression_s3tc_update
+#define GL_NV_texture_compression_s3tc_update 1
+#endif /* GL_NV_texture_compression_s3tc_update */
+
+#ifndef GL_NV_texture_npot_2D_mipmap
+#define GL_NV_texture_npot_2D_mipmap 1
+#endif /* GL_NV_texture_npot_2D_mipmap */
+
+#ifndef GL_QCOM_alpha_test
+#define GL_QCOM_alpha_test 1
+#define GL_ALPHA_TEST_QCOM 0x0BC0
+#define GL_ALPHA_TEST_FUNC_QCOM 0x0BC1
+#define GL_ALPHA_TEST_REF_QCOM 0x0BC2
+typedef void (GL_APIENTRYP PFNGLALPHAFUNCQCOMPROC) (GLenum func, GLclampf ref);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glAlphaFuncQCOM (GLenum func, GLclampf ref);
+#endif
+#endif /* GL_QCOM_alpha_test */
+
+#ifndef GL_QCOM_binning_control
+#define GL_QCOM_binning_control 1
+#define GL_BINNING_CONTROL_HINT_QCOM 0x8FB0
+#define GL_CPU_OPTIMIZED_QCOM 0x8FB1
+#define GL_GPU_OPTIMIZED_QCOM 0x8FB2
+#define GL_RENDER_DIRECT_TO_FRAMEBUFFER_QCOM 0x8FB3
+#endif /* GL_QCOM_binning_control */
+
+#ifndef GL_QCOM_driver_control
+#define GL_QCOM_driver_control 1
+typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls);
+typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
+typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
+typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls);
+GL_APICALL void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
+GL_APICALL void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl);
+GL_APICALL void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl);
+#endif
+#endif /* GL_QCOM_driver_control */
+
+#ifndef GL_QCOM_extended_get
+#define GL_QCOM_extended_get 1
+#define GL_TEXTURE_WIDTH_QCOM 0x8BD2
+#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3
+#define GL_TEXTURE_DEPTH_QCOM 0x8BD4
+#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5
+#define GL_TEXTURE_FORMAT_QCOM 0x8BD6
+#define GL_TEXTURE_TYPE_QCOM 0x8BD7
+#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8
+#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9
+#define GL_TEXTURE_TARGET_QCOM 0x8BDA
+#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB
+#define GL_STATE_RESTORE 0x8BDC
+typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures);
+typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
+typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
+typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
+typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void *texels);
+typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, void **params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures);
+GL_APICALL void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
+GL_APICALL void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
+GL_APICALL void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
+GL_APICALL void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void *texels);
+GL_APICALL void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, void **params);
+#endif
+#endif /* GL_QCOM_extended_get */
+
+#ifndef GL_QCOM_extended_get2
+#define GL_QCOM_extended_get2 1
+typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders);
+typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
+typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program);
+typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders);
+GL_APICALL void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
+GL_APICALL GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program);
+GL_APICALL void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
+#endif
+#endif /* GL_QCOM_extended_get2 */
+
+#ifndef GL_QCOM_perfmon_global_mode
+#define GL_QCOM_perfmon_global_mode 1
+#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0
+#endif /* GL_QCOM_perfmon_global_mode */
+
+#ifndef GL_QCOM_tiled_rendering
+#define GL_QCOM_tiled_rendering 1
+#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001
+#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002
+#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004
+#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008
+#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010
+#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020
+#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040
+#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080
+#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100
+#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200
+#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400
+#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800
+#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000
+#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000
+#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000
+#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000
+#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000
+#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000
+#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000
+#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000
+#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000
+#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000
+#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000
+#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000
+#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000
+#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000
+#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000
+#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000
+#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000
+#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000
+#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000
+#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000
+typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
+typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
+GL_APICALL void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask);
+#endif
+#endif /* GL_QCOM_tiled_rendering */
+
+#ifndef GL_QCOM_writeonly_rendering
+#define GL_QCOM_writeonly_rendering 1
+#define GL_WRITEONLY_RENDERING_QCOM 0x8823
+#endif /* GL_QCOM_writeonly_rendering */
+
+#ifndef GL_VIV_shader_binary
+#define GL_VIV_shader_binary 1
+#define GL_SHADER_BINARY_VIV 0x8FC4
+#endif /* GL_VIV_shader_binary */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/third_party/mojo/src/mojo/public/c/gpu/GLES2/gl2extmojo.h b/third_party/mojo/src/mojo/public/c/gpu/GLES2/gl2extmojo.h
new file mode 100644
index 0000000..1aa9cdd
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/c/gpu/GLES2/gl2extmojo.h
@@ -0,0 +1,785 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file contains Mojo-specific GLES2 extensions declarations.
+
+#ifndef GPU_GLES2_GL2EXTMOJO_H_
+#define GPU_GLES2_GL2EXTMOJO_H_
+
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* GL_CHROMIUM_iosurface */
+#ifndef GL_CHROMIUM_iosurface
+#define GL_CHROMIUM_iosurface 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexImageIOSurface2DCHROMIUM(
+ GLenum target, GLsizei width, GLsizei height, GLuint ioSurfaceId,
+ GLuint plane);
+#endif
+typedef void (GL_APIENTRYP PFNGLTEXIMAGEIOSURFACE2DCHROMIUMPROC) (
+ GLenum target, GLsizei width, GLsizei height, GLuint ioSurfaceId,
+ GLuint plane);
+#endif /* GL_CHROMIUM_iosurface */
+
+/* GL_CHROMIUM_gpu_memory_manager */
+#ifndef GL_CHROMIUM_gpu_memory_manager
+#define GL_CHROMIUM_gpu_memory_manager 1
+
+#ifndef GL_TEXTURE_POOL_UNMANAGED_CHROMIUM
+#define GL_TEXTURE_POOL_UNMANAGED_CHROMIUM 0x6002
+#endif
+
+#ifndef GL_TEXTURE_POOL_CHROMIUM
+#define GL_TEXTURE_POOL_CHROMIUM 0x6000
+#endif
+
+#ifndef GL_TEXTURE_POOL_MANAGED_CHROMIUM
+#define GL_TEXTURE_POOL_MANAGED_CHROMIUM 0x6001
+#endif
+#endif /* GL_CHROMIUM_gpu_memory_manager */
+
+/* GL_CHROMIUM_texture_mailbox */
+#ifndef GL_CHROMIUM_texture_mailbox
+#define GL_CHROMIUM_texture_mailbox 1
+
+#ifndef GL_MAILBOX_SIZE_CHROMIUM
+#define GL_MAILBOX_SIZE_CHROMIUM 64
+#endif
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGenMailboxCHROMIUM(GLbyte* mailbox);
+GL_APICALL void GL_APIENTRY glProduceTextureCHROMIUM(
+ GLenum target, const GLbyte* mailbox);
+GL_APICALL void GL_APIENTRY glProduceTextureDirectCHROMIUM(
+ GLuint texture, GLenum target, const GLbyte* mailbox);
+GL_APICALL void GL_APIENTRY glConsumeTextureCHROMIUM(
+ GLenum target, const GLbyte* mailbox);
+GL_APICALL GLuint GL_APIENTRY glCreateAndConsumeTextureCHROMIUM(
+ GLenum target, const GLbyte* mailbox);
+#endif
+typedef void (GL_APIENTRYP PFNGLGENMAILBOXCHROMIUMPROC) (GLbyte* mailbox);
+typedef void (GL_APIENTRYP PFNGLPRODUCETEXTURECHROMIUMPROC) (
+ GLenum target, const GLbyte* mailbox);
+typedef void (GL_APIENTRYP PFNGLPRODUCETEXTUREDIRECTCHROMIUMPROC) (
+ GLuint texture, GLenum target, const GLbyte* mailbox);
+typedef void (GL_APIENTRYP PFNGLCONSUMETEXTURECHROMIUMPROC) (
+ GLenum target, const GLbyte* mailbox);
+typedef GLuint (GL_APIENTRYP PFNGLCREATEANDCONSUMETEXTURECHROMIUMPROC) (
+ GLenum target, const GLbyte* mailbox);
+#endif /* GL_CHROMIUM_texture_mailbox */
+
+/* GL_CHROMIUM_pixel_transfer_buffer_object */
+#ifndef GL_CHROMIUM_pixel_transfer_buffer_object
+#define GL_CHROMIUM_pixel_transfer_buffer_object 1
+
+#ifndef GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM
+// TODO(reveman): Get official numbers for this constants.
+#define GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM 0x78EC
+#define GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM 0x78ED
+
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void* GL_APIENTRY glMapBufferCHROMIUM(GLuint target,GLenum access);
+GL_APICALL GLboolean GL_APIENTRY glUnmapBufferCHROMIUM(GLuint target);
+#endif
+typedef void* (GL_APIENTRY PFNGLMAPBUFFERCHROMIUM) (
+ GLuint target,GLenum access);
+typedef GLboolean (GL_APIENTRY PFNGLUNMAPBUFFERCHROMIUM) (GLuint target);
+#endif /* GL_CHROMIUM_pixel_transfer_buffer_object */
+
+#ifndef GL_PIXEL_UNPACK_TRANSFER_BUFFER_BINDING_CHROMIUM
+// TODO(reveman): Get official numbers for this constants.
+#define GL_PIXEL_UNPACK_TRANSFER_BUFFER_BINDING_CHROMIUM 0x78EF
+#define GL_PIXEL_PACK_TRANSFER_BUFFER_BINDING_CHROMIUM 0x78EE
+#endif
+
+#ifndef GL_STREAM_READ
+#define GL_STREAM_READ 0x88E1
+#endif
+#endif /* GL_CHROMIUM_pixel_transfer_buffer_object */
+
+/* GL_CHROMIUM_image */
+#ifndef GL_CHROMIUM_image
+#define GL_CHROMIUM_image 1
+
+typedef struct _ClientBuffer* ClientBuffer;
+
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL GLuint GL_APIENTRY glCreateImageCHROMIUM(ClientBuffer buffer,
+ GLsizei width,
+ GLsizei height,
+ GLenum internalformat);
+GL_APICALL void GL_APIENTRY glDestroyImageCHROMIUM(GLuint image_id);
+#endif
+typedef GLuint(GL_APIENTRYP PFNGLCREATEIMAGECHROMIUMPROC)(
+ ClientBuffer buffer,
+ GLsizei width,
+ GLsizei height,
+ GLenum internalformat);
+typedef void (
+ GL_APIENTRYP PFNGLDESTROYIMAGECHROMIUMPROC)(GLuint image_id);
+#endif /* GL_CHROMIUM_image */
+
+ /* GL_CHROMIUM_gpu_memory_buffer_image */
+#ifndef GL_CHROMIUM_gpu_memory_buffer_image
+#define GL_CHROMIUM_gpu_memory_buffer_image 1
+
+#ifndef GL_MAP_CHROMIUM
+#define GL_MAP_CHROMIUM 0x78F1
+#endif
+
+#ifndef GL_SCANOUT_CHROMIUM
+#define GL_SCANOUT_CHROMIUM 0x78F2
+#endif
+
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL GLuint GL_APIENTRY glCreateGpuMemoryBufferImageCHROMIUM(
+ GLsizei width,
+ GLsizei height,
+ GLenum internalformat,
+ GLenum usage);
+#endif
+typedef GLuint(GL_APIENTRYP PFNGLCREATEGPUMEMORYBUFFERIMAGECHROMIUMPROC)(
+ GLsizei width,
+ GLsizei height,
+ GLenum internalformat,
+ GLenum usage);
+#endif /* GL_CHROMIUM_gpu_memory_buffer_image */
+
+/* GL_CHROMIUM_map_sub */
+#ifndef GL_CHROMIUM_map_sub
+#define GL_CHROMIUM_map_sub 1
+
+#ifndef GL_READ_ONLY
+#define GL_READ_ONLY 0x88B8
+#endif
+
+#ifndef GL_WRITE_ONLY
+#define GL_WRITE_ONLY 0x88B9
+#endif
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void* GL_APIENTRY glMapBufferSubDataCHROMIUM(
+ GLuint target, GLintptr offset, GLsizeiptr size, GLenum access);
+GL_APICALL void GL_APIENTRY glUnmapBufferSubDataCHROMIUM(const void* mem);
+GL_APICALL void* GL_APIENTRY glMapTexSubImage2DCHROMIUM(
+ GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
+ GLsizei height, GLenum format, GLenum type, GLenum access);
+GL_APICALL void GL_APIENTRY glUnmapTexSubImage2DCHROMIUM(const void* mem);
+#endif
+typedef void* (GL_APIENTRYP PFNGLMAPBUFFERSUBDATACHROMIUMPROC) (
+ GLuint target, GLintptr offset, GLsizeiptr size, GLenum access);
+typedef void (
+ GL_APIENTRYP PFNGLUNMAPBUFFERSUBDATACHROMIUMPROC) (const void* mem);
+typedef void* (GL_APIENTRYP PFNGLMAPTEXSUBIMAGE2DCHROMIUMPROC) (
+ GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
+ GLsizei height, GLenum format, GLenum type, GLenum access);
+typedef void (
+ GL_APIENTRYP PFNGLUNMAPTEXSUBIMAGE2DCHROMIUMPROC) (const void* mem);
+#endif /* GL_CHROMIUM_map_sub */
+
+/* GL_CHROMIUM_request_extension */
+#ifndef GL_CHROMIUM_request_extension
+#define GL_CHROMIUM_request_extension 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL const GLchar* GL_APIENTRY glGetRequestableExtensionsCHROMIUM();
+GL_APICALL void GL_APIENTRY glRequestExtensionCHROMIUM(const char* extension);
+#endif
+typedef const GLchar* (GL_APIENTRYP PFNGLGETREQUESTABLEEXTENSIONSCHROMIUMPROC) (
+ );
+typedef void (GL_APIENTRYP PFNGLREQUESTEXTENSIONCHROMIUMPROC) (
+ const char* extension);
+#endif /* GL_CHROMIUM_request_extension */
+
+/* GL_CHROMIUM_get_error_query */
+#ifndef GL_CHROMIUM_get_error_query
+#define GL_CHROMIUM_get_error_query 1
+
+#ifndef GL_GET_ERROR_QUERY_CHROMIUM
+// TODO(gman): Get official numbers for this constants.
+#define GL_GET_ERROR_QUERY_CHROMIUM 0x6003
+#endif
+#endif /* GL_CHROMIUM_get_error_query */
+
+/* GL_CHROMIUM_texture_from_image */
+#ifndef GL_CHROMIUM_texture_from_image
+#define GL_CHROMIUM_texture_from_image 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBindTexImage2DCHROMIUM(
+ GLenum target, GLint imageId);
+GL_APICALL void GL_APIENTRY glReleaseTexImage2DCHROMIUM(
+ GLenum target, GLint imageId);
+#endif
+typedef void (GL_APIENTRYP PFNGLBINDTEXIMAGE2DCHROMIUMPROC) (
+ GLenum target, GLint imageId);
+typedef void (GL_APIENTRYP PFNGLRELEASETEXIMAGE2DCHROMIUMPROC) (
+ GLenum target, GLint imageId);
+#endif /* GL_CHROMIUM_texture_from_image */
+
+/* GL_CHROMIUM_rate_limit_offscreen_context */
+#ifndef GL_CHROMIUM_rate_limit_offscreen_context
+#define GL_CHROMIUM_rate_limit_offscreen_context 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRateLimitOffscreenContextCHROMIUM();
+#endif
+typedef void (GL_APIENTRYP PFNGLRATELIMITOFFSCREENCONTEXTCHROMIUMPROC) ();
+#endif /* GL_CHROMIUM_rate_limit_offscreen_context */
+
+/* GL_CHROMIUM_post_sub_buffer */
+#ifndef GL_CHROMIUM_post_sub_buffer
+#define GL_CHROMIUM_post_sub_buffer 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glPostSubBufferCHROMIUM(
+ GLint x, GLint y, GLint width, GLint height);
+#endif
+typedef void (GL_APIENTRYP PFNGLPOSTSUBBUFFERCHROMIUMPROC) (
+ GLint x, GLint y, GLint width, GLint height);
+#endif /* GL_CHROMIUM_post_sub_buffer */
+
+/* GL_CHROMIUM_bind_uniform_location */
+#ifndef GL_CHROMIUM_bind_uniform_location
+#define GL_CHROMIUM_bind_uniform_location 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBindUniformLocationCHROMIUM(
+ GLuint program, GLint location, const char* name);
+#endif
+typedef void (GL_APIENTRYP PFNGLBINDUNIFORMLOCATIONCHROMIUMPROC) (
+ GLuint program, GLint location, const char* name);
+#endif /* GL_CHROMIUM_bind_uniform_location */
+
+/* GL_CHROMIUM_command_buffer_query */
+#ifndef GL_CHROMIUM_command_buffer_query
+#define GL_CHROMIUM_command_buffer_query 1
+
+#ifndef GL_COMMANDS_ISSUED_CHROMIUM
+// TODO(gman): Get official numbers for this constants.
+#define GL_COMMANDS_ISSUED_CHROMIUM 0x6004
+#endif
+#endif /* GL_CHROMIUM_command_buffer_query */
+
+/* GL_CHROMIUM_framebuffer_multisample */
+#ifndef GL_CHROMIUM_framebuffer_multisample
+#define GL_CHROMIUM_framebuffer_multisample 1
+
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleCHROMIUM (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
+GL_APICALL void GL_APIENTRY glBlitFramebufferCHROMIUM (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#endif
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLECHROMIUMPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERCHROMIUMPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+
+#ifndef GL_FRAMEBUFFER_BINDING_EXT
+#define GL_FRAMEBUFFER_BINDING_EXT GL_FRAMEBUFFER_BINDING
+#endif
+
+#ifndef GL_DRAW_FRAMEBUFFER_BINDING_EXT
+#define GL_DRAW_FRAMEBUFFER_BINDING_EXT GL_DRAW_FRAMEBUFFER_BINDING
+#endif
+
+#ifndef GL_RENDERBUFFER_BINDING_EXT
+#define GL_RENDERBUFFER_BINDING_EXT GL_RENDERBUFFER_BINDING
+#endif
+
+#ifndef GL_RENDERBUFFER_SAMPLES
+#define GL_RENDERBUFFER_SAMPLES 0x8CAB
+#endif
+
+#ifndef GL_READ_FRAMEBUFFER_EXT
+#define GL_READ_FRAMEBUFFER_EXT GL_READ_FRAMEBUFFER
+#endif
+
+#ifndef GL_RENDERBUFFER_SAMPLES_EXT
+#define GL_RENDERBUFFER_SAMPLES_EXT GL_RENDERBUFFER_SAMPLES
+#endif
+
+#ifndef GL_RENDERBUFFER_BINDING
+#define GL_RENDERBUFFER_BINDING 0x8CA7
+#endif
+
+#ifndef GL_READ_FRAMEBUFFER_BINDING
+#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA
+#endif
+
+#ifndef GL_MAX_SAMPLES
+#define GL_MAX_SAMPLES 0x8D57
+#endif
+
+#ifndef GL_READ_FRAMEBUFFER_BINDING_EXT
+#define GL_READ_FRAMEBUFFER_BINDING_EXT GL_READ_FRAMEBUFFER_BINDING
+#endif
+
+#ifndef GL_DRAW_FRAMEBUFFER_BINDING
+#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6
+#endif
+
+#ifndef GL_MAX_SAMPLES_EXT
+#define GL_MAX_SAMPLES_EXT GL_MAX_SAMPLES
+#endif
+
+#ifndef GL_DRAW_FRAMEBUFFER
+#define GL_DRAW_FRAMEBUFFER 0x8CA9
+#endif
+
+#ifndef GL_READ_FRAMEBUFFER
+#define GL_READ_FRAMEBUFFER 0x8CA8
+#endif
+
+#ifndef GL_DRAW_FRAMEBUFFER_EXT
+#define GL_DRAW_FRAMEBUFFER_EXT GL_DRAW_FRAMEBUFFER
+#endif
+
+#ifndef GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56
+#endif
+
+#ifndef GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE // NOLINT
+#endif
+
+#ifndef GL_FRAMEBUFFER_BINDING
+#define GL_FRAMEBUFFER_BINDING 0x8CA6
+#endif
+#endif /* GL_CHROMIUM_framebuffer_multisample */
+
+/* GL_CHROMIUM_texture_compression_dxt3 */
+#ifndef GL_CHROMIUM_texture_compression_dxt3
+#define GL_CHROMIUM_texture_compression_dxt3 1
+
+#ifndef GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
+#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
+#endif
+#endif /* GL_CHROMIUM_texture_compression_dxt3 */
+
+/* GL_CHROMIUM_texture_compression_dxt5 */
+#ifndef GL_CHROMIUM_texture_compression_dxt5
+#define GL_CHROMIUM_texture_compression_dxt5 1
+
+#ifndef GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
+#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
+#endif
+#endif /* GL_CHROMIUM_texture_compression_dxt5 */
+
+/* GL_CHROMIUM_async_pixel_transfers */
+#ifndef GL_CHROMIUM_async_pixel_transfers
+#define GL_CHROMIUM_async_pixel_transfers 1
+
+#ifndef GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM
+#define GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM 0x6006
+#endif
+#endif /* GL_CHROMIUM_async_pixel_transfers */
+
+#ifndef GL_BIND_GENERATES_RESOURCE_CHROMIUM
+#define GL_BIND_GENERATES_RESOURCE_CHROMIUM 0x9244
+#endif
+
+/* GL_CHROMIUM_copy_texture */
+#ifndef GL_CHROMIUM_copy_texture
+#define GL_CHROMIUM_copy_texture 1
+
+#ifndef GL_UNPACK_COLORSPACE_CONVERSION_CHROMIUM
+#define GL_UNPACK_COLORSPACE_CONVERSION_CHROMIUM 0x9243
+#endif
+
+#ifndef GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM
+#define GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM 0x9242
+#endif
+
+#ifndef GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM
+#define GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM 0x9241
+#endif
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCopyTextureCHROMIUM(GLenum target,
+ GLenum source_id,
+ GLenum dest_id,
+ GLint internalformat,
+ GLenum dest_type);
+
+GL_APICALL void GL_APIENTRY glCopySubTextureCHROMIUM(GLenum target,
+ GLenum source_id,
+ GLenum dest_id,
+ GLint xoffset,
+ GLint yoffset);
+#endif
+typedef void(GL_APIENTRYP PFNGLCOPYTEXTURECHROMIUMPROC)(GLenum target,
+ GLenum source_id,
+ GLenum dest_id,
+ GLint internalformat,
+ GLenum dest_type);
+
+typedef void(GL_APIENTRYP PFNGLCOPYSUBTEXTURECHROMIUMPROC)(GLenum target,
+ GLenum source_id,
+ GLenum dest_id,
+ GLint xoffset,
+ GLint yoffset);
+#endif /* GL_CHROMIUM_copy_texture */
+
+/* GL_CHROMIUM_lose_context */
+#ifndef GL_CHROMIUM_lose_context
+#define GL_CHROMIUM_lose_context 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glLoseContextCHROMIUM(GLenum current, GLenum other);
+#endif
+typedef void (GL_APIENTRYP PFNGLLOSECONTEXTCHROMIUMPROC) (
+ GLenum current, GLenum other);
+#endif /* GL_CHROMIUM_lose_context */
+
+/* GL_CHROMIUM_flipy */
+#ifndef GL_CHROMIUM_flipy
+#define GL_CHROMIUM_flipy 1
+
+#ifndef GL_UNPACK_FLIP_Y_CHROMIUM
+#define GL_UNPACK_FLIP_Y_CHROMIUM 0x9240
+#endif
+#endif /* GL_CHROMIUM_flipy */
+
+/* GL_ARB_texture_rectangle */
+#ifndef GL_ARB_texture_rectangle
+#define GL_ARB_texture_rectangle 1
+
+#ifndef GL_SAMPLER_2D_RECT_ARB
+#define GL_SAMPLER_2D_RECT_ARB 0x8B63
+#endif
+
+#ifndef GL_TEXTURE_BINDING_RECTANGLE_ARB
+#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6
+#endif
+
+#ifndef GL_TEXTURE_RECTANGLE_ARB
+#define GL_TEXTURE_RECTANGLE_ARB 0x84F5
+#endif
+#endif /* GL_ARB_texture_rectangle */
+
+/* GL_CHROMIUM_enable_feature */
+#ifndef GL_CHROMIUM_enable_feature
+#define GL_CHROMIUM_enable_feature 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL GLboolean GL_APIENTRY glEnableFeatureCHROMIUM(const char* feature);
+#endif
+typedef GLboolean (GL_APIENTRYP PFNGLENABLEFEATURECHROMIUMPROC) (
+ const char* feature);
+#endif /* GL_CHROMIUM_enable_feature */
+
+/* GL_CHROMIUM_command_buffer_latency_query */
+#ifndef GL_CHROMIUM_command_buffer_latency_query
+#define GL_CHROMIUM_command_buffer_latency_query 1
+
+#ifndef GL_LATENCY_QUERY_CHROMIUM
+// TODO(gman): Get official numbers for these constants.
+#define GL_LATENCY_QUERY_CHROMIUM 0x6007
+#endif
+#endif /* GL_CHROMIUM_command_buffer_latency_query */
+
+/* GL_ARB_robustness */
+#ifndef GL_ARB_robustness
+#define GL_ARB_robustness 1
+
+#ifndef GL_GUILTY_CONTEXT_RESET_ARB
+#define GL_GUILTY_CONTEXT_RESET_ARB 0x8253
+#endif
+
+#ifndef GL_UNKNOWN_CONTEXT_RESET_ARB
+#define GL_UNKNOWN_CONTEXT_RESET_ARB 0x8255
+#endif
+
+#ifndef GL_INNOCENT_CONTEXT_RESET_ARB
+#define GL_INNOCENT_CONTEXT_RESET_ARB 0x8254
+#endif
+#endif /* GL_ARB_robustness */
+
+/* GL_EXT_framebuffer_blit */
+#ifndef GL_EXT_framebuffer_blit
+#define GL_EXT_framebuffer_blit 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBlitFramebufferEXT(
+ GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0,
+ GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#endif
+typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFEREXTPROC) (
+ GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0,
+ GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#endif /* GL_EXT_framebuffer_blit */
+
+/* GL_EXT_draw_buffers */
+#ifndef GL_EXT_draw_buffers
+#define GL_EXT_draw_buffers 1
+
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawBuffersEXT(
+ GLsizei n, const GLenum* bufs);
+#endif
+typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSEXTPROC) (
+ GLsizei n, const GLenum* bufs);
+
+#ifndef GL_COLOR_ATTACHMENT0_EXT
+#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
+#endif
+#ifndef GL_COLOR_ATTACHMENT1_EXT
+#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1
+#endif
+#ifndef GL_COLOR_ATTACHMENT2_EXT
+#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2
+#endif
+#ifndef GL_COLOR_ATTACHMENT3_EXT
+#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3
+#endif
+#ifndef GL_COLOR_ATTACHMENT4_EXT
+#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4
+#endif
+#ifndef GL_COLOR_ATTACHMENT5_EXT
+#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5
+#endif
+#ifndef GL_COLOR_ATTACHMENT6_EXT
+#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6
+#endif
+#ifndef GL_COLOR_ATTACHMENT7_EXT
+#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7
+#endif
+#ifndef GL_COLOR_ATTACHMENT8_EXT
+#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8
+#endif
+#ifndef GL_COLOR_ATTACHMENT9_EXT
+#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9
+#endif
+#ifndef GL_COLOR_ATTACHMENT10_EXT
+#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA
+#endif
+#ifndef GL_COLOR_ATTACHMENT11_EXT
+#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB
+#endif
+#ifndef GL_COLOR_ATTACHMENT12_EXT
+#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC
+#endif
+#ifndef GL_COLOR_ATTACHMENT13_EXT
+#define GL_COLOR_ATTACHMENT13_EXT 0x8CED
+#endif
+#ifndef GL_COLOR_ATTACHMENT14_EXT
+#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE
+#endif
+#ifndef GL_COLOR_ATTACHMENT15_EXT
+#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF
+#endif
+
+#ifndef GL_DRAW_BUFFER0_EXT
+#define GL_DRAW_BUFFER0_EXT 0x8825
+#endif
+#ifndef GL_DRAW_BUFFER1_EXT
+#define GL_DRAW_BUFFER1_EXT 0x8826
+#endif
+#ifndef GL_DRAW_BUFFER2_EXT
+#define GL_DRAW_BUFFER2_EXT 0x8827
+#endif
+#ifndef GL_DRAW_BUFFER3_EXT
+#define GL_DRAW_BUFFER3_EXT 0x8828
+#endif
+#ifndef GL_DRAW_BUFFER4_EXT
+#define GL_DRAW_BUFFER4_EXT 0x8829
+#endif
+#ifndef GL_DRAW_BUFFER5_EXT
+#define GL_DRAW_BUFFER5_EXT 0x882A
+#endif
+#ifndef GL_DRAW_BUFFER6_EXT
+#define GL_DRAW_BUFFER6_EXT 0x882B
+#endif
+#ifndef GL_DRAW_BUFFER7_EXT
+#define GL_DRAW_BUFFER7_EXT 0x882C
+#endif
+#ifndef GL_DRAW_BUFFER8_EXT
+#define GL_DRAW_BUFFER8_EXT 0x882D
+#endif
+#ifndef GL_DRAW_BUFFER9_EXT
+#define GL_DRAW_BUFFER9_EXT 0x882E
+#endif
+#ifndef GL_DRAW_BUFFER10_EXT
+#define GL_DRAW_BUFFER10_EXT 0x882F
+#endif
+#ifndef GL_DRAW_BUFFER11_EXT
+#define GL_DRAW_BUFFER11_EXT 0x8830
+#endif
+#ifndef GL_DRAW_BUFFER12_EXT
+#define GL_DRAW_BUFFER12_EXT 0x8831
+#endif
+#ifndef GL_DRAW_BUFFER13_EXT
+#define GL_DRAW_BUFFER13_EXT 0x8832
+#endif
+#ifndef GL_DRAW_BUFFER14_EXT
+#define GL_DRAW_BUFFER14_EXT 0x8833
+#endif
+#ifndef GL_DRAW_BUFFER15_EXT
+#define GL_DRAW_BUFFER15_EXT 0x8834
+#endif
+
+#ifndef GL_MAX_COLOR_ATTACHMENTS_EXT
+#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF
+#endif
+
+#ifndef GL_MAX_DRAW_BUFFERS_EXT
+#define GL_MAX_DRAW_BUFFERS_EXT 0x8824
+#endif
+
+#endif /* GL_EXT_draw_buffers */
+
+/* GL_CHROMIUM_resize */
+#ifndef GL_CHROMIUM_resize
+#define GL_CHROMIUM_resize 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glResizeCHROMIUM(
+ GLuint width, GLuint height, GLfloat scale_factor);
+#endif
+typedef void (GL_APIENTRYP PFNGLRESIZECHROMIUMPROC) (
+ GLuint width, GLuint height);
+#endif /* GL_CHROMIUM_resize */
+
+/* GL_CHROMIUM_get_multiple */
+#ifndef GL_CHROMIUM_get_multiple
+#define GL_CHROMIUM_get_multiple 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetProgramInfoCHROMIUM(
+ GLuint program, GLsizei bufsize, GLsizei* size, void* info);
+#endif
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMINFOCHROMIUMPROC) (
+ GLuint program, GLsizei bufsize, GLsizei* size, void* info);
+#endif /* GL_CHROMIUM_get_multiple */
+
+/* GL_CHROMIUM_sync_point */
+#ifndef GL_CHROMIUM_sync_point
+#define GL_CHROMIUM_sync_point 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL GLuint GL_APIENTRY glInsertSyncPointCHROMIUM();
+GL_APICALL void GL_APIENTRY glWaitSyncPointCHROMIUM(GLuint sync_point);
+#endif
+typedef GLuint (GL_APIENTRYP PFNGLINSERTSYNCPOINTCHROMIUMPROC) ();
+typedef void (GL_APIENTRYP PFNGLWAITSYNCPOINTCHROMIUMPROC) (GLuint sync_point);
+#endif /* GL_CHROMIUM_sync_point */
+
+#ifndef GL_CHROMIUM_color_buffer_float_rgba
+#define GL_CHROMIUM_color_buffer_float_rgba 1
+#ifndef GL_RGBA32F
+#define GL_RGBA32F 0x8814
+#endif
+#endif /* GL_CHROMIUM_color_buffer_float_rgba */
+
+#ifndef GL_CHROMIUM_color_buffer_float_rgb
+#define GL_CHROMIUM_color_buffer_float_rgb 1
+#ifndef GL_RGB32F
+#define GL_RGB32F 0x8815
+#endif
+#endif /* GL_CHROMIUM_color_buffer_float_rgb */
+
+/* GL_CHROMIUM_schedule_overlay_plane */
+#ifndef GL_CHROMIUM_schedule_overlay_plane
+#define GL_CHROMIUM_schedule_overlay_plane 1
+
+#ifndef GL_OVERLAY_TRANSFORM_NONE_CHROMIUM
+#define GL_OVERLAY_TRANSFORM_NONE_CHROMIUM 0x9245
+#endif
+
+#ifndef GL_OVERLAY_TRANSFORM_FLIP_HORIZONTAL_CHROMIUM
+#define GL_OVERLAY_TRANSFORM_FLIP_HORIZONTAL_CHROMIUM 0x9246
+#endif
+
+#ifndef GL_OVERLAY_TRANSFORM_FLIP_VERTICAL_CHROMIUM
+#define GL_OVERLAY_TRANSFORM_FLIP_VERTICAL_CHROMIUM 0x9247
+#endif
+
+#ifndef GL_OVERLAY_TRANSFORM_ROTATE_90_CHROMIUM
+#define GL_OVERLAY_TRANSFORM_ROTATE_90_CHROMIUM 0x9248
+#endif
+
+#ifndef GL_OVERLAY_TRANSFORM_ROTATE_180_CHROMIUM
+#define GL_OVERLAY_TRANSFORM_ROTATE_180_CHROMIUM 0x9249
+#endif
+
+#ifndef GL_OVERLAY_TRANSFORM_ROTATE_270_CHROMIUM
+#define GL_OVERLAY_TRANSFORM_ROTATE_270_CHROMIUM 0x924A
+#endif
+
+/* GL_CHROMIUM_subscribe_uniform */
+#ifndef GL_CHROMIUM_subscribe_uniform
+#define GL_CHROMIUM_subscribe_uniform 1
+
+#ifndef GL_SUBSCRIBED_VALUES_BUFFER_CHROMIUM
+#define GL_SUBSCRIBED_VALUES_BUFFER_CHROMIUM 0x924B
+#endif
+
+#ifndef GL_MOUSE_POSITION_CHROMIUM
+#define GL_MOUSE_POSITION_CHROMIUM 0x924C
+#endif
+
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY
+glGenValuebuffersCHROMIUM(GLsizei n, GLuint* buffers);
+GL_APICALL void GL_APIENTRY
+glDeleteValuebuffersCHROMIUM(GLsizei n, const GLuint* valuebuffers);
+GL_APICALL GLboolean GL_APIENTRY glIsValuebufferCHROMIUM(GLuint valuebuffer);
+GL_APICALL void GL_APIENTRY
+glBindValuebufferCHROMIUM(GLenum target, GLuint valuebuffer);
+GL_APICALL void GL_APIENTRY
+glSubscribeValueCHROMIUM(GLenum target, GLenum subscription);
+GL_APICALL void GL_APIENTRY glPopulateSubscribedValuesCHROMIUM(GLenum target);
+GL_APICALL void GL_APIENTRY glUniformValuebufferCHROMIUM(GLint location,
+ GLenum target,
+ GLenum subscription);
+#endif
+#endif /* GL_CHROMIUM_subscribe_uniform */
+
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY
+ glScheduleOverlayPlaneCHROMIUM(GLint plane_z_order,
+ GLenum plane_transform,
+ GLuint overlay_texture_id,
+ GLint bounds_x,
+ GLint bounds_y,
+ GLint bounds_width,
+ GLint bounds_height,
+ GLfloat uv_x,
+ GLfloat uv_y,
+ GLfloat uv_width,
+ GLfloat uv_height);
+#endif
+typedef void(GL_APIENTRYP PFNGLSCHEDULEOVERLAYPLANECHROMIUMPROC)(
+ GLint plane_z_order,
+ GLenum plane_transform,
+ GLuint overlay_texture_id,
+ GLint bounds_x,
+ GLint bounds_y,
+ GLint bounds_width,
+ GLint bounds_height,
+ GLfloat uv_x,
+ GLfloat uv_y,
+ GLfloat uv_width,
+ GLfloat uv_height);
+#endif /* GL_CHROMIUM_schedule_overlay_plane */
+
+/* GL_CHROMIUM_sync_query */
+#ifndef GL_CHROMIUM_sync_query
+#define GL_CHROMIUM_sync_query 1
+
+#ifndef GL_COMMANDS_COMPLETED_CHROMIUM
+#define GL_COMMANDS_COMPLETED_CHROMIUM 0x84F7
+#endif
+#endif /* GL_CHROMIUM_sync_query */
+
+#ifndef GL_CHROMIUM_path_rendering
+#define GL_CHROMIUM_path_rendering 1
+
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY
+ glMatrixLoadfCHROMIUM(GLenum mode, const GLfloat* m);
+GL_APICALL void GL_APIENTRY glMatrixLoadIdentityCHROMIUM(GLenum mode);
+#endif
+
+typedef void(GL_APIENTRYP PFNGLMATRIXLOADFCHROMIUMPROC)(GLenum matrixMode,
+ const GLfloat* m);
+typedef void(GL_APIENTRYP PFNGLMATRIXLOADIDENTITYCHROMIUMPROC)(
+ GLenum matrixMode);
+
+#endif /* GL_CHROMIUM_path_rendering */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GPU_GLES2_GL2EXTMOJO_H_
diff --git a/third_party/mojo/src/mojo/public/c/gpu/GLES2/gl2mojo.h b/third_party/mojo/src/mojo/public/c/gpu/GLES2/gl2mojo.h
new file mode 100644
index 0000000..8b259ba3
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/c/gpu/GLES2/gl2mojo.h
@@ -0,0 +1,32 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file contains Mojo-specific GLES2 declarations.
+
+#ifndef GPU_GLES2_GL2MOJO_H_
+#define GPU_GLES2_GL2MOJO_H_
+
+#include <GLES2/gl2platform.h>
+
+#define GL_CONTEXT_LOST 0x300E
+#define GL_PATH_MODELVIEW_CHROMIUM 0x1700
+#define GL_PATH_PROJECTION_CHROMIUM 0x1701
+#define GL_PATH_MODELVIEW_MATRIX_CHROMIUM 0x0BA6
+#define GL_PATH_PROJECTION_MATRIX_CHROMIUM 0x0BA7
+
+#if defined(GLES2_USE_MOJO)
+#define GLES2_GET_FUN(name) MojoGLES2gl ## name
+#else
+// Because we are using both the real system GL and our own
+// emulated GL we need to use different names to avoid conflicts.
+#if defined(GLES2_USE_CPP_BINDINGS)
+#define GLES2_GET_FUN(name) gles2::GetGLContext()->name
+#else
+#define GLES2_GET_FUN(name) GLES2 ## name
+#endif
+#endif
+
+#include <GLES2/gl2mojo_autogen.h>
+
+#endif // GPU_GLES2_GL2MOJO_H_
diff --git a/third_party/mojo/src/mojo/public/c/gpu/GLES2/gl2mojo_autogen.h b/third_party/mojo/src/mojo/public/c/gpu/GLES2/gl2mojo_autogen.h
new file mode 100644
index 0000000..eafc35d
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/c/gpu/GLES2/gl2mojo_autogen.h
@@ -0,0 +1,325 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file is auto-generated from
+// gpu/command_buffer/build_gles2_cmd_buffer.py
+// It's formatted by clang-format using chromium coding style:
+// clang-format -i -style=chromium filename
+// DO NOT EDIT!
+
+// This file contains Mojo-specific GLES2 declarations.
+
+#ifndef GPU_GLES2_GL2MOJO_AUTOGEN_H_
+#define GPU_GLES2_GL2MOJO_AUTOGEN_H_
+
+#define glActiveTexture GLES2_GET_FUN(ActiveTexture)
+#define glAttachShader GLES2_GET_FUN(AttachShader)
+#define glBindAttribLocation GLES2_GET_FUN(BindAttribLocation)
+#define glBindBuffer GLES2_GET_FUN(BindBuffer)
+#define glBindBufferBase GLES2_GET_FUN(BindBufferBase)
+#define glBindBufferRange GLES2_GET_FUN(BindBufferRange)
+#define glBindFramebuffer GLES2_GET_FUN(BindFramebuffer)
+#define glBindRenderbuffer GLES2_GET_FUN(BindRenderbuffer)
+#define glBindSampler GLES2_GET_FUN(BindSampler)
+#define glBindTexture GLES2_GET_FUN(BindTexture)
+#define glBindTransformFeedback GLES2_GET_FUN(BindTransformFeedback)
+#define glBlendColor GLES2_GET_FUN(BlendColor)
+#define glBlendEquation GLES2_GET_FUN(BlendEquation)
+#define glBlendEquationSeparate GLES2_GET_FUN(BlendEquationSeparate)
+#define glBlendFunc GLES2_GET_FUN(BlendFunc)
+#define glBlendFuncSeparate GLES2_GET_FUN(BlendFuncSeparate)
+#define glBufferData GLES2_GET_FUN(BufferData)
+#define glBufferSubData GLES2_GET_FUN(BufferSubData)
+#define glCheckFramebufferStatus GLES2_GET_FUN(CheckFramebufferStatus)
+#define glClear GLES2_GET_FUN(Clear)
+#define glClearBufferfi GLES2_GET_FUN(ClearBufferfi)
+#define glClearBufferfv GLES2_GET_FUN(ClearBufferfv)
+#define glClearBufferiv GLES2_GET_FUN(ClearBufferiv)
+#define glClearBufferuiv GLES2_GET_FUN(ClearBufferuiv)
+#define glClearColor GLES2_GET_FUN(ClearColor)
+#define glClearDepthf GLES2_GET_FUN(ClearDepthf)
+#define glClearStencil GLES2_GET_FUN(ClearStencil)
+#define glClientWaitSync GLES2_GET_FUN(ClientWaitSync)
+#define glColorMask GLES2_GET_FUN(ColorMask)
+#define glCompileShader GLES2_GET_FUN(CompileShader)
+#define glCompressedTexImage2D GLES2_GET_FUN(CompressedTexImage2D)
+#define glCompressedTexSubImage2D GLES2_GET_FUN(CompressedTexSubImage2D)
+#define glCopyBufferSubData GLES2_GET_FUN(CopyBufferSubData)
+#define glCopyTexImage2D GLES2_GET_FUN(CopyTexImage2D)
+#define glCopyTexSubImage2D GLES2_GET_FUN(CopyTexSubImage2D)
+#define glCopyTexSubImage3D GLES2_GET_FUN(CopyTexSubImage3D)
+#define glCreateProgram GLES2_GET_FUN(CreateProgram)
+#define glCreateShader GLES2_GET_FUN(CreateShader)
+#define glCullFace GLES2_GET_FUN(CullFace)
+#define glDeleteBuffers GLES2_GET_FUN(DeleteBuffers)
+#define glDeleteFramebuffers GLES2_GET_FUN(DeleteFramebuffers)
+#define glDeleteProgram GLES2_GET_FUN(DeleteProgram)
+#define glDeleteRenderbuffers GLES2_GET_FUN(DeleteRenderbuffers)
+#define glDeleteSamplers GLES2_GET_FUN(DeleteSamplers)
+#define glDeleteSync GLES2_GET_FUN(DeleteSync)
+#define glDeleteShader GLES2_GET_FUN(DeleteShader)
+#define glDeleteTextures GLES2_GET_FUN(DeleteTextures)
+#define glDeleteTransformFeedbacks GLES2_GET_FUN(DeleteTransformFeedbacks)
+#define glDepthFunc GLES2_GET_FUN(DepthFunc)
+#define glDepthMask GLES2_GET_FUN(DepthMask)
+#define glDepthRangef GLES2_GET_FUN(DepthRangef)
+#define glDetachShader GLES2_GET_FUN(DetachShader)
+#define glDisable GLES2_GET_FUN(Disable)
+#define glDisableVertexAttribArray GLES2_GET_FUN(DisableVertexAttribArray)
+#define glDrawArrays GLES2_GET_FUN(DrawArrays)
+#define glDrawElements GLES2_GET_FUN(DrawElements)
+#define glDrawRangeElements GLES2_GET_FUN(DrawRangeElements)
+#define glEnable GLES2_GET_FUN(Enable)
+#define glEnableVertexAttribArray GLES2_GET_FUN(EnableVertexAttribArray)
+#define glFenceSync GLES2_GET_FUN(FenceSync)
+#define glFinish GLES2_GET_FUN(Finish)
+#define glFlush GLES2_GET_FUN(Flush)
+#define glFramebufferRenderbuffer GLES2_GET_FUN(FramebufferRenderbuffer)
+#define glFramebufferTexture2D GLES2_GET_FUN(FramebufferTexture2D)
+#define glFramebufferTextureLayer GLES2_GET_FUN(FramebufferTextureLayer)
+#define glFrontFace GLES2_GET_FUN(FrontFace)
+#define glGenBuffers GLES2_GET_FUN(GenBuffers)
+#define glGenerateMipmap GLES2_GET_FUN(GenerateMipmap)
+#define glGenFramebuffers GLES2_GET_FUN(GenFramebuffers)
+#define glGenRenderbuffers GLES2_GET_FUN(GenRenderbuffers)
+#define glGenSamplers GLES2_GET_FUN(GenSamplers)
+#define glGenTextures GLES2_GET_FUN(GenTextures)
+#define glGenTransformFeedbacks GLES2_GET_FUN(GenTransformFeedbacks)
+#define glGetActiveAttrib GLES2_GET_FUN(GetActiveAttrib)
+#define glGetActiveUniform GLES2_GET_FUN(GetActiveUniform)
+#define glGetActiveUniformBlockiv GLES2_GET_FUN(GetActiveUniformBlockiv)
+#define glGetActiveUniformBlockName GLES2_GET_FUN(GetActiveUniformBlockName)
+#define glGetActiveUniformsiv GLES2_GET_FUN(GetActiveUniformsiv)
+#define glGetAttachedShaders GLES2_GET_FUN(GetAttachedShaders)
+#define glGetAttribLocation GLES2_GET_FUN(GetAttribLocation)
+#define glGetBooleanv GLES2_GET_FUN(GetBooleanv)
+#define glGetBufferParameteriv GLES2_GET_FUN(GetBufferParameteriv)
+#define glGetError GLES2_GET_FUN(GetError)
+#define glGetFloatv GLES2_GET_FUN(GetFloatv)
+#define glGetFragDataLocation GLES2_GET_FUN(GetFragDataLocation)
+#define glGetFramebufferAttachmentParameteriv \
+ GLES2_GET_FUN(GetFramebufferAttachmentParameteriv)
+#define glGetInteger64v GLES2_GET_FUN(GetInteger64v)
+#define glGetIntegeri_v GLES2_GET_FUN(GetIntegeri_v)
+#define glGetInteger64i_v GLES2_GET_FUN(GetInteger64i_v)
+#define glGetIntegerv GLES2_GET_FUN(GetIntegerv)
+#define glGetInternalformativ GLES2_GET_FUN(GetInternalformativ)
+#define glGetProgramiv GLES2_GET_FUN(GetProgramiv)
+#define glGetProgramInfoLog GLES2_GET_FUN(GetProgramInfoLog)
+#define glGetRenderbufferParameteriv GLES2_GET_FUN(GetRenderbufferParameteriv)
+#define glGetSamplerParameterfv GLES2_GET_FUN(GetSamplerParameterfv)
+#define glGetSamplerParameteriv GLES2_GET_FUN(GetSamplerParameteriv)
+#define glGetShaderiv GLES2_GET_FUN(GetShaderiv)
+#define glGetShaderInfoLog GLES2_GET_FUN(GetShaderInfoLog)
+#define glGetShaderPrecisionFormat GLES2_GET_FUN(GetShaderPrecisionFormat)
+#define glGetShaderSource GLES2_GET_FUN(GetShaderSource)
+#define glGetString GLES2_GET_FUN(GetString)
+#define glGetSynciv GLES2_GET_FUN(GetSynciv)
+#define glGetTexParameterfv GLES2_GET_FUN(GetTexParameterfv)
+#define glGetTexParameteriv GLES2_GET_FUN(GetTexParameteriv)
+#define glGetTransformFeedbackVarying GLES2_GET_FUN(GetTransformFeedbackVarying)
+#define glGetUniformBlockIndex GLES2_GET_FUN(GetUniformBlockIndex)
+#define glGetUniformfv GLES2_GET_FUN(GetUniformfv)
+#define glGetUniformiv GLES2_GET_FUN(GetUniformiv)
+#define glGetUniformIndices GLES2_GET_FUN(GetUniformIndices)
+#define glGetUniformLocation GLES2_GET_FUN(GetUniformLocation)
+#define glGetVertexAttribfv GLES2_GET_FUN(GetVertexAttribfv)
+#define glGetVertexAttribiv GLES2_GET_FUN(GetVertexAttribiv)
+#define glGetVertexAttribPointerv GLES2_GET_FUN(GetVertexAttribPointerv)
+#define glHint GLES2_GET_FUN(Hint)
+#define glInvalidateFramebuffer GLES2_GET_FUN(InvalidateFramebuffer)
+#define glInvalidateSubFramebuffer GLES2_GET_FUN(InvalidateSubFramebuffer)
+#define glIsBuffer GLES2_GET_FUN(IsBuffer)
+#define glIsEnabled GLES2_GET_FUN(IsEnabled)
+#define glIsFramebuffer GLES2_GET_FUN(IsFramebuffer)
+#define glIsProgram GLES2_GET_FUN(IsProgram)
+#define glIsRenderbuffer GLES2_GET_FUN(IsRenderbuffer)
+#define glIsSampler GLES2_GET_FUN(IsSampler)
+#define glIsShader GLES2_GET_FUN(IsShader)
+#define glIsSync GLES2_GET_FUN(IsSync)
+#define glIsTexture GLES2_GET_FUN(IsTexture)
+#define glIsTransformFeedback GLES2_GET_FUN(IsTransformFeedback)
+#define glLineWidth GLES2_GET_FUN(LineWidth)
+#define glLinkProgram GLES2_GET_FUN(LinkProgram)
+#define glPauseTransformFeedback GLES2_GET_FUN(PauseTransformFeedback)
+#define glPixelStorei GLES2_GET_FUN(PixelStorei)
+#define glPolygonOffset GLES2_GET_FUN(PolygonOffset)
+#define glReadBuffer GLES2_GET_FUN(ReadBuffer)
+#define glReadPixels GLES2_GET_FUN(ReadPixels)
+#define glReleaseShaderCompiler GLES2_GET_FUN(ReleaseShaderCompiler)
+#define glRenderbufferStorage GLES2_GET_FUN(RenderbufferStorage)
+#define glResumeTransformFeedback GLES2_GET_FUN(ResumeTransformFeedback)
+#define glSampleCoverage GLES2_GET_FUN(SampleCoverage)
+#define glSamplerParameterf GLES2_GET_FUN(SamplerParameterf)
+#define glSamplerParameterfv GLES2_GET_FUN(SamplerParameterfv)
+#define glSamplerParameteri GLES2_GET_FUN(SamplerParameteri)
+#define glSamplerParameteriv GLES2_GET_FUN(SamplerParameteriv)
+#define glScissor GLES2_GET_FUN(Scissor)
+#define glShaderBinary GLES2_GET_FUN(ShaderBinary)
+#define glShaderSource GLES2_GET_FUN(ShaderSource)
+#define glShallowFinishCHROMIUM GLES2_GET_FUN(ShallowFinishCHROMIUM)
+#define glShallowFlushCHROMIUM GLES2_GET_FUN(ShallowFlushCHROMIUM)
+#define glOrderingBarrierCHROMIUM GLES2_GET_FUN(OrderingBarrierCHROMIUM)
+#define glStencilFunc GLES2_GET_FUN(StencilFunc)
+#define glStencilFuncSeparate GLES2_GET_FUN(StencilFuncSeparate)
+#define glStencilMask GLES2_GET_FUN(StencilMask)
+#define glStencilMaskSeparate GLES2_GET_FUN(StencilMaskSeparate)
+#define glStencilOp GLES2_GET_FUN(StencilOp)
+#define glStencilOpSeparate GLES2_GET_FUN(StencilOpSeparate)
+#define glTexImage2D GLES2_GET_FUN(TexImage2D)
+#define glTexImage3D GLES2_GET_FUN(TexImage3D)
+#define glTexParameterf GLES2_GET_FUN(TexParameterf)
+#define glTexParameterfv GLES2_GET_FUN(TexParameterfv)
+#define glTexParameteri GLES2_GET_FUN(TexParameteri)
+#define glTexParameteriv GLES2_GET_FUN(TexParameteriv)
+#define glTexStorage3D GLES2_GET_FUN(TexStorage3D)
+#define glTexSubImage2D GLES2_GET_FUN(TexSubImage2D)
+#define glTexSubImage3D GLES2_GET_FUN(TexSubImage3D)
+#define glTransformFeedbackVaryings GLES2_GET_FUN(TransformFeedbackVaryings)
+#define glUniform1f GLES2_GET_FUN(Uniform1f)
+#define glUniform1fv GLES2_GET_FUN(Uniform1fv)
+#define glUniform1i GLES2_GET_FUN(Uniform1i)
+#define glUniform1iv GLES2_GET_FUN(Uniform1iv)
+#define glUniform1ui GLES2_GET_FUN(Uniform1ui)
+#define glUniform1uiv GLES2_GET_FUN(Uniform1uiv)
+#define glUniform2f GLES2_GET_FUN(Uniform2f)
+#define glUniform2fv GLES2_GET_FUN(Uniform2fv)
+#define glUniform2i GLES2_GET_FUN(Uniform2i)
+#define glUniform2iv GLES2_GET_FUN(Uniform2iv)
+#define glUniform2ui GLES2_GET_FUN(Uniform2ui)
+#define glUniform2uiv GLES2_GET_FUN(Uniform2uiv)
+#define glUniform3f GLES2_GET_FUN(Uniform3f)
+#define glUniform3fv GLES2_GET_FUN(Uniform3fv)
+#define glUniform3i GLES2_GET_FUN(Uniform3i)
+#define glUniform3iv GLES2_GET_FUN(Uniform3iv)
+#define glUniform3ui GLES2_GET_FUN(Uniform3ui)
+#define glUniform3uiv GLES2_GET_FUN(Uniform3uiv)
+#define glUniform4f GLES2_GET_FUN(Uniform4f)
+#define glUniform4fv GLES2_GET_FUN(Uniform4fv)
+#define glUniform4i GLES2_GET_FUN(Uniform4i)
+#define glUniform4iv GLES2_GET_FUN(Uniform4iv)
+#define glUniform4ui GLES2_GET_FUN(Uniform4ui)
+#define glUniform4uiv GLES2_GET_FUN(Uniform4uiv)
+#define glUniformBlockBinding GLES2_GET_FUN(UniformBlockBinding)
+#define glUniformMatrix2fv GLES2_GET_FUN(UniformMatrix2fv)
+#define glUniformMatrix2x3fv GLES2_GET_FUN(UniformMatrix2x3fv)
+#define glUniformMatrix2x4fv GLES2_GET_FUN(UniformMatrix2x4fv)
+#define glUniformMatrix3fv GLES2_GET_FUN(UniformMatrix3fv)
+#define glUniformMatrix3x2fv GLES2_GET_FUN(UniformMatrix3x2fv)
+#define glUniformMatrix3x4fv GLES2_GET_FUN(UniformMatrix3x4fv)
+#define glUniformMatrix4fv GLES2_GET_FUN(UniformMatrix4fv)
+#define glUniformMatrix4x2fv GLES2_GET_FUN(UniformMatrix4x2fv)
+#define glUniformMatrix4x3fv GLES2_GET_FUN(UniformMatrix4x3fv)
+#define glUseProgram GLES2_GET_FUN(UseProgram)
+#define glValidateProgram GLES2_GET_FUN(ValidateProgram)
+#define glVertexAttrib1f GLES2_GET_FUN(VertexAttrib1f)
+#define glVertexAttrib1fv GLES2_GET_FUN(VertexAttrib1fv)
+#define glVertexAttrib2f GLES2_GET_FUN(VertexAttrib2f)
+#define glVertexAttrib2fv GLES2_GET_FUN(VertexAttrib2fv)
+#define glVertexAttrib3f GLES2_GET_FUN(VertexAttrib3f)
+#define glVertexAttrib3fv GLES2_GET_FUN(VertexAttrib3fv)
+#define glVertexAttrib4f GLES2_GET_FUN(VertexAttrib4f)
+#define glVertexAttrib4fv GLES2_GET_FUN(VertexAttrib4fv)
+#define glVertexAttribI4i GLES2_GET_FUN(VertexAttribI4i)
+#define glVertexAttribI4iv GLES2_GET_FUN(VertexAttribI4iv)
+#define glVertexAttribI4ui GLES2_GET_FUN(VertexAttribI4ui)
+#define glVertexAttribI4uiv GLES2_GET_FUN(VertexAttribI4uiv)
+#define glVertexAttribIPointer GLES2_GET_FUN(VertexAttribIPointer)
+#define glVertexAttribPointer GLES2_GET_FUN(VertexAttribPointer)
+#define glViewport GLES2_GET_FUN(Viewport)
+#define glWaitSync GLES2_GET_FUN(WaitSync)
+#define glBlitFramebufferCHROMIUM GLES2_GET_FUN(BlitFramebufferCHROMIUM)
+#define glRenderbufferStorageMultisampleCHROMIUM \
+ GLES2_GET_FUN(RenderbufferStorageMultisampleCHROMIUM)
+#define glRenderbufferStorageMultisampleEXT \
+ GLES2_GET_FUN(RenderbufferStorageMultisampleEXT)
+#define glFramebufferTexture2DMultisampleEXT \
+ GLES2_GET_FUN(FramebufferTexture2DMultisampleEXT)
+#define glTexStorage2DEXT GLES2_GET_FUN(TexStorage2DEXT)
+#define glGenQueriesEXT GLES2_GET_FUN(GenQueriesEXT)
+#define glDeleteQueriesEXT GLES2_GET_FUN(DeleteQueriesEXT)
+#define glIsQueryEXT GLES2_GET_FUN(IsQueryEXT)
+#define glBeginQueryEXT GLES2_GET_FUN(BeginQueryEXT)
+#define glBeginTransformFeedback GLES2_GET_FUN(BeginTransformFeedback)
+#define glEndQueryEXT GLES2_GET_FUN(EndQueryEXT)
+#define glEndTransformFeedback GLES2_GET_FUN(EndTransformFeedback)
+#define glGetQueryivEXT GLES2_GET_FUN(GetQueryivEXT)
+#define glGetQueryObjectuivEXT GLES2_GET_FUN(GetQueryObjectuivEXT)
+#define glInsertEventMarkerEXT GLES2_GET_FUN(InsertEventMarkerEXT)
+#define glPushGroupMarkerEXT GLES2_GET_FUN(PushGroupMarkerEXT)
+#define glPopGroupMarkerEXT GLES2_GET_FUN(PopGroupMarkerEXT)
+#define glGenVertexArraysOES GLES2_GET_FUN(GenVertexArraysOES)
+#define glDeleteVertexArraysOES GLES2_GET_FUN(DeleteVertexArraysOES)
+#define glIsVertexArrayOES GLES2_GET_FUN(IsVertexArrayOES)
+#define glBindVertexArrayOES GLES2_GET_FUN(BindVertexArrayOES)
+#define glSwapBuffers GLES2_GET_FUN(SwapBuffers)
+#define glGetMaxValueInBufferCHROMIUM GLES2_GET_FUN(GetMaxValueInBufferCHROMIUM)
+#define glEnableFeatureCHROMIUM GLES2_GET_FUN(EnableFeatureCHROMIUM)
+#define glMapBufferCHROMIUM GLES2_GET_FUN(MapBufferCHROMIUM)
+#define glUnmapBufferCHROMIUM GLES2_GET_FUN(UnmapBufferCHROMIUM)
+#define glMapBufferSubDataCHROMIUM GLES2_GET_FUN(MapBufferSubDataCHROMIUM)
+#define glUnmapBufferSubDataCHROMIUM GLES2_GET_FUN(UnmapBufferSubDataCHROMIUM)
+#define glMapBufferRange GLES2_GET_FUN(MapBufferRange)
+#define glUnmapBuffer GLES2_GET_FUN(UnmapBuffer)
+#define glMapTexSubImage2DCHROMIUM GLES2_GET_FUN(MapTexSubImage2DCHROMIUM)
+#define glUnmapTexSubImage2DCHROMIUM GLES2_GET_FUN(UnmapTexSubImage2DCHROMIUM)
+#define glResizeCHROMIUM GLES2_GET_FUN(ResizeCHROMIUM)
+#define glGetRequestableExtensionsCHROMIUM \
+ GLES2_GET_FUN(GetRequestableExtensionsCHROMIUM)
+#define glRequestExtensionCHROMIUM GLES2_GET_FUN(RequestExtensionCHROMIUM)
+#define glRateLimitOffscreenContextCHROMIUM \
+ GLES2_GET_FUN(RateLimitOffscreenContextCHROMIUM)
+#define glGetProgramInfoCHROMIUM GLES2_GET_FUN(GetProgramInfoCHROMIUM)
+#define glGetUniformBlocksCHROMIUM GLES2_GET_FUN(GetUniformBlocksCHROMIUM)
+#define glGetTransformFeedbackVaryingsCHROMIUM \
+ GLES2_GET_FUN(GetTransformFeedbackVaryingsCHROMIUM)
+#define glGetUniformsES3CHROMIUM GLES2_GET_FUN(GetUniformsES3CHROMIUM)
+#define glCreateStreamTextureCHROMIUM GLES2_GET_FUN(CreateStreamTextureCHROMIUM)
+#define glCreateImageCHROMIUM GLES2_GET_FUN(CreateImageCHROMIUM)
+#define glDestroyImageCHROMIUM GLES2_GET_FUN(DestroyImageCHROMIUM)
+#define glCreateGpuMemoryBufferImageCHROMIUM \
+ GLES2_GET_FUN(CreateGpuMemoryBufferImageCHROMIUM)
+#define glGetTranslatedShaderSourceANGLE \
+ GLES2_GET_FUN(GetTranslatedShaderSourceANGLE)
+#define glPostSubBufferCHROMIUM GLES2_GET_FUN(PostSubBufferCHROMIUM)
+#define glTexImageIOSurface2DCHROMIUM GLES2_GET_FUN(TexImageIOSurface2DCHROMIUM)
+#define glCopyTextureCHROMIUM GLES2_GET_FUN(CopyTextureCHROMIUM)
+#define glCopySubTextureCHROMIUM GLES2_GET_FUN(CopySubTextureCHROMIUM)
+#define glDrawArraysInstancedANGLE GLES2_GET_FUN(DrawArraysInstancedANGLE)
+#define glDrawElementsInstancedANGLE GLES2_GET_FUN(DrawElementsInstancedANGLE)
+#define glVertexAttribDivisorANGLE GLES2_GET_FUN(VertexAttribDivisorANGLE)
+#define glGenMailboxCHROMIUM GLES2_GET_FUN(GenMailboxCHROMIUM)
+#define glProduceTextureCHROMIUM GLES2_GET_FUN(ProduceTextureCHROMIUM)
+#define glProduceTextureDirectCHROMIUM \
+ GLES2_GET_FUN(ProduceTextureDirectCHROMIUM)
+#define glConsumeTextureCHROMIUM GLES2_GET_FUN(ConsumeTextureCHROMIUM)
+#define glCreateAndConsumeTextureCHROMIUM \
+ GLES2_GET_FUN(CreateAndConsumeTextureCHROMIUM)
+#define glBindUniformLocationCHROMIUM GLES2_GET_FUN(BindUniformLocationCHROMIUM)
+#define glGenValuebuffersCHROMIUM GLES2_GET_FUN(GenValuebuffersCHROMIUM)
+#define glDeleteValuebuffersCHROMIUM GLES2_GET_FUN(DeleteValuebuffersCHROMIUM)
+#define glIsValuebufferCHROMIUM GLES2_GET_FUN(IsValuebufferCHROMIUM)
+#define glBindValuebufferCHROMIUM GLES2_GET_FUN(BindValuebufferCHROMIUM)
+#define glSubscribeValueCHROMIUM GLES2_GET_FUN(SubscribeValueCHROMIUM)
+#define glPopulateSubscribedValuesCHROMIUM \
+ GLES2_GET_FUN(PopulateSubscribedValuesCHROMIUM)
+#define glUniformValuebufferCHROMIUM GLES2_GET_FUN(UniformValuebufferCHROMIUM)
+#define glBindTexImage2DCHROMIUM GLES2_GET_FUN(BindTexImage2DCHROMIUM)
+#define glReleaseTexImage2DCHROMIUM GLES2_GET_FUN(ReleaseTexImage2DCHROMIUM)
+#define glTraceBeginCHROMIUM GLES2_GET_FUN(TraceBeginCHROMIUM)
+#define glTraceEndCHROMIUM GLES2_GET_FUN(TraceEndCHROMIUM)
+#define glDiscardFramebufferEXT GLES2_GET_FUN(DiscardFramebufferEXT)
+#define glLoseContextCHROMIUM GLES2_GET_FUN(LoseContextCHROMIUM)
+#define glInsertSyncPointCHROMIUM GLES2_GET_FUN(InsertSyncPointCHROMIUM)
+#define glWaitSyncPointCHROMIUM GLES2_GET_FUN(WaitSyncPointCHROMIUM)
+#define glDrawBuffersEXT GLES2_GET_FUN(DrawBuffersEXT)
+#define glDiscardBackbufferCHROMIUM GLES2_GET_FUN(DiscardBackbufferCHROMIUM)
+#define glScheduleOverlayPlaneCHROMIUM \
+ GLES2_GET_FUN(ScheduleOverlayPlaneCHROMIUM)
+#define glSwapInterval GLES2_GET_FUN(SwapInterval)
+#define glMatrixLoadfCHROMIUM GLES2_GET_FUN(MatrixLoadfCHROMIUM)
+#define glMatrixLoadIdentityCHROMIUM GLES2_GET_FUN(MatrixLoadIdentityCHROMIUM)
+#define glBlendBarrierKHR GLES2_GET_FUN(BlendBarrierKHR)
+
+#endif // GPU_GLES2_GL2MOJO_AUTOGEN_H_
diff --git a/third_party/mojo/src/mojo/public/c/gpu/GLES2/gl2platform.h b/third_party/mojo/src/mojo/public/c/gpu/GLES2/gl2platform.h
new file mode 100644
index 0000000..89d4d44
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/c/gpu/GLES2/gl2platform.h
@@ -0,0 +1,30 @@
+#ifndef __gl2platform_h_
+#define __gl2platform_h_
+
+/* $Revision: 23328 $ on $Date:: 2013-10-02 02:28:28 -0700 #$ */
+
+/*
+ * This document is licensed under the SGI Free Software B License Version
+ * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
+ */
+
+/* Platform-specific types and definitions for OpenGL ES 2.X gl2.h
+ *
+ * Adopters may modify khrplatform.h and this file to suit their platform.
+ * You are encouraged to submit all modifications to the Khronos group so that
+ * they can be included in future versions of this file. Please submit changes
+ * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
+ * by filing a bug against product "OpenGL-ES" component "Registry".
+ */
+
+#include <KHR/khrplatform.h>
+
+#ifndef GL_APICALL
+#define GL_APICALL KHRONOS_APICALL
+#endif
+
+#ifndef GL_APIENTRY
+#define GL_APIENTRY KHRONOS_APIENTRY
+#endif
+
+#endif /* __gl2platform_h_ */
diff --git a/third_party/mojo/src/mojo/public/c/gpu/KHR/khrplatform.h b/third_party/mojo/src/mojo/public/c/gpu/KHR/khrplatform.h
new file mode 100644
index 0000000..ee062de
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/c/gpu/KHR/khrplatform.h
@@ -0,0 +1,298 @@
+#ifndef __khrplatform_h_
+#define __khrplatform_h_
+
+/*
+** Copyright (c) 2008-2009 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+/* Khronos platform-specific types and definitions.
+ *
+ * $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $
+ *
+ * Adopters may modify this file to suit their platform. Adopters are
+ * encouraged to submit platform specific modifications to the Khronos
+ * group so that they can be included in future versions of this file.
+ * Please submit changes by sending them to the public Khronos Bugzilla
+ * (http://khronos.org/bugzilla) by filing a bug against product
+ * "Khronos (general)" component "Registry".
+ *
+ * A predefined template which fills in some of the bug fields can be
+ * reached using http://tinyurl.com/khrplatform-h-bugreport, but you
+ * must create a Bugzilla login first.
+ *
+ *
+ * See the Implementer's Guidelines for information about where this file
+ * should be located on your system and for more details of its use:
+ * http://www.khronos.org/registry/implementers_guide.pdf
+ *
+ * This file should be included as
+ * #include <KHR/khrplatform.h>
+ * by Khronos client API header files that use its types and defines.
+ *
+ * The types in khrplatform.h should only be used to define API-specific types.
+ *
+ * Types defined in khrplatform.h:
+ * khronos_int8_t signed 8 bit
+ * khronos_uint8_t unsigned 8 bit
+ * khronos_int16_t signed 16 bit
+ * khronos_uint16_t unsigned 16 bit
+ * khronos_int32_t signed 32 bit
+ * khronos_uint32_t unsigned 32 bit
+ * khronos_int64_t signed 64 bit
+ * khronos_uint64_t unsigned 64 bit
+ * khronos_intptr_t signed same number of bits as a pointer
+ * khronos_uintptr_t unsigned same number of bits as a pointer
+ * khronos_ssize_t signed size
+ * khronos_usize_t unsigned size
+ * khronos_float_t signed 32 bit floating point
+ * khronos_time_ns_t unsigned 64 bit time in nanoseconds
+ * khronos_utime_nanoseconds_t unsigned time interval or absolute time in
+ * nanoseconds
+ * khronos_stime_nanoseconds_t signed time interval in nanoseconds
+ * khronos_boolean_enum_t enumerated boolean type. This should
+ * only be used as a base type when a client API's boolean type is
+ * an enum. Client APIs which use an integer or other type for
+ * booleans cannot use this as the base type for their boolean.
+ *
+ * Tokens defined in khrplatform.h:
+ *
+ * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
+ *
+ * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
+ * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
+ *
+ * Calling convention macros defined in this file:
+ * KHRONOS_APICALL
+ * KHRONOS_APIENTRY
+ * KHRONOS_APIATTRIBUTES
+ *
+ * These may be used in function prototypes as:
+ *
+ * KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
+ * int arg1,
+ * int arg2) KHRONOS_APIATTRIBUTES;
+ */
+
+/*-------------------------------------------------------------------------
+ * Definition of KHRONOS_APICALL
+ *-------------------------------------------------------------------------
+ * This precedes the return type of the function in the function prototype.
+ */
+#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
+# define KHRONOS_APICALL __declspec(dllimport)
+#elif defined (__SYMBIAN32__)
+# define KHRONOS_APICALL IMPORT_C
+#else
+# define KHRONOS_APICALL
+#endif
+
+/*-------------------------------------------------------------------------
+ * Definition of KHRONOS_APIENTRY
+ *-------------------------------------------------------------------------
+ * This follows the return type of the function and precedes the function
+ * name in the function prototype.
+ */
+#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
+ /* Win32 but not WinCE */
+# define KHRONOS_APIENTRY __stdcall
+#else
+# define KHRONOS_APIENTRY
+#endif
+
+/*-------------------------------------------------------------------------
+ * Chromium-specific overrides of KHRONOS_APICALL and KHRONOS_APIENTRY
+ *-----------------------------------------------------------------------*/
+
+#undef KHRONOS_APICALL
+#if defined(GLES2_USE_MOJO)
+#include "mojo/public/c/gles2/gles2_export.h"
+#define KHRONOS_APICALL MOJO_GLES2_EXPORT
+#else
+#include "gpu/command_buffer/client/gles2_c_lib_export.h"
+#define KHRONOS_APICALL GLES2_C_LIB_EXPORT
+#endif
+
+#undef KHRONOS_APIENTRY
+#define KHRONOS_APIENTRY
+
+/*-------------------------------------------------------------------------
+ * Definition of KHRONOS_APIATTRIBUTES
+ *-------------------------------------------------------------------------
+ * This follows the closing parenthesis of the function prototype arguments.
+ */
+#if defined (__ARMCC_2__)
+#define KHRONOS_APIATTRIBUTES __softfp
+#else
+#define KHRONOS_APIATTRIBUTES
+#endif
+
+/*-------------------------------------------------------------------------
+ * basic type definitions
+ *-----------------------------------------------------------------------*/
+#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
+
+
+/*
+ * Using <stdint.h>
+ */
+#include <stdint.h>
+typedef int32_t khronos_int32_t;
+typedef uint32_t khronos_uint32_t;
+typedef int64_t khronos_int64_t;
+typedef uint64_t khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif defined(__VMS ) || defined(__sgi)
+
+/*
+ * Using <inttypes.h>
+ */
+#include <inttypes.h>
+typedef int32_t khronos_int32_t;
+typedef uint32_t khronos_uint32_t;
+typedef int64_t khronos_int64_t;
+typedef uint64_t khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
+
+/*
+ * Win32
+ */
+typedef __int32 khronos_int32_t;
+typedef unsigned __int32 khronos_uint32_t;
+typedef __int64 khronos_int64_t;
+typedef unsigned __int64 khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif defined(__sun__) || defined(__digital__)
+
+/*
+ * Sun or Digital
+ */
+typedef int khronos_int32_t;
+typedef unsigned int khronos_uint32_t;
+#if defined(__arch64__) || defined(_LP64)
+typedef long int khronos_int64_t;
+typedef unsigned long int khronos_uint64_t;
+#else
+typedef long long int khronos_int64_t;
+typedef unsigned long long int khronos_uint64_t;
+#endif /* __arch64__ */
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#elif 0
+
+/*
+ * Hypothetical platform with no float or int64 support
+ */
+typedef int khronos_int32_t;
+typedef unsigned int khronos_uint32_t;
+#define KHRONOS_SUPPORT_INT64 0
+#define KHRONOS_SUPPORT_FLOAT 0
+
+#else
+
+/*
+ * Generic fallback
+ */
+#include <stdint.h>
+typedef int32_t khronos_int32_t;
+typedef uint32_t khronos_uint32_t;
+typedef int64_t khronos_int64_t;
+typedef uint64_t khronos_uint64_t;
+#define KHRONOS_SUPPORT_INT64 1
+#define KHRONOS_SUPPORT_FLOAT 1
+
+#endif
+
+
+/*
+ * Types that are (so far) the same on all platforms
+ */
+typedef signed char khronos_int8_t;
+typedef unsigned char khronos_uint8_t;
+typedef signed short int khronos_int16_t;
+typedef unsigned short int khronos_uint16_t;
+
+/*
+ * Types that differ between LLP64 and LP64 architectures - in LLP64,
+ * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
+ * to be the only LLP64 architecture in current use.
+ */
+#ifdef _WIN64
+typedef signed long long int khronos_intptr_t;
+typedef unsigned long long int khronos_uintptr_t;
+typedef signed long long int khronos_ssize_t;
+typedef unsigned long long int khronos_usize_t;
+#else
+typedef signed long int khronos_intptr_t;
+typedef unsigned long int khronos_uintptr_t;
+typedef signed long int khronos_ssize_t;
+typedef unsigned long int khronos_usize_t;
+#endif
+
+#if KHRONOS_SUPPORT_FLOAT
+/*
+ * Float type
+ */
+typedef float khronos_float_t;
+#endif
+
+#if KHRONOS_SUPPORT_INT64
+/* Time types
+ *
+ * These types can be used to represent a time interval in nanoseconds or
+ * an absolute Unadjusted System Time. Unadjusted System Time is the number
+ * of nanoseconds since some arbitrary system event (e.g. since the last
+ * time the system booted). The Unadjusted System Time is an unsigned
+ * 64 bit value that wraps back to 0 every 584 years. Time intervals
+ * may be either signed or unsigned.
+ */
+typedef khronos_uint64_t khronos_utime_nanoseconds_t;
+typedef khronos_int64_t khronos_stime_nanoseconds_t;
+#endif
+
+/*
+ * Dummy value used to pad enum types to 32 bits.
+ */
+#ifndef KHRONOS_MAX_ENUM
+#define KHRONOS_MAX_ENUM 0x7FFFFFFF
+#endif
+
+/*
+ * Enumerated boolean type
+ *
+ * Values other than zero should be considered to be true. Therefore
+ * comparisons should not be made against KHRONOS_TRUE.
+ */
+typedef enum {
+ KHRONOS_FALSE = 0,
+ KHRONOS_TRUE = 1,
+ KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
+} khronos_boolean_enum_t;
+
+#endif /* __khrplatform_h_ */
diff --git a/third_party/mojo/src/mojo/public/c/gpu/MGL/mgl.h b/third_party/mojo/src/mojo/public/c/gpu/MGL/mgl.h
new file mode 100644
index 0000000..2633976
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/c/gpu/MGL/mgl.h
@@ -0,0 +1,62 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Note: This header should be compilable as C.
+
+#ifndef MOJO_PUBLIC_C_GPU_MGL_MGL_H_
+#define MOJO_PUBLIC_C_GPU_MGL_MGL_H_
+
+#include <stdint.h>
+
+#include "mojo/public/c/gpu/MGL/mgl_types.h"
+#include "mojo/public/c/system/types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef uint32_t MGLOpenGLAPIVersion;
+
+// OpenGL ES 2.0
+#define MGL_API_VERSION_GLES2 ((MGLOpenGLAPIVersion)1)
+// OpenGL ES 3.0
+#define MGL_API_VERSION_GLES3 ((MGLOpenGLAPIVersion)2)
+// OpenGL ES 3.1
+#define MGL_API_VERSION_GLES31 ((MGLOpenGLAPIVersion)3)
+
+#define MGL_NO_CONTEXT ((MGLContext)0)
+
+struct MojoAsyncWaiter;
+
+// Creates a context at the given API version or returns MGL_NO_CONTEXT.
+// |command_buffer_handle| must be a command buffer message pipe handle from
+// the Gpu service or another source. The callee takes ownership of this
+// handle.
+// |share_group| specifies the share group to create this context in.
+// If this is MGL_NO_CONTEXT a new share group will be created for this context.
+// |lost_callback|, if not null, will be invoked when the context is lost.
+// |async_waiter| must be a pointer to a MojoAsyncWaiter implementation that is
+// usable from any thread the returned MGLContext will be used from
+// for as long as the context exists.
+MGLContext MGLCreateContext(MGLOpenGLAPIVersion version,
+ MojoHandle command_buffer_handle,
+ MGLContext share_group,
+ MGLContextLostCallback lost_callback,
+ void* lost_callback_closure,
+ const struct MojoAsyncWaiter* async_waiter);
+void MGLDestroyContext(MGLContext context);
+
+// Makes |context| the current MGLContext for the calling thread. Calling with
+// MGL_NO_CONTEXT clears the current context.
+void MGLMakeCurrent(MGLContext context);
+
+// Returns the currently bound context for the calling thread or MGL_NO_CONTEXT
+// if there is none.
+MGLContext MGLGetCurrentContext(void);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // MOJO_PUBLIC_C_GPU_MGL_MGL_H_
diff --git a/third_party/mojo/src/mojo/public/c/gpu/MGL/mgl_onscreen.h b/third_party/mojo/src/mojo/public/c/gpu/MGL/mgl_onscreen.h
new file mode 100644
index 0000000..f795214
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/c/gpu/MGL/mgl_onscreen.h
@@ -0,0 +1,29 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Note: This header should be compilable as C.
+
+#ifndef MOJO_PUBLIC_C_GPU_MGL_MGL_ONSCREEN_H_
+#define MOJO_PUBLIC_C_GPU_MGL_MGL_ONSCREEN_H_
+
+#include <stdint.h>
+
+#include "mojo/public/c/gpu/MGL/mgl_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Resizes the default framebuffer for the currently bound onscreen MGLContext.
+void MGLResizeSurface(uint32_t width, uint32_t height);
+
+// Presents the default framebuffer for the currently bound onscreen MGLContext
+// to the windowing system or display.
+void MGLSwapBuffers();
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // MOJO_PUBLIC_C_GPU_MGL_MGL_ONSCREEN_H_
diff --git a/third_party/mojo/src/mojo/public/c/gpu/MGL/mgl_types.h b/third_party/mojo/src/mojo/public/c/gpu/MGL/mgl_types.h
new file mode 100644
index 0000000..2253456
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/c/gpu/MGL/mgl_types.h
@@ -0,0 +1,22 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Note: This header should be compilable as C.
+
+#ifndef MOJO_PUBLIC_C_GPU_MGL_TYPES_H_
+#define MOJO_PUBLIC_C_GPU_MGL_TYPES_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct MGLContextPrivate* MGLContext;
+typedef void (*MGLContextLostCallback)(void* closure);
+typedef void (*MGLSignalSyncPointCallback)(void* closure);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // MOJO_PUBLIC_C_GPU_MGL_TYPES_H_
diff --git a/third_party/mojo/src/mojo/public/c/system/functions.h b/third_party/mojo/src/mojo/public/c/system/functions.h
index c53a4ed..8b576c1 100644
--- a/third_party/mojo/src/mojo/public/c/system/functions.h
+++ b/third_party/mojo/src/mojo/public/c/system/functions.h
@@ -26,7 +26,7 @@ extern "C" {
// Returns the time, in microseconds, since some undefined point in the past.
// The values are only meaningful relative to other values that were obtained
// from the same device without an intervening system restart. Such values are
-// guaranteed to be monotonically-increasing with the passage of real time.
+// guaranteed to be monotonically non-decreasing with the passage of real time.
// Although the units are microseconds, the resolution of the clock may vary and
// is typically in the range of ~1-15 ms.
MOJO_SYSTEM_EXPORT MojoTimeTicks MojoGetTimeTicksNow(void);
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/array.h b/third_party/mojo/src/mojo/public/cpp/bindings/array.h
index 5194663..c51a455 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/array.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/array.h
@@ -8,6 +8,7 @@
#include <string.h>
#include <algorithm>
+#include <set>
#include <string>
#include <vector>
@@ -207,6 +208,34 @@ struct TypeConverter<std::vector<E>, Array<T>> {
}
};
+// A |TypeConverter| that will create an |Array<T>| containing a copy of the
+// contents of an |std::set<E>|, using |TypeConverter<T, E>| to copy each
+// element. The returned array will always be non-null.
+template <typename T, typename E>
+struct TypeConverter<Array<T>, std::set<E>> {
+ static Array<T> Convert(const std::set<E>& input) {
+ Array<T> result(0u);
+ for (auto i : input)
+ result.push_back(TypeConverter<T, E>::Convert(i));
+ return result.Pass();
+ }
+};
+
+// A |TypeConverter| that will create an |std::set<E>| containing a copy of
+// the contents of an |Array<T>|, using |TypeConverter<E, T>| to copy each
+// element. If the input array is null, the output set will be empty.
+template <typename E, typename T>
+struct TypeConverter<std::set<E>, Array<T>> {
+ static std::set<E> Convert(const Array<T>& input) {
+ std::set<E> result;
+ if (!input.is_null()) {
+ for (size_t i = 0; i < input.size(); ++i)
+ result.insert(TypeConverter<E, T>::Convert(input[i]));
+ }
+ return result;
+ }
+};
+
} // namespace mojo
#endif // MOJO_PUBLIC_CPP_BINDINGS_ARRAY_H_
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_handler.cc b/third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_handler.cc
index 00cd3f5..5113bb0 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_handler.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_handler.cc
@@ -56,10 +56,9 @@ bool ControlMessageHandler::Run(Message* message,
RunResponseMessageParams_Data* response_params = nullptr;
Serialize_(response_params_ptr.Pass(), builder.buffer(), &response_params);
- Message response_message;
- response_params->EncodePointersAndHandles(response_message.mutable_handles());
- builder.Finish(&response_message);
- bool ok = responder->Accept(&response_message);
+ response_params->EncodePointersAndHandles(
+ builder.message()->mutable_handles());
+ bool ok = responder->Accept(builder.message());
MOJO_ALLOW_UNUSED_LOCAL(ok);
delete responder;
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_proxy.cc b/third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_proxy.cc
index 11bfce9..ad729c5 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_proxy.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/control_message_proxy.cc
@@ -53,11 +53,9 @@ void SendRunMessage(MessageReceiverWithResponder* receiver,
RunMessageParams_Data* params = nullptr;
Serialize_(params_ptr.Pass(), builder.buffer(), &params);
- Message message;
- params->EncodePointersAndHandles(message.mutable_handles());
- builder.Finish(&message);
+ params->EncodePointersAndHandles(builder.message()->mutable_handles());
MessageReceiver* responder = new RunResponseForwardToCallback(callback);
- if (!receiver->AcceptWithResponder(&message, responder))
+ if (!receiver->AcceptWithResponder(builder.message(), responder))
delete responder;
}
@@ -73,10 +71,8 @@ void SendRunOrClosePipeMessage(MessageReceiverWithResponder* receiver,
RunOrClosePipeMessageParams_Data* params = nullptr;
Serialize_(params_ptr.Pass(), builder.buffer(), &params);
- Message message;
- params->EncodePointersAndHandles(message.mutable_handles());
- builder.Finish(&message);
- bool ok = receiver->Accept(&message);
+ params->EncodePointersAndHandles(builder.message()->mutable_handles());
+ bool ok = receiver->Accept(builder.message());
MOJO_ALLOW_UNUSED_LOCAL(ok);
}
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.cc b/third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.cc
index 980abc3..c81fc6e 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.cc
@@ -14,14 +14,14 @@
namespace mojo {
namespace internal {
-FixedBuffer::FixedBuffer(size_t size)
- : ptr_(nullptr), cursor_(0), size_(internal::Align(size)) {
- // calloc() required to zero memory and thus avoid info leaks.
- ptr_ = static_cast<char*>(calloc(size_, 1));
-}
+FixedBuffer::FixedBuffer() : ptr_(nullptr), cursor_(0), size_(0) {}
-FixedBuffer::~FixedBuffer() {
- free(ptr_);
+void FixedBuffer::Initialize(void* memory, size_t size) {
+ MOJO_DCHECK(size == internal::Align(size));
+
+ ptr_ = static_cast<char*>(memory);
+ cursor_ = 0;
+ size_ = size;
}
void* FixedBuffer::Allocate(size_t delta) {
@@ -38,7 +38,17 @@ void* FixedBuffer::Allocate(size_t delta) {
return result;
}
-void* FixedBuffer::Leak() {
+FixedBufferForTesting::FixedBufferForTesting(size_t size) {
+ size_ = internal::Align(size);
+ // Use calloc here to ensure all message memory is zero'd out.
+ ptr_ = static_cast<char*>(calloc(size_, 1));
+}
+
+FixedBufferForTesting::~FixedBufferForTesting() {
+ free(ptr_);
+}
+
+void* FixedBufferForTesting::Leak() {
char* ptr = ptr_;
ptr_ = nullptr;
cursor_ = 0;
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.h
index c6cf34e..83eaf97 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.h
@@ -34,18 +34,33 @@ namespace internal {
//
// free(data);
// }
-//
+
class FixedBuffer : public Buffer {
public:
- explicit FixedBuffer(size_t size);
- ~FixedBuffer() override;
+ FixedBuffer();
+
+ // |size| should be aligned using internal::Align.
+ void Initialize(void* memory, size_t size);
+
+ size_t size() const { return size_; }
// Grows the buffer by |num_bytes| and returns a pointer to the start of the
// addition. The resulting address is 8-byte aligned, and the content of the
// memory is zero-filled.
void* Allocate(size_t num_bytes) override;
- size_t size() const { return size_; }
+ protected:
+ char* ptr_;
+ size_t cursor_;
+ size_t size_;
+
+ MOJO_DISALLOW_COPY_AND_ASSIGN(FixedBuffer);
+};
+
+class FixedBufferForTesting : public FixedBuffer {
+ public:
+ explicit FixedBufferForTesting(size_t size);
+ ~FixedBufferForTesting() override;
// Returns the internal memory owned by the Buffer to the caller. The Buffer
// relinquishes its pointer, effectively resetting the state of the Buffer
@@ -54,11 +69,7 @@ class FixedBuffer : public Buffer {
void* Leak();
private:
- char* ptr_;
- size_t cursor_;
- size_t size_;
-
- MOJO_DISALLOW_COPY_AND_ASSIGN(FixedBuffer);
+ MOJO_DISALLOW_COPY_AND_ASSIGN(FixedBufferForTesting);
};
} // namespace internal
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/message.cc b/third_party/mojo/src/mojo/public/cpp/bindings/lib/message.cc
index 2723bcb..6b563e7 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/message.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/message.cc
@@ -12,36 +12,60 @@
namespace mojo {
-Message::Message() : data_num_bytes_(0), data_(nullptr) {
+Message::Message() {
+ Initialize();
}
Message::~Message() {
- free(data_);
+ FreeDataAndCloseHandles();
+}
- for (std::vector<Handle>::iterator it = handles_.begin();
- it != handles_.end();
- ++it) {
- if (it->is_valid())
- CloseRaw(*it);
- }
+void Message::Reset() {
+ FreeDataAndCloseHandles();
+
+ handles_.clear();
+ Initialize();
}
-void Message::AllocUninitializedData(uint32_t num_bytes) {
+void Message::AllocData(uint32_t num_bytes) {
MOJO_DCHECK(!data_);
data_num_bytes_ = num_bytes;
- data_ = static_cast<internal::MessageData*>(malloc(num_bytes));
+ data_ = static_cast<internal::MessageData*>(calloc(num_bytes, 1));
}
-void Message::AdoptData(uint32_t num_bytes, internal::MessageData* data) {
+void Message::AllocUninitializedData(uint32_t num_bytes) {
MOJO_DCHECK(!data_);
data_num_bytes_ = num_bytes;
- data_ = data;
+ data_ = static_cast<internal::MessageData*>(malloc(num_bytes));
+}
+
+void Message::MoveTo(Message* destination) {
+ MOJO_DCHECK(this != destination);
+
+ destination->FreeDataAndCloseHandles();
+
+ // No copy needed.
+ destination->data_num_bytes_ = data_num_bytes_;
+ destination->data_ = data_;
+ std::swap(destination->handles_, handles_);
+
+ handles_.clear();
+ Initialize();
+}
+
+void Message::Initialize() {
+ data_num_bytes_ = 0;
+ data_ = nullptr;
}
-void Message::Swap(Message* other) {
- std::swap(data_num_bytes_, other->data_num_bytes_);
- std::swap(data_, other->data_);
- std::swap(handles_, other->handles_);
+void Message::FreeDataAndCloseHandles() {
+ free(data_);
+
+ for (std::vector<Handle>::iterator it = handles_.begin();
+ it != handles_.end(); ++it) {
+ if (it->is_valid())
+ CloseRaw(*it);
+ }
}
MojoResult ReadAndDispatchMessage(MessagePipeHandle handle,
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_builder.cc b/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_builder.cc
index 003aba5..25f1862 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_builder.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_builder.cc
@@ -4,6 +4,7 @@
#include "mojo/public/cpp/bindings/lib/message_builder.h"
+#include "mojo/public/cpp/bindings/lib/bindings_serialization.h"
#include "mojo/public/cpp/bindings/message.h"
namespace mojo {
@@ -15,8 +16,9 @@ void Allocate(Buffer* buf, Header** header) {
(*header)->num_bytes = sizeof(Header);
}
-MessageBuilder::MessageBuilder(uint32_t name, size_t payload_size)
- : buf_(sizeof(MessageHeader) + payload_size) {
+MessageBuilder::MessageBuilder(uint32_t name, size_t payload_size) {
+ Initialize(sizeof(MessageHeader) + payload_size);
+
MessageHeader* header;
Allocate(&buf_, &header);
header->version = 0;
@@ -26,19 +28,18 @@ MessageBuilder::MessageBuilder(uint32_t name, size_t payload_size)
MessageBuilder::~MessageBuilder() {
}
-void MessageBuilder::Finish(Message* message) {
- uint32_t num_bytes = static_cast<uint32_t>(buf_.size());
- message->AdoptData(num_bytes, static_cast<MessageData*>(buf_.Leak()));
-}
+MessageBuilder::MessageBuilder() {}
-MessageBuilder::MessageBuilder(size_t size) : buf_(size) {
+void MessageBuilder::Initialize(size_t size) {
+ message_.AllocData(static_cast<uint32_t>(Align(size)));
+ buf_.Initialize(message_.mutable_data(), message_.data_num_bytes());
}
MessageWithRequestIDBuilder::MessageWithRequestIDBuilder(uint32_t name,
size_t payload_size,
uint32_t flags,
- uint64_t request_id)
- : MessageBuilder(sizeof(MessageHeaderWithRequestID) + payload_size) {
+ uint64_t request_id) {
+ Initialize(sizeof(MessageHeaderWithRequestID) + payload_size);
MessageHeaderWithRequestID* header;
Allocate(&buf_, &header);
header->version = 1;
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_builder.h b/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_builder.h
index a10940c..86ae71d 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_builder.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/lib/message_builder.h
@@ -9,6 +9,7 @@
#include "mojo/public/cpp/bindings/lib/fixed_buffer.h"
#include "mojo/public/cpp/bindings/lib/message_internal.h"
+#include "mojo/public/cpp/bindings/message.h"
namespace mojo {
class Message;
@@ -21,14 +22,13 @@ class MessageBuilder {
~MessageBuilder();
Buffer* buffer() { return &buf_; }
-
- // Call Finish when done making allocations in |buffer()|. Upon return,
- // |message| will contain the message data, and |buffer()| will no longer be
- // valid to reference.
- void Finish(Message* message);
+ Message* message() { return &message_; }
protected:
- explicit MessageBuilder(size_t size);
+ MessageBuilder();
+ void Initialize(size_t size);
+
+ Message message_;
FixedBuffer buf_;
MOJO_DISALLOW_COPY_AND_ASSIGN(MessageBuilder);
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/message.h b/third_party/mojo/src/mojo/public/cpp/bindings/message.h
index d8e3859..7e34606 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/message.h
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/message.h
@@ -21,12 +21,13 @@ class Message {
Message();
~Message();
- // These may only be called on a newly created Message object.
+ void Reset();
+
+ void AllocData(uint32_t num_bytes);
void AllocUninitializedData(uint32_t num_bytes);
- void AdoptData(uint32_t num_bytes, internal::MessageData* data);
- // Swaps data and handles between this Message and another.
- void Swap(Message* other);
+ // Transfers data and handles to |destination|.
+ void MoveTo(Message* destination);
uint32_t data_num_bytes() const { return data_num_bytes_; }
@@ -72,8 +73,11 @@ class Message {
std::vector<Handle>* mutable_handles() { return &handles_; }
private:
+ void Initialize();
+ void FreeDataAndCloseHandles();
+
uint32_t data_num_bytes_;
- internal::MessageData* data_; // Heap-allocated using malloc.
+ internal::MessageData* data_;
std::vector<Handle> handles_;
MOJO_DISALLOW_COPY_AND_ASSIGN(Message);
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/array_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/array_unittest.cc
index 89d3007..293dc95 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/array_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/array_unittest.cc
@@ -17,7 +17,7 @@ namespace {
using mojo::internal::Array_Data;
using mojo::internal::ArrayValidateParams;
-using mojo::internal::FixedBuffer;
+using mojo::internal::FixedBufferForTesting;
using mojo::internal::String_Data;
class ArrayTest : public testing::Test {
@@ -157,7 +157,7 @@ TEST_F(ArrayTest, Serialization_ArrayOfPOD) {
size_t size = GetSerializedSize_(array);
EXPECT_EQ(8U + 4 * 4U, size);
- FixedBuffer buf(size);
+ FixedBufferForTesting buf(size);
Array_Data<int32_t>* data;
ArrayValidateParams validate_params(0, false, nullptr);
SerializeArray_(array.Pass(), &buf, &data, &validate_params);
@@ -175,7 +175,7 @@ TEST_F(ArrayTest, Serialization_EmptyArrayOfPOD) {
size_t size = GetSerializedSize_(array);
EXPECT_EQ(8U, size);
- FixedBuffer buf(size);
+ FixedBufferForTesting buf(size);
Array_Data<int32_t>* data;
ArrayValidateParams validate_params(0, false, nullptr);
SerializeArray_(array.Pass(), &buf, &data, &validate_params);
@@ -197,7 +197,7 @@ TEST_F(ArrayTest, Serialization_ArrayOfArrayOfPOD) {
size_t size = GetSerializedSize_(array);
EXPECT_EQ(8U + 2 * 8U + 2 * (8U + 4 * 4U), size);
- FixedBuffer buf(size);
+ FixedBufferForTesting buf(size);
Array_Data<Array_Data<int32_t>*>* data;
ArrayValidateParams validate_params(
0, false, new ArrayValidateParams(0, false, nullptr));
@@ -223,7 +223,7 @@ TEST_F(ArrayTest, Serialization_ArrayOfBool) {
size_t size = GetSerializedSize_(array);
EXPECT_EQ(8U + 8U, size);
- FixedBuffer buf(size);
+ FixedBufferForTesting buf(size);
Array_Data<bool>* data;
ArrayValidateParams validate_params(0, false, nullptr);
SerializeArray_(array.Pass(), &buf, &data, &validate_params);
@@ -250,7 +250,7 @@ TEST_F(ArrayTest, Serialization_ArrayOfString) {
8U), // string length of 1 padded to 8
size);
- FixedBuffer buf(size);
+ FixedBufferForTesting buf(size);
Array_Data<String_Data*>* data;
ArrayValidateParams validate_params(
0, false, new ArrayValidateParams(0, false, nullptr));
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/buffer_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/buffer_unittest.cc
index 1d7e677..317a2a5 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/buffer_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/buffer_unittest.cc
@@ -23,7 +23,7 @@ bool IsZero(void* p_buf, size_t size) {
// Tests that FixedBuffer allocates memory aligned to 8 byte boundaries.
TEST(FixedBufferTest, Alignment) {
- internal::FixedBuffer buf(internal::Align(10) * 2);
+ internal::FixedBufferForTesting buf(internal::Align(10) * 2);
ASSERT_EQ(buf.size(), 16u * 2);
void* a = buf.Allocate(10);
@@ -39,12 +39,12 @@ TEST(FixedBufferTest, Alignment) {
// Any more allocations would result in an assert, but we can't test that.
}
-// Tests that FixedBuffer::Leak passes ownership to the caller.
+// Tests that FixedBufferForTesting::Leak passes ownership to the caller.
TEST(FixedBufferTest, Leak) {
void* ptr = nullptr;
void* buf_ptr = nullptr;
{
- internal::FixedBuffer buf(8);
+ internal::FixedBufferForTesting buf(8);
ASSERT_EQ(8u, buf.size());
ptr = buf.Allocate(8);
@@ -55,20 +55,20 @@ TEST(FixedBufferTest, Leak) {
// TODO(mpcomplete): Is this a reasonable expectation?
EXPECT_EQ(ptr, buf_ptr);
- // The FixedBuffer should be empty now.
+ // The FixedBufferForTesting should be empty now.
EXPECT_EQ(0u, buf.size());
EXPECT_FALSE(buf.Leak());
}
- // Since we called Leak, ptr is still writable after FixedBuffer went out of
- // scope.
+ // Since we called Leak, ptr is still writable after FixedBufferForTesting
+ // went out of scope.
memset(ptr, 1, 8);
free(buf_ptr);
}
#if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
TEST(FixedBufferTest, TooBig) {
- internal::FixedBuffer buf(24);
+ internal::FixedBufferForTesting buf(24);
// A little bit too large.
EXPECT_EQ(reinterpret_cast<void*>(0), buf.Allocate(32));
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/connector_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/connector_unittest.cc
index aab5a39..c236d40 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/connector_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/connector_unittest.cc
@@ -85,7 +85,8 @@ class ConnectorTest : public testing::Test {
size_t payload_size = strlen(text) + 1; // Plus null terminator.
internal::MessageBuilder builder(1, payload_size);
memcpy(builder.buffer()->Allocate(payload_size), text, payload_size);
- builder.Finish(message);
+
+ builder.message()->MoveTo(message);
}
void PumpMessages() { loop_.RunUntilIdle(); }
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc
index 681cc6d..6c19285 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc
@@ -9,6 +9,7 @@
#include "mojo/public/interfaces/bindings/tests/math_calculator.mojom.h"
#include "mojo/public/interfaces/bindings/tests/sample_interfaces.mojom.h"
#include "mojo/public/interfaces/bindings/tests/sample_service.mojom.h"
+#include "mojo/public/interfaces/bindings/tests/scoping.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace mojo {
@@ -572,6 +573,77 @@ TEST(WeakConnectorTest, Math) {
EXPECT_FALSE(destroyed);
}
+class CImpl : public C {
+ public:
+ CImpl(bool* d_called, InterfaceRequest<C> request)
+ : d_called_(d_called),
+ binding_(this, request.Pass()) {}
+ ~CImpl() override {}
+
+ private:
+ void D() override {
+ *d_called_ = true;
+ }
+
+ bool* d_called_;
+ StrongBinding<C> binding_;
+};
+
+class BImpl : public B {
+ public:
+ BImpl(bool* d_called, InterfaceRequest<B> request)
+ : d_called_(d_called),
+ binding_(this, request.Pass()) {}
+ ~BImpl() override {}
+
+ private:
+ void GetC(InterfaceRequest<C> c) override {
+ new CImpl(d_called_, c.Pass());
+ }
+
+ bool* d_called_;
+ StrongBinding<B> binding_;
+};
+
+class AImpl : public A {
+ public:
+ explicit AImpl(InterfaceRequest<A> request)
+ : d_called_(false),
+ binding_(this, request.Pass()) {}
+ ~AImpl() override {}
+
+ bool d_called() const { return d_called_; }
+
+ private:
+ void GetB(InterfaceRequest<B> b) override {
+ new BImpl(&d_called_, b.Pass());
+ }
+
+ bool d_called_;
+ Binding<A> binding_;
+};
+
+TEST_F(InterfacePtrTest, Scoping) {
+ APtr a;
+ AImpl a_impl(GetProxy(&a));
+
+ EXPECT_FALSE(a_impl.d_called());
+
+ {
+ BPtr b;
+ a->GetB(GetProxy(&b));
+ CPtr c;
+ b->GetC(GetProxy(&c));
+ c->D();
+ }
+
+ // While B & C have fallen out of scope, the pipes will remain until they are
+ // flushed.
+ EXPECT_FALSE(a_impl.d_called());
+ PumpMessages();
+ EXPECT_TRUE(a_impl.d_called());
+}
+
} // namespace
} // namespace test
} // namespace mojo
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/map_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/map_unittest.cc
index a604c20..44100a4 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/map_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/map_unittest.cc
@@ -20,7 +20,7 @@ namespace {
using mojo::internal::Array_Data;
using mojo::internal::ArrayValidateParams;
-using mojo::internal::FixedBuffer;
+using mojo::internal::FixedBufferForTesting;
using mojo::internal::Map_Data;
using mojo::internal::String_Data;
@@ -279,7 +279,7 @@ TEST_F(MapTest, ArrayOfMap) {
array[0].insert(1, 42);
size_t size = GetSerializedSize_(array);
- FixedBuffer buf(size);
+ FixedBufferForTesting buf(size);
Array_Data<Map_Data<int32_t, int8_t>*>* data;
ArrayValidateParams validate_params(
0, false, new ArrayValidateParams(0, false, nullptr));
@@ -301,7 +301,7 @@ TEST_F(MapTest, ArrayOfMap) {
array[0].insert("hello world", map_value.Pass());
size_t size = GetSerializedSize_(array);
- FixedBuffer buf(size);
+ FixedBufferForTesting buf(size);
Array_Data<Map_Data<String_Data*, Array_Data<bool>*>*>* data;
ArrayValidateParams validate_params(
0, false, new ArrayValidateParams(
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/message_queue.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/message_queue.cc
index 65b9a5c..71cb4905 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/message_queue.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/message_queue.cc
@@ -24,12 +24,12 @@ bool MessageQueue::IsEmpty() const {
void MessageQueue::Push(Message* message) {
queue_.push(new Message());
- queue_.back()->Swap(message);
+ message->MoveTo(queue_.back());
}
void MessageQueue::Pop(Message* message) {
MOJO_DCHECK(!queue_.empty());
- queue_.front()->Swap(message);
+ queue_.front()->MoveTo(message);
Pop();
}
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/router_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/router_unittest.cc
index 7aeb414..6880fd0 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/router_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/router_unittest.cc
@@ -21,7 +21,8 @@ void AllocRequestMessage(uint32_t name, const char* text, Message* message) {
size_t payload_size = strlen(text) + 1; // Plus null terminator.
internal::RequestMessageBuilder builder(name, payload_size);
memcpy(builder.buffer()->Allocate(payload_size), text, payload_size);
- builder.Finish(message);
+
+ builder.message()->MoveTo(message);
}
void AllocResponseMessage(uint32_t name,
@@ -31,7 +32,8 @@ void AllocResponseMessage(uint32_t name,
size_t payload_size = strlen(text) + 1; // Plus null terminator.
internal::ResponseMessageBuilder builder(name, payload_size, request_id);
memcpy(builder.buffer()->Allocate(payload_size), text, payload_size);
- builder.Finish(message);
+
+ builder.message()->MoveTo(message);
}
class MessageAccumulator : public MessageReceiver {
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/serialization_warning_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/serialization_warning_unittest.cc
index 75320ab..43955cb 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/serialization_warning_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/serialization_warning_unittest.cc
@@ -59,7 +59,7 @@ class SerializationWarningTest : public testing::Test {
mojo::internal::ValidationError expected_warning) {
warning_observer_.set_last_warning(mojo::internal::VALIDATION_ERROR_NONE);
- mojo::internal::FixedBuffer buf(GetSerializedSize_(obj));
+ mojo::internal::FixedBufferForTesting buf(GetSerializedSize_(obj));
typename T::Data_* data;
Serialize_(obj.Pass(), &buf, &data);
@@ -72,7 +72,7 @@ class SerializationWarningTest : public testing::Test {
const ArrayValidateParams* validate_params) {
warning_observer_.set_last_warning(mojo::internal::VALIDATION_ERROR_NONE);
- mojo::internal::FixedBuffer buf(GetSerializedSize_(obj));
+ mojo::internal::FixedBufferForTesting buf(GetSerializedSize_(obj));
typename T::Data_* data;
SerializeArray_(obj.Pass(), &buf, &data, validate_params);
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/struct_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/struct_unittest.cc
index 3fb4a28..71069d2 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/struct_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/struct_unittest.cc
@@ -52,7 +52,7 @@ U SerializeAndDeserialize(T input) {
typedef typename mojo::internal::WrapperTraits<U>::DataType OutputDataType;
size_t size = GetSerializedSize_(input);
- mojo::internal::FixedBuffer buf(size + 32);
+ mojo::internal::FixedBufferForTesting buf(size + 32);
InputDataType data;
Serialize_(input.Pass(), &buf, &data);
@@ -141,7 +141,7 @@ TEST_F(StructTest, Serialization_Basic) {
size_t size = GetSerializedSize_(rect);
EXPECT_EQ(8U + 16U, size);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::Rect_Data* data;
Serialize_(rect.Pass(), &buf, &data);
@@ -174,7 +174,7 @@ TEST_F(StructTest, Serialization_StructPointers) {
size_t size = GetSerializedSize_(pair);
EXPECT_EQ(8U + 16U + 2 * (8U + 16U), size);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::RectPair_Data* data;
Serialize_(pair.Pass(), &buf, &data);
@@ -205,7 +205,7 @@ TEST_F(StructTest, Serialization_ArrayPointers) {
16U), // rect payload (four ints)
size);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::NamedRegion_Data* data;
Serialize_(region.Pass(), &buf, &data);
@@ -231,7 +231,7 @@ TEST_F(StructTest, Serialization_NullArrayPointers) {
8U, // rects pointer
size);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::NamedRegion_Data* data;
Serialize_(region.Pass(), &buf, &data);
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/union_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/union_unittest.cc
index e6e38de..a0e52d4 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/union_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/union_unittest.cc
@@ -120,7 +120,7 @@ TEST(UnionTest, PodSerialization) {
size_t size = GetSerializedSize_(pod1, false);
EXPECT_EQ(16U, size);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::PodUnion_Data* data = nullptr;
SerializeUnion_(pod1.Pass(), &buf, &data, false);
@@ -139,7 +139,7 @@ TEST(UnionTest, EnumSerialization) {
size_t size = GetSerializedSize_(pod1, false);
EXPECT_EQ(16U, size);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::PodUnion_Data* data = nullptr;
SerializeUnion_(pod1.Pass(), &buf, &data, false);
@@ -158,7 +158,7 @@ TEST(UnionTest, PodValidation) {
size_t size = GetSerializedSize_(pod, false);
EXPECT_EQ(16U, size);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::PodUnion_Data* data = nullptr;
SerializeUnion_(pod.Pass(), &buf, &data, false);
void* raw_buf = buf.Leak();
@@ -173,7 +173,7 @@ TEST(UnionTest, SerializeNotNull) {
PodUnionPtr pod(PodUnion::New());
pod->set_f_int8(0);
size_t size = GetSerializedSize_(pod, false);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::PodUnion_Data* data = nullptr;
SerializeUnion_(pod.Pass(), &buf, &data, false);
EXPECT_FALSE(data->is_null());
@@ -183,7 +183,7 @@ TEST(UnionTest, SerializeIsNullInlined) {
PodUnionPtr pod;
size_t size = GetSerializedSize_(pod, false);
EXPECT_EQ(16U, size);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::PodUnion_Data* data = internal::PodUnion_Data::New(&buf);
// Check that dirty output buffers are handled correctly by serialization.
@@ -203,7 +203,7 @@ TEST(UnionTest, SerializeIsNullNotInlined) {
PodUnionPtr pod;
size_t size = GetSerializedSize_(pod, false);
EXPECT_EQ(16U, size);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::PodUnion_Data* data = nullptr;
SerializeUnion_(pod.Pass(), &buf, &data, false);
EXPECT_EQ(nullptr, data);
@@ -219,7 +219,7 @@ TEST(UnionTest, OutOfAlignmentValidation) {
Environment environment;
size_t size = sizeof(internal::PodUnion_Data);
// Get an aligned object and shift the alignment.
- mojo::internal::FixedBuffer aligned_buf(size + 1);
+ mojo::internal::FixedBufferForTesting aligned_buf(size + 1);
void* raw_buf = aligned_buf.Leak();
char* buf = reinterpret_cast<char*>(raw_buf) + 1;
@@ -234,7 +234,7 @@ TEST(UnionTest, OutOfAlignmentValidation) {
TEST(UnionTest, OOBValidation) {
Environment environment;
size_t size = sizeof(internal::PodUnion_Data) - 1;
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::PodUnion_Data* data = internal::PodUnion_Data::New(&buf);
mojo::internal::BoundsChecker bounds_checker(data,
static_cast<uint32_t>(size), 0);
@@ -247,7 +247,7 @@ TEST(UnionTest, OOBValidation) {
TEST(UnionTest, UnknownTagValidation) {
Environment environment;
size_t size = sizeof(internal::PodUnion_Data);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::PodUnion_Data* data = internal::PodUnion_Data::New(&buf);
data->tag = static_cast<internal::PodUnion_Data::PodUnion_Tag>(0xFFFFFF);
mojo::internal::BoundsChecker bounds_checker(data,
@@ -298,7 +298,7 @@ TEST(UnionTest, StringSerialization) {
pod1->set_f_string(hello);
size_t size = GetSerializedSize_(pod1, false);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::ObjectUnion_Data* data = nullptr;
SerializeUnion_(pod1.Pass(), &buf, &data, false);
@@ -316,7 +316,7 @@ TEST(UnionTest, StringSerialization) {
TEST(UnionTest, NullStringValidation) {
Environment environment;
size_t size = sizeof(internal::ObjectUnion_Data);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::ObjectUnion_Data* data = internal::ObjectUnion_Data::New(&buf);
data->tag = internal::ObjectUnion_Data::ObjectUnion_Tag::F_STRING;
data->data.unknown = 0x0;
@@ -331,7 +331,7 @@ TEST(UnionTest, NullStringValidation) {
TEST(UnionTest, StringPointerOverflowValidation) {
Environment environment;
size_t size = sizeof(internal::ObjectUnion_Data);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::ObjectUnion_Data* data = internal::ObjectUnion_Data::New(&buf);
data->tag = internal::ObjectUnion_Data::ObjectUnion_Tag::F_STRING;
data->data.unknown = 0xFFFFFFFFFFFFFFFF;
@@ -346,7 +346,7 @@ TEST(UnionTest, StringPointerOverflowValidation) {
TEST(UnionTest, StringValidateOOB) {
Environment environment;
size_t size = 32;
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::ObjectUnion_Data* data = internal::ObjectUnion_Data::New(&buf);
data->tag = internal::ObjectUnion_Data::ObjectUnion_Tag::F_STRING;
@@ -391,7 +391,7 @@ TEST(UnionTest, PodUnionInArraySerialization) {
size_t size = GetSerializedSize_(array);
EXPECT_EQ(40U, size);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
mojo::internal::Array_Data<internal::PodUnion_Data>* data;
mojo::internal::ArrayValidateParams validate_params(0, false, nullptr);
SerializeArray_(array.Pass(), &buf, &data, &validate_params);
@@ -416,7 +416,7 @@ TEST(UnionTest, PodUnionInArraySerializationWithNull) {
size_t size = GetSerializedSize_(array);
EXPECT_EQ(40U, size);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
mojo::internal::Array_Data<internal::PodUnion_Data>* data;
mojo::internal::ArrayValidateParams validate_params(0, true, nullptr);
SerializeArray_(array.Pass(), &buf, &data, &validate_params);
@@ -451,7 +451,7 @@ TEST(UnionTest, Serialization_UnionOfPods) {
size_t size = GetSerializedSize_(small_struct);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::SmallStruct_Data* data = nullptr;
Serialize_(small_struct.Pass(), &buf, &data);
@@ -471,7 +471,7 @@ TEST(UnionTest, Serialization_UnionOfObjects) {
size_t size = GetSerializedSize_(obj_struct);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::SmallObjStruct_Data* data = nullptr;
Serialize_(obj_struct.Pass(), &buf, &data);
@@ -494,7 +494,7 @@ TEST(UnionTest, Validation_UnionsInStruct) {
size_t size = GetSerializedSize_(small_struct);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::SmallStruct_Data* data = nullptr;
Serialize_(small_struct.Pass(), &buf, &data);
@@ -514,7 +514,7 @@ TEST(UnionTest, Validation_PodUnionInStruct_Failure) {
size_t size = GetSerializedSize_(small_struct);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::SmallStruct_Data* data = nullptr;
Serialize_(small_struct.Pass(), &buf, &data);
data->pod_union.tag = static_cast<internal::PodUnion_Data::PodUnion_Tag>(100);
@@ -534,7 +534,7 @@ TEST(UnionTest, Validation_NullUnion_Failure) {
size_t size = GetSerializedSize_(small_struct);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::SmallStructNonNullableUnion_Data* data =
internal::SmallStructNonNullableUnion_Data::New(&buf);
@@ -553,7 +553,7 @@ TEST(UnionTest, Validation_NullableUnion) {
size_t size = GetSerializedSize_(small_struct);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::SmallStruct_Data* data = nullptr;
Serialize_(small_struct.Pass(), &buf, &data);
@@ -591,7 +591,7 @@ TEST(UnionTest, PodUnionInMapSerialization) {
size_t size = GetSerializedSize_(map);
EXPECT_EQ(120U, size);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
mojo::internal::Map_Data<mojo::internal::String_Data*,
internal::PodUnion_Data>* data;
mojo::internal::ArrayValidateParams validate_params(0, false, nullptr);
@@ -615,7 +615,7 @@ TEST(UnionTest, PodUnionInMapSerializationWithNull) {
size_t size = GetSerializedSize_(map);
EXPECT_EQ(120U, size);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
mojo::internal::Map_Data<mojo::internal::String_Data*,
internal::PodUnion_Data>* data;
mojo::internal::ArrayValidateParams validate_params(0, true, nullptr);
@@ -649,7 +649,7 @@ TEST(UnionTest, StructInUnionSerialization) {
size_t size = GetSerializedSize_(obj, false);
EXPECT_EQ(32U, size);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::ObjectUnion_Data* data = nullptr;
SerializeUnion_(obj.Pass(), &buf, &data, false);
@@ -672,7 +672,7 @@ TEST(UnionTest, StructInUnionValidation) {
size_t size = GetSerializedSize_(obj, false);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::ObjectUnion_Data* data = nullptr;
SerializeUnion_(obj.Pass(), &buf, &data, false);
@@ -693,7 +693,7 @@ TEST(UnionTest, StructInUnionValidationNonNullable) {
size_t size = GetSerializedSize_(obj, false);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::ObjectUnion_Data* data = nullptr;
SerializeUnion_(obj.Pass(), &buf, &data, false);
@@ -714,7 +714,7 @@ TEST(UnionTest, StructInUnionValidationNullable) {
size_t size = GetSerializedSize_(obj, false);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::ObjectUnion_Data* data = nullptr;
SerializeUnion_(obj.Pass(), &buf, &data, false);
@@ -753,7 +753,7 @@ TEST(UnionTest, ArrayInUnionSerialization) {
size_t size = GetSerializedSize_(obj, false);
EXPECT_EQ(32U, size);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::ObjectUnion_Data* data = nullptr;
SerializeUnion_(obj.Pass(), &buf, &data, false);
@@ -779,7 +779,7 @@ TEST(UnionTest, ArrayInUnionValidation) {
obj->set_f_array_int8(array.Pass());
size_t size = GetSerializedSize_(obj, false);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::ObjectUnion_Data* data = nullptr;
SerializeUnion_(obj.Pass(), &buf, &data, false);
@@ -820,7 +820,7 @@ TEST(UnionTest, MapInUnionSerialization) {
size_t size = GetSerializedSize_(obj, false);
EXPECT_EQ(112U, size);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::ObjectUnion_Data* data = nullptr;
SerializeUnion_(obj.Pass(), &buf, &data, false);
@@ -847,7 +847,7 @@ TEST(UnionTest, MapInUnionValidation) {
size_t size = GetSerializedSize_(obj, false);
EXPECT_EQ(112U, size);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::ObjectUnion_Data* data = nullptr;
SerializeUnion_(obj.Pass(), &buf, &data, false);
@@ -884,7 +884,7 @@ TEST(UnionTest, UnionInUnionSerialization) {
size_t size = GetSerializedSize_(obj, false);
EXPECT_EQ(32U, size);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::ObjectUnion_Data* data = nullptr;
SerializeUnion_(obj.Pass(), &buf, &data, false);
@@ -908,7 +908,7 @@ TEST(UnionTest, UnionInUnionValidation) {
size_t size = GetSerializedSize_(obj, false);
EXPECT_EQ(32U, size);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::ObjectUnion_Data* data = nullptr;
SerializeUnion_(obj.Pass(), &buf, &data, false);
@@ -932,7 +932,7 @@ TEST(UnionTest, UnionInUnionValidationNonNullable) {
size_t size = GetSerializedSize_(obj, false);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::ObjectUnion_Data* data = nullptr;
SerializeUnion_(obj.Pass(), &buf, &data, false);
std::vector<Handle> handles;
@@ -976,7 +976,7 @@ TEST(UnionTest, HandleInUnionSerialization) {
size_t size = GetSerializedSize_(handle, false);
EXPECT_EQ(16U, size);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::HandleUnion_Data* data = nullptr;
SerializeUnion_(handle.Pass(), &buf, &data, false);
@@ -1010,7 +1010,7 @@ TEST(UnionTest, HandleInUnionValidation) {
size_t size = GetSerializedSize_(handle, false);
EXPECT_EQ(16U, size);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::HandleUnion_Data* data = nullptr;
SerializeUnion_(handle.Pass(), &buf, &data, false);
@@ -1034,7 +1034,7 @@ TEST(UnionTest, HandleInUnionValidationNull) {
size_t size = GetSerializedSize_(handle, false);
EXPECT_EQ(16U, size);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::HandleUnion_Data* data = nullptr;
SerializeUnion_(handle.Pass(), &buf, &data, false);
@@ -1091,7 +1091,7 @@ TEST(UnionTest, InterfaceInUnionSerialization) {
size_t size = GetSerializedSize_(handle, false);
EXPECT_EQ(16U, size);
- mojo::internal::FixedBuffer buf(size);
+ mojo::internal::FixedBufferForTesting buf(size);
internal::HandleUnion_Data* data = nullptr;
SerializeUnion_(handle.Pass(), &buf, &data, false);
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/tests/validation_unittest.cc b/third_party/mojo/src/mojo/public/cpp/bindings/tests/validation_unittest.cc
index 39befaf..8f40401 100644
--- a/third_party/mojo/src/mojo/public/cpp/bindings/tests/validation_unittest.cc
+++ b/third_party/mojo/src/mojo/public/cpp/bindings/tests/validation_unittest.cc
@@ -431,6 +431,39 @@ TEST_F(ValidationIntegrationTest, Binding) {
RunValidationTests("integration_msghdr", test_message_receiver());
}
+// Tests the IsValidValue() function generated for BasicEnum.
+TEST(EnumValueValidationTest, BasicEnum) {
+ // BasicEnum can have -3,0,1,10 as possible integral values.
+ EXPECT_FALSE(BasicEnum_IsValidValue(static_cast<BasicEnum>(-4)));
+ EXPECT_TRUE(BasicEnum_IsValidValue(static_cast<BasicEnum>(-3)));
+ EXPECT_FALSE(BasicEnum_IsValidValue(static_cast<BasicEnum>(-2)));
+ EXPECT_FALSE(BasicEnum_IsValidValue(static_cast<BasicEnum>(-1)));
+ EXPECT_TRUE(BasicEnum_IsValidValue(static_cast<BasicEnum>(0)));
+ EXPECT_TRUE(BasicEnum_IsValidValue(static_cast<BasicEnum>(1)));
+ EXPECT_FALSE(BasicEnum_IsValidValue(static_cast<BasicEnum>(2)));
+ EXPECT_FALSE(BasicEnum_IsValidValue(static_cast<BasicEnum>(9)));
+ // In the mojom, we represent this value as hex (0xa).
+ EXPECT_TRUE(BasicEnum_IsValidValue(static_cast<BasicEnum>(10)));
+ EXPECT_FALSE(BasicEnum_IsValidValue(static_cast<BasicEnum>(11)));
+}
+
+// Tests the IsValidValue() method generated for StructWithEnum.
+TEST(EnumValueValidationTest, EnumWithin) {
+ // StructWithEnum::EnumWithin can have [0,4] as possible integral values.
+ EXPECT_FALSE(StructWithEnum::EnumWithin_IsValidValue(
+ static_cast<StructWithEnum::EnumWithin>(-1)));
+ EXPECT_TRUE(StructWithEnum::EnumWithin_IsValidValue(
+ static_cast<StructWithEnum::EnumWithin>(0)));
+ EXPECT_TRUE(StructWithEnum::EnumWithin_IsValidValue(
+ static_cast<StructWithEnum::EnumWithin>(1)));
+ EXPECT_TRUE(StructWithEnum::EnumWithin_IsValidValue(
+ static_cast<StructWithEnum::EnumWithin>(2)));
+ EXPECT_TRUE(StructWithEnum::EnumWithin_IsValidValue(
+ static_cast<StructWithEnum::EnumWithin>(3)));
+ EXPECT_FALSE(StructWithEnum::EnumWithin_IsValidValue(
+ static_cast<StructWithEnum::EnumWithin>(4)));
+}
+
} // namespace
} // namespace test
} // namespace mojo
diff --git a/third_party/mojo/src/mojo/public/cpp/environment/lib/default_task_tracker.cc b/third_party/mojo/src/mojo/public/cpp/environment/lib/default_task_tracker.cc
index 17c814d..a99f1c7 100644
--- a/third_party/mojo/src/mojo/public/cpp/environment/lib/default_task_tracker.cc
+++ b/third_party/mojo/src/mojo/public/cpp/environment/lib/default_task_tracker.cc
@@ -4,6 +4,8 @@
#include "mojo/public/cpp/environment/lib/default_task_tracker.h"
+#include "mojo/public/cpp/environment/task_tracker.h"
+
namespace mojo {
namespace {
diff --git a/third_party/mojo/src/mojo/public/cpp/environment/lib/default_task_tracker.h b/third_party/mojo/src/mojo/public/cpp/environment/lib/default_task_tracker.h
index 83b9ae3..7a0c064 100644
--- a/third_party/mojo/src/mojo/public/cpp/environment/lib/default_task_tracker.h
+++ b/third_party/mojo/src/mojo/public/cpp/environment/lib/default_task_tracker.h
@@ -5,9 +5,10 @@
#ifndef MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_DEFAULT_TASK_TRACKER_H_
#define MOJO_PUBLIC_CPP_ENVIRONMENT_LIB_DEFAULT_TASK_TRACKER_H_
-#include "mojo/public/cpp/environment/task_tracker.h"
-
namespace mojo {
+
+struct TaskTracker;
+
namespace internal {
extern const TaskTracker kDefaultTaskTracker;
diff --git a/third_party/mojo/src/mojo/public/cpp/environment/task_tracker.h b/third_party/mojo/src/mojo/public/cpp/environment/task_tracker.h
index 771dc7f..d6d3020 100644
--- a/third_party/mojo/src/mojo/public/cpp/environment/task_tracker.h
+++ b/third_party/mojo/src/mojo/public/cpp/environment/task_tracker.h
@@ -5,19 +5,15 @@
#ifndef MOJO_PUBLIC_CPP_ENVIRONMENT_TASK_TRACKER_H_
#define MOJO_PUBLIC_CPP_ENVIRONMENT_TASK_TRACKER_H_
-#include <sstream>
-
-#include "mojo/public/cpp/system/macros.h"
+#include <stdint.h>
namespace mojo {
typedef intptr_t TaskTrackingId;
-// Interface for wiring task-level profiling, which is implemented through
-// tracked_objects system in chrome.
-// This API is mainly used from generated interface implementation.
+// Interface for wiring task-level profiling. This API is mainly used by the
+// generated interface implementation.
struct TaskTracker {
- public:
// Start tracking. The returned id must be reclaimed through |EndTracking()|.
TaskTrackingId (*StartTracking)(const char* function_name,
const char* file_name,
diff --git a/third_party/mojo/src/mojo/public/dart/.gitignore b/third_party/mojo/src/mojo/public/dart/.gitignore
index d0a207a..4f0cc2f 100644
--- a/third_party/mojo/src/mojo/public/dart/.gitignore
+++ b/third_party/mojo/src/mojo/public/dart/.gitignore
@@ -1,4 +1,3 @@
-lib/_sdkext
.packages
packages/
pubspec.lock
diff --git a/third_party/mojo/src/mojo/public/dart/BUILD.gn b/third_party/mojo/src/mojo/public/dart/BUILD.gn
index fb14555..a6fa7d0 100644
--- a/third_party/mojo/src/mojo/public/dart/BUILD.gn
+++ b/third_party/mojo/src/mojo/public/dart/BUILD.gn
@@ -1,10 +1,17 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
import("../mojo_sdk.gni")
import("rules.gni")
-dart_mojo_sdk_sources = [
+dart_mojo_sdk_entrypoints = [
"lib/application.dart",
"lib/bindings.dart",
"lib/core.dart",
+]
+
+dart_mojo_sdk_sources = [
"lib/src/application_connection.dart",
"lib/src/application.dart",
"lib/src/buffer.dart",
@@ -19,12 +26,13 @@ dart_mojo_sdk_sources = [
"lib/src/proxy.dart",
"lib/src/struct.dart",
"lib/src/stub.dart",
- "lib/src/union.dart",
"lib/src/types.dart",
+ "lib/src/union.dart",
+ "lib/src/utils.dart",
]
-dartzip_package("dart") {
- sources = dart_mojo_sdk_sources + [
+dartzip_package("dart_dartzip") {
+ sources = dart_mojo_sdk_entrypoints + dart_mojo_sdk_sources + [
"pubspec.yaml",
"CHANGELOG.md",
"README.md",
@@ -38,18 +46,26 @@ dartzip_package("dart") {
]
}
-dart_pkg("mojo") {
+dart_pkg("dart_pkg") {
+ libs = dart_mojo_sdk_entrypoints
sources = dart_mojo_sdk_sources + [
+ "lib/_sdkext",
"pubspec.yaml",
"CHANGELOG.md",
"README.md",
]
sdk_ext_directory = "sdk_ext"
- sdk_ext_mappings = [ "dart:mojo.internal,internal.dart" ]
# List of mojom targets that the mojo pkg exports
deps = [
"../interfaces",
]
}
+
+group("dart") {
+ deps = [
+ ":dart_dartzip",
+ ":dart_pkg",
+ ]
+}
diff --git a/third_party/mojo/src/mojo/public/dart/CHANGELOG.md b/third_party/mojo/src/mojo/public/dart/CHANGELOG.md
index 03b981d..6ea399c 100644
--- a/third_party/mojo/src/mojo/public/dart/CHANGELOG.md
+++ b/third_party/mojo/src/mojo/public/dart/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.0.22
+
+ - 58 changes: https://github.com/domokit/mojo/compare/e172885...35de44e
+
## 0.0.18
- 89 changes: https://github.com/domokit/mojo/compare/0fd4d06...c3119f6
diff --git a/third_party/mojo/src/mojo/public/dart/lib/_sdkext b/third_party/mojo/src/mojo/public/dart/lib/_sdkext
new file mode 100644
index 0000000..ef3bace
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/dart/lib/_sdkext
@@ -0,0 +1,3 @@
+{
+ "dart:mojo.internal": "../sdk_ext/internal.dart"
+}
diff --git a/third_party/mojo/src/mojo/public/dart/lib/application.dart b/third_party/mojo/src/mojo/public/dart/lib/application.dart
index c42337f..abf0f40 100644
--- a/third_party/mojo/src/mojo/public/dart/lib/application.dart
+++ b/third_party/mojo/src/mojo/public/dart/lib/application.dart
@@ -8,9 +8,9 @@ import 'dart:async';
import 'package:mojo/bindings.dart' as bindings;
import 'package:mojo/core.dart' as core;
-import 'package:mojom/mojo/application.mojom.dart' as application_mojom;
-import 'package:mojom/mojo/service_provider.mojom.dart';
-import 'package:mojom/mojo/shell.mojom.dart' as shell_mojom;
+import 'package:mojo/mojo/application.mojom.dart' as application_mojom;
+import 'package:mojo/mojo/service_provider.mojom.dart';
+import 'package:mojo/mojo/shell.mojom.dart' as shell_mojom;
part 'src/application.dart';
part 'src/application_connection.dart';
diff --git a/third_party/mojo/src/mojo/public/dart/lib/bindings.dart b/third_party/mojo/src/mojo/public/dart/lib/bindings.dart
index 9f9fdcd..5512575 100644
--- a/third_party/mojo/src/mojo/public/dart/lib/bindings.dart
+++ b/third_party/mojo/src/mojo/public/dart/lib/bindings.dart
@@ -9,7 +9,7 @@ import 'dart:convert';
import 'dart:typed_data';
import 'package:mojo/core.dart' as core;
-import 'package:mojom/mojo/interface_control_messages.mojom.dart' as icm;
+import 'package:mojo/mojo/interface_control_messages.mojom.dart' as icm;
part 'src/control_message.dart';
part 'src/codec.dart';
diff --git a/third_party/mojo/src/mojo/public/dart/lib/core.dart b/third_party/mojo/src/mojo/public/dart/lib/core.dart
index e72da3f..dfaf88a 100644
--- a/third_party/mojo/src/mojo/public/dart/lib/core.dart
+++ b/third_party/mojo/src/mojo/public/dart/lib/core.dart
@@ -17,3 +17,4 @@ part 'src/event_stream.dart';
part 'src/handle.dart';
part 'src/message_pipe.dart';
part 'src/types.dart';
+part 'src/utils.dart';
diff --git a/third_party/mojo/src/mojo/public/dart/lib/src/control_message.dart b/third_party/mojo/src/mojo/public/dart/lib/src/control_message.dart
index de71a980..e5cd582 100644
--- a/third_party/mojo/src/mojo/public/dart/lib/src/control_message.dart
+++ b/third_party/mojo/src/mojo/public/dart/lib/src/control_message.dart
@@ -44,18 +44,17 @@ class ControlMessageHandler {
MessageHeader.kMessageIsResponse));
}
- static Future<Message> _handleRunOrClose(Stub stub,
- int interface_version,
- ServiceMessage message) {
+ static Future _handleRunOrClose(Stub stub,
+ int interface_version,
+ ServiceMessage message) {
// Deserialize message.
var params = icm.RunOrClosePipeMessageParams.deserialize(message.payload);
// Grab required version.
var requiredVersion = params.requireVersion.version;
- if (interface_version >= requiredVersion) {
- // Stub meets the requirements.
- return;
+ if (interface_version < requiredVersion) {
+ // Stub does not implement required version. Close the pipe immediately.
+ stub.close(immediate: true);
}
- // Stub does not implement required version. Close the pipe immediately.
- stub.close(immediate: true);
+ return null;
}
}
diff --git a/third_party/mojo/src/mojo/public/dart/lib/src/utils.dart b/third_party/mojo/src/mojo/public/dart/lib/src/utils.dart
new file mode 100644
index 0000000..476fcc8
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/dart/lib/src/utils.dart
@@ -0,0 +1,15 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+part of core;
+
+// Returns the time, in microseconds, since some undefined point in the past.
+// The values are only meaningful relative to other values that were obtained
+// from the same device without an intervening system restart. Such values are
+// guaranteed to be monotonically non-decreasing with the passage of real time.
+// Although the units are microseconds, the resolution of the clock may vary
+// and is typically in the range of ~1-15 ms.
+int getTimeTicksNow() {
+ return MojoCoreNatives.getTimeTicksNow();
+}
diff --git a/third_party/mojo/src/mojo/public/dart/pubspec.yaml b/third_party/mojo/src/mojo/public/dart/pubspec.yaml
index bdcad2e..1082701 100644
--- a/third_party/mojo/src/mojo/public/dart/pubspec.yaml
+++ b/third_party/mojo/src/mojo/public/dart/pubspec.yaml
@@ -1,7 +1,5 @@
author: Chromium Authors <mojo-dev@googlegroups.com>
-dependencies:
- mojom: any
description: Dart files to support executing inside Mojo.
homepage: https://github.com/domokit/mojo
name: mojo
-version: 0.0.18
+version: 0.0.22
diff --git a/third_party/mojo/src/mojo/public/dart/rules.gni b/third_party/mojo/src/mojo/public/dart/rules.gni
index d4adbb1..103b989 100644
--- a/third_party/mojo/src/mojo/public/dart/rules.gni
+++ b/third_party/mojo/src/mojo/public/dart/rules.gni
@@ -2,11 +2,413 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-# Rules to generate zipped applications for Dart.
-# Rules to generate dart-pkg and dart-pkg/packages.
+# This file has rules for making Dart packages and Dart-based Mojo applications.
+#
+# Entrypoint rules are:
+# - dart_pkg
+# - dartzip_package
+# - dartzip_packaged_application
+import("../mojo.gni")
import("//build/module_args/mojo.gni")
+import("//build/module_args/dart.gni")
+
+template("dartx") {
+ bundle_prefix = target_name
+ bundle = "$target_gen_dir/${bundle_prefix}.dartx"
+ snapshot = "$target_gen_dir/${bundle_prefix}_snapshot.bin"
+
+ if (mojo_use_prebuilt_dart_snapshotter) {
+ dart_snapshotter_path =
+ rebase_path("mojo/public/tools:copy_dart_snapshotter", ".", mojo_root)
+ dart_snapshotter_rule = "$dart_snapshotter_path($host_toolchain)"
+ } else {
+ dart_snapshotter_rule = dart_snapshotter_bin
+ }
+ dart_snapshotter_dir =
+ get_label_info("$dart_snapshotter_rule", "root_out_dir")
+ dart_snapshotter = "$dart_snapshotter_dir/dart_snapshotter"
+
+ action("gen_${bundle_prefix}_snapshot") {
+ main_dart = invoker.main_dart
+
+ inputs = [
+ dart_snapshotter,
+ main_dart,
+ ]
+ outputs = [
+ snapshot,
+ ]
+
+ if (defined(invoker.sources)) {
+ inputs += invoker.sources
+ }
+
+ script =
+ rebase_path("mojo/public/tools/dart_snapshotter.py", ".", mojo_sdk_root)
+
+ args = [
+ rebase_path(dart_snapshotter),
+ rebase_path(main_dart),
+ "--package-root",
+ rebase_path("$root_gen_dir/dart-pkg/packages"),
+ "--snapshot",
+ rebase_path(snapshot),
+ ]
+
+ deps = [
+ dart_snapshotter_rule,
+ ]
+ if (defined(invoker.deps)) {
+ deps += invoker.deps
+ }
+ }
+
+ action("gen_${bundle_prefix}_bundle") {
+ sources = [
+ rebase_path("mojo/public/tools/dartx.py", ".", mojo_sdk_root),
+ snapshot,
+ ]
+
+ outputs = [
+ bundle,
+ ]
+
+ script = rebase_path("mojo/public/tools/dartx.py", ".", mojo_sdk_root)
+ args = [
+ "--snapshot",
+ rebase_path(snapshot),
+ "--output",
+ rebase_path(bundle),
+ ]
+
+ deps = [
+ ":gen_${bundle_prefix}_snapshot",
+ ]
+ }
+
+ group(target_name) {
+ deps = [
+ ":gen_${bundle_prefix}_bundle",
+ ]
+ }
+}
+template("dartx_application") {
+ dartx_name = "${target_name}_dartx"
+
+ dartx(dartx_name) {
+ main_dart = invoker.main_dart
+ if (defined(invoker.sources)) {
+ sources = invoker.sources
+ }
+ if (defined(invoker.deps)) {
+ deps = invoker.deps
+ }
+ }
+
+ if (defined(invoker.output_name)) {
+ mojo_output = "$root_out_dir/" + invoker.output_name + ".mojo"
+ } else {
+ mojo_output = "$root_out_dir/" + target_name + ".mojo"
+ }
+
+ action(target_name) {
+ script = rebase_path("mojo/public/tools/prepend.py", ".", mojo_sdk_root)
+
+ input = "$target_gen_dir/${dartx_name}.dartx"
+ inputs = [
+ input,
+ ]
+
+ output = mojo_output
+ outputs = [
+ output,
+ ]
+
+ deps = [
+ ":$dartx_name",
+ ]
+ if (defined(invoker.deps)) {
+ deps += invoker.deps
+ }
+
+ line = "#!mojo mojo:dart_content_handler"
+ if (is_debug || (defined(invoker.strict) && invoker.strict == true)) {
+ line = "#!mojo mojo:dart_content_handler?strict=true"
+ }
+
+ rebase_input = rebase_path(input, root_build_dir)
+ rebase_output = rebase_path(output, root_build_dir)
+ args = [
+ "--input=$rebase_input",
+ "--output=$rebase_output",
+ "--line=$line",
+ ]
+ }
+}
+
+template("dart_pkg_helper") {
+ assert(defined(invoker.package_name))
+ package_name = invoker.package_name
+ pkg_directory = rebase_path("$root_gen_dir/dart-pkg")
+ package_root = rebase_path("$root_gen_dir/dart-pkg/packages")
+ stamp_file = "$root_gen_dir/dart-pkg/${package_name}.stamp"
+
+ assert(defined(invoker.sources) || defined(invoker.apps) ||
+ defined(invoker.libs) || defined(invoker.pkg_dir))
+
+ action(target_name) {
+ deps = []
+ if (defined(invoker.deps)) {
+ deps += invoker.deps
+ }
+
+ datadeps = []
+ if (defined(invoker.datadeps)) {
+ datadeps += invoker.datadeps
+ }
+
+ list_mojoms_script =
+ rebase_path("mojo/public/tools/dart_list_mojoms.py", ".", mojo_sdk_root)
+ mojom_sources = []
+ foreach(d, deps) {
+ root_prefix = rebase_path(".", "", mojo_sdk_root)
+ source_directory = rebase_path(get_label_info(d, "dir"))
+ mojom_sources += exec_script(list_mojoms_script,
+ [
+ source_directory,
+ root_prefix,
+ ],
+ "list lines")
+ }
+
+ sdk_ext_directory = []
+ if (defined(invoker.sdk_ext_directory)) {
+ sdk_ext_directory += [ invoker.sdk_ext_directory ]
+ }
+
+ sdk_ext_files = []
+ if (defined(invoker.sdk_ext_files)) {
+ sdk_ext_files += invoker.sdk_ext_files
+ }
+
+ sdk_ext_mappings = []
+ if (defined(invoker.sdk_ext_mappings)) {
+ sdk_ext_mappings += invoker.sdk_ext_mappings
+ }
+
+ script = rebase_path("mojo/public/tools/dart_pkg.py", ".", mojo_sdk_root)
+
+ entrypoints = []
+ if (defined(invoker.apps)) {
+ entrypoints += invoker.apps
+ }
+ if (defined(invoker.libs)) {
+ entrypoints += invoker.libs
+ }
+
+ sources = entrypoints
+ if (defined(invoker.sources)) {
+ sources += invoker.sources
+ } else if (defined(invoker.pkg_dir)) {
+ list_script = rebase_path("build/ls.py", ".", mojo_sdk_root)
+ sources += exec_script(list_script,
+ [
+ "--target-directory",
+ rebase_path(invoker.pkg_dir),
+ ],
+ "list lines")
+ }
+
+ # We have to use foreach to set up outputs instead of rebase_path because
+ # GN doesn't like assignments to outputs that aren't obviously under
+ # $root_gen_dir somewhere.
+ outputs = []
+ foreach(s, sources) {
+ outputs += [ "$root_gen_dir/dart-pkg/${package_name}/$s" ]
+ }
+ outputs += [ stamp_file ]
+
+ inputs = [
+ list_mojoms_script,
+ script,
+ ] + rebase_path(sources)
+
+ args = [
+ "--package-name",
+ package_name,
+ "--dart-sdk",
+ rebase_path(dart_sdk_root),
+ "--gen-directory",
+ rebase_path("$root_gen_dir/dart-gen"),
+ "--pkg-directory",
+ pkg_directory,
+ "--package-root",
+ package_root,
+ "--stamp-file",
+ rebase_path(stamp_file),
+ "--package-sources",
+ ] + rebase_path(sources) + [ "--package-entrypoints" ] +
+ rebase_path(entrypoints) + [ "--mojom-sources" ] +
+ rebase_path(mojom_sources, "", mojo_sdk_root) +
+ [ "--sdk-ext-directories" ] + rebase_path(sdk_ext_directory) +
+ [ "--sdk-ext-files" ] + rebase_path(sdk_ext_files) +
+ [ "--sdk-ext-mappings" ] + sdk_ext_mappings
+ }
+}
+
+# This is the entrypoint for organizing Dart code for Mojo.
+#
+# For each file in |apps|, it makes a .mojo Mojo application using the dartx
+# format as well as an assemblage of the app under $root_gen_dir/part-pkg for
+# use in local development.
+#
+# For each file in |libs|, it invokes the Dart analyzer. All other sources go in
+# |sources|. This should at least contain a 'pubspec.yaml' file. If no |apps|
+# are defined, this rule makes the library package available to applications.
+# The name of the package is taken from the 'pubspec.yaml' file. Even if a
+# package will not be uploaded to pub, an attempt should be made not to conflict
+# with the names of existing pub packages, for example by using the prefix
+# 'mojo_dart_'.
+#
+# sources
+# List of non-app and non-lib sources to include in the package. This
+# should at least contain the pubspec.yaml for the package.
+#
+# apps (optional)
+# List of Mojo application entrypoints containing a main() function.
+# Each of these entrypoints will result in a .mojo Mojo application.
+# See |output_name| for how this application is named.
+#
+# libs (optional)
+# List of package entrypoints to pass to the analyzer. If none are
+# defined, the analyzer is not run.
+#
+# strict (optional)
+# If |apps| are specified, |strict| can be set to true to
+# instruct the content handler to run the apps in Dart VM's strict
+# compilation mode (with assertions and type-checks, etc.).
+#
+# app_name_override (optional)
+# When |apps| are specified, this is the prefix to use for the
+# name of the assembled .mojo file. The target name is used by default.
+# For each entrypoint, the result is |output_name|_|entrypoint|.mojo. If
+# the entrypoint is main.dart, the result is simply |output_name|.mojo.
+#
+# deps (optional)
+# List of other dart_pkg targets for Dart packages imported by this
+# dart_pkg, as well as the mojom targets needed by this dart_pkg.
+#
+# pkg_dir (optional)
+# Directory containing the package sources. This overrides sources and
+# entrypoints. The analyzer will not be run.
+#
+# datadeps (optional)
+#
+# sdk_ext_directory (optional)
+# Directory containing sdk-ext .dart sources.
+#
+# sdk_ext_files (optional)
+# List of sources to include in sdk-ext.
+#
+# sdk_ext_mappings (optional)
+# Mappings for dart libraries that are part of of sdk_ext.
+template("dart_pkg") {
+ if (defined(invoker.pkg_dir)) {
+ pubspec_yaml_path = rebase_path("pubspec.yaml", "", invoker.pkg_dir)
+ } else {
+ pubspec_yaml_path = rebase_path("pubspec.yaml")
+ }
+ dart_package_name_script =
+ rebase_path("mojo/public/tools/dart_package_name.py", ".", mojo_sdk_root)
+ dart_package_name = exec_script(dart_package_name_script,
+ [
+ "--pubspec",
+ pubspec_yaml_path,
+ ],
+ "trim string",
+ [ pubspec_yaml_path ])
+
+ dart_pkg_target_name = "${target_name}_pkg_helper"
+ dart_pkg_helper(dart_pkg_target_name) {
+ package_name = dart_package_name
+ if (defined(invoker.sources)) {
+ sources = invoker.sources
+ }
+ if (defined(invoker.apps)) {
+ apps = invoker.apps
+ }
+ if (defined(invoker.libs)) {
+ libs = invoker.libs
+ }
+ if (defined(invoker.pkg_dir)) {
+ pkg_dir = invoker.pkg_dir
+ }
+ if (defined(invoker.deps)) {
+ deps = invoker.deps
+ }
+ if (defined(invoker.datadeps)) {
+ datadeps = invoker.datadeps
+ }
+ if (defined(invoker.sdk_ext_directory)) {
+ sdk_ext_directory = invoker.sdk_ext_directory
+ }
+ if (defined(invoker.sdk_ext_files)) {
+ sdk_ext_files = invoker.sdk_ext_files
+ }
+ if (defined(invoker.sdk_ext_mappings)) {
+ sdk_ext_mappings = invoker.sdk_ext_mappings
+ }
+ }
+
+ if (defined(invoker.apps)) {
+ pkg_name = target_name
+ if (defined(invoker.app_name_override)) {
+ pkg_name = invoker.app_name_override
+ }
+ pkg_helper_output_dir = "$root_gen_dir/dart-pkg/${dart_package_name}"
+ foreach(entrypoint, invoker.apps) {
+ entrypoint_name = get_path_info(entrypoint, "name")
+ dartx_target_name = "${pkg_name}_${entrypoint_name}"
+ dartx_output_name = dartx_target_name
+ if (entrypoint_name == "main") {
+ dartx_output_name = pkg_name
+ }
+ dartx_application(dartx_target_name) {
+ output_name = dartx_output_name
+ main_dart = rebase_path(entrypoint, "", pkg_helper_output_dir)
+ sources = rebase_path(invoker.sources, "", pkg_helper_output_dir)
+ deps = [
+ ":$dart_pkg_target_name",
+ ]
+ deps += invoker.deps
+ if (defined(invoker.strict)) {
+ strict = invoker.strict
+ }
+ }
+ }
+ }
+
+ group(target_name) {
+ deps = [
+ ":$dart_pkg_target_name",
+ ]
+ if (defined(invoker.apps)) {
+ pkg_name = target_name
+ if (defined(invoker.app_name_override)) {
+ pkg_name = invoker.app_name_override
+ }
+ foreach(entrypoint, invoker.apps) {
+ entrypoint_name = get_path_info(entrypoint, "name")
+ dartx_target_name = "${pkg_name}_${entrypoint_name}"
+ deps += [ ":$dartx_target_name" ]
+ }
+ }
+ }
+}
+
+# Creates a dartzip package.
template("dartzip_package") {
package_target_name = "$target_name"
package_output = "$target_out_dir/$target_name.dartzip"
@@ -113,16 +515,20 @@ template("dartzip_package") {
]
args = [
+ "--dart-sdk",
+ rebase_path(dart_sdk_root),
+ "--dartzip-file",
rebase_path(package_output),
+ "--stamp-file",
rebase_path("$target_gen_dir/${package_target_name}_analyze.stamp"),
"--no-hints",
]
- deps = [
+ public_deps = [
":${package_target_name}_package",
]
if (defined(invoker.deps)) {
- deps += invoker.deps
+ deps = invoker.deps
}
if (defined(invoker.datadeps)) {
@@ -206,133 +612,3 @@ template("dartzip_packaged_application") {
]
}
}
-
-# Creates a gen/dart-pkg/package_name directory containing symlinks to package
-# sources. Also copies any mojom dependencies into lib/mojom.
-#
-# sources
-# List of sources to include in the package.
-#
-# pkg_dir (optional)
-# Directory containing the package sources. This overrides sources.
-#
-# deps (optional)
-# Note: this can only contain mojom targets.
-#
-# datadeps (optional)
-#
-# sdk_ext_directory (optional)
-# Directory containing sdk-ext .dart sources.
-#
-# sdk_ext_files (optional)
-# List of sources to include in sdk-ext.
-#
-# sdk_ext_mappings (optional)
-# Mappings for dart libraries that are part of of sdk_ext.
-#
-template("dart_pkg") {
- if (defined(invoker.pkg_dir)) {
- pubspec_yaml_path = rebase_path("pubspec.yaml", "", invoker.pkg_dir)
- } else {
- pubspec_yaml_path = rebase_path("pubspec.yaml")
- }
- dart_package_name_script =
- rebase_path("mojo/public/tools/dart_package_name.py", ".", mojo_sdk_root)
- package_name = exec_script(dart_package_name_script,
- [
- "--pubspec",
- pubspec_yaml_path,
- ],
- "trim string",
- [ pubspec_yaml_path ])
-
- pkg_directory = rebase_path("$root_gen_dir/dart-pkg")
- package_root = rebase_path("$root_gen_dir/dart-pkg/packages")
- stamp_file = "$root_gen_dir/dart-pkg/${package_name}.stamp"
- output_dir = "$root_gen_dir/dart-pkg/${package_name}"
-
- assert(defined(invoker.sources) || defined(invoker.pkg_dir))
-
- action(target_name) {
- deps = []
- if (defined(invoker.deps)) {
- deps += invoker.deps
- }
-
- datadeps = []
- if (defined(invoker.datadeps)) {
- datadeps += invoker.datadeps
- }
-
- list_mojoms_script =
- rebase_path("mojo/public/tools/dart_list_mojoms.py", ".", mojo_sdk_root)
- mojom_sources = []
- foreach(d, deps) {
- root_prefix = rebase_path(".", "", mojo_sdk_root)
- source_directory = rebase_path(get_label_info(d, "dir"))
- mojom_sources += exec_script(list_mojoms_script,
- [
- source_directory,
- root_prefix,
- ],
- "list lines")
- }
-
- sdk_ext_directory = []
- if (defined(invoker.sdk_ext_directory)) {
- sdk_ext_directory += [ invoker.sdk_ext_directory ]
- }
-
- sdk_ext_files = []
- if (defined(invoker.sdk_ext_files)) {
- sdk_ext_files += invoker.sdk_ext_files
- }
-
- sdk_ext_mappings = []
- if (defined(invoker.sdk_ext_mappings)) {
- sdk_ext_mappings += invoker.sdk_ext_mappings
- }
-
- script = rebase_path("mojo/public/tools/dart_pkg.py", ".", mojo_sdk_root)
- outputs = [
- output_dir,
- stamp_file,
- ]
-
- if (defined(invoker.sources)) {
- sources = invoker.sources
- } else {
- assert(defined(invoker.pkg_dir))
- list_script = rebase_path("build/ls.py", ".", mojo_sdk_root)
- sources = exec_script(list_script,
- [
- "--target-directory",
- rebase_path(invoker.pkg_dir),
- ],
- "list lines")
- }
-
- inputs = [
- list_mojoms_script,
- script,
- ] + rebase_path(sources)
-
- args = [
- "--package-name",
- package_name,
- "--gen-directory",
- rebase_path("$root_gen_dir/dart-gen"),
- "--pkg-directory",
- pkg_directory,
- "--package-root",
- package_root,
- "--stamp-file",
- rebase_path(stamp_file),
- "--package-sources",
- ] + rebase_path(sources) + [ "--mojom-sources" ] +
- rebase_path(mojom_sources, "", mojo_sdk_root) +
- [ "--sdk-ext-directories" ] + rebase_path(sdk_ext_directory) +
- [ "--sdk-ext-files" ] + rebase_path(sdk_ext_files) +
- [ "--sdk-ext-mappings" ] + sdk_ext_mappings
- }
-}
diff --git a/third_party/mojo/src/mojo/public/dart/sdk_ext/src/natives.dart b/third_party/mojo/src/mojo/public/dart/sdk_ext/src/natives.dart
index a46ddd6..350b0a6 100644
--- a/third_party/mojo/src/mojo/public/dart/sdk_ext/src/natives.dart
+++ b/third_party/mojo/src/mojo/public/dart/sdk_ext/src/natives.dart
@@ -4,6 +4,10 @@
part of internal;
+class MojoCoreNatives {
+ static int getTimeTicksNow() native "Mojo_GetTimeTicksNow";
+}
+
class MojoHandleNatives {
static int register(
Object eventStream, int handle) native "MojoHandle_Register";
diff --git a/third_party/mojo/src/mojo/public/interfaces/bindings/interface_control_messages.mojom b/third_party/mojo/src/mojo/public/interfaces/bindings/interface_control_messages.mojom
index a304efc..10bd269 100644
--- a/third_party/mojo/src/mojo/public/interfaces/bindings/interface_control_messages.mojom
+++ b/third_party/mojo/src/mojo/public/interfaces/bindings/interface_control_messages.mojom
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-[JavaPackage="org.chromium.mojo.bindings"]
+[DartPackage="mojo", JavaPackage="org.chromium.mojo.bindings"]
module mojo;
// For each message pipe representing a user-defined interface, some control
diff --git a/third_party/mojo/src/mojo/public/interfaces/bindings/tests/BUILD.gn b/third_party/mojo/src/mojo/public/interfaces/bindings/tests/BUILD.gn
index e7efd3d..b0a303f 100644
--- a/third_party/mojo/src/mojo/public/interfaces/bindings/tests/BUILD.gn
+++ b/third_party/mojo/src/mojo/public/interfaces/bindings/tests/BUILD.gn
@@ -17,6 +17,7 @@ mojom("test_interfaces") {
"sample_import2.mojom",
"sample_interfaces.mojom",
"sample_service.mojom",
+ "scoping.mojom",
"serialization_test_structs.mojom",
"test_constants.mojom",
"test_structs.mojom",
diff --git a/third_party/mojo/src/mojo/public/interfaces/bindings/tests/scoping.mojom b/third_party/mojo/src/mojo/public/interfaces/bindings/tests/scoping.mojom
new file mode 100644
index 0000000..2e9edb1
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/interfaces/bindings/tests/scoping.mojom
@@ -0,0 +1,17 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+module mojo.test;
+
+interface A {
+ GetB(B& b);
+};
+
+interface B {
+ GetC(C& c);
+};
+
+interface C {
+ D();
+};
diff --git a/third_party/mojo/src/mojo/public/interfaces/bindings/tests/validation_test_interfaces.mojom b/third_party/mojo/src/mojo/public/interfaces/bindings/tests/validation_test_interfaces.mojom
index 258c166..dd2eb4c 100644
--- a/third_party/mojo/src/mojo/public/interfaces/bindings/tests/validation_test_interfaces.mojom
+++ b/third_party/mojo/src/mojo/public/interfaces/bindings/tests/validation_test_interfaces.mojom
@@ -77,3 +77,21 @@ struct BasicStruct {
interface IntegrationTestInterface {
Method0(BasicStruct param0) => (array<uint8> param0);
};
+
+// An enum generates a enum-value validation function, so we want to test it.
+// E.g., valid enum values for this enum should be: -3, 0, 1, 10
+enum BasicEnum {
+ A,
+ B,
+ C = A,
+ D = -3,
+ E = 0xA
+};
+
+// The enum validation function should be generated within the scope of this
+// struct.
+struct StructWithEnum {
+ enum EnumWithin {
+ A, B, C, D
+ };
+};
diff --git a/third_party/mojo/src/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Encoder.java b/third_party/mojo/src/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Encoder.java
index c4e5d78..3541f21 100644
--- a/third_party/mojo/src/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Encoder.java
+++ b/third_party/mojo/src/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Encoder.java
@@ -166,7 +166,7 @@ public class Encoder {
public void encode(boolean v, int offset, int bit) {
if (v) {
byte encodedValue = mEncoderState.byteBuffer.get(mBaseOffset + offset);
- encodedValue |= 1 << bit;
+ encodedValue |= (byte) (1 << bit);
mEncoderState.byteBuffer.put(mBaseOffset + offset, encodedValue);
}
}
@@ -334,7 +334,7 @@ public class Encoder {
for (int j = 0; j < BindingsHelper.ALIGNMENT; ++j) {
int booleanIndex = BindingsHelper.ALIGNMENT * i + j;
if (booleanIndex < v.length && v[booleanIndex]) {
- bytes[i] |= (1 << j);
+ bytes[i] |= (byte) (1 << j);
}
}
}
diff --git a/third_party/mojo/src/mojo/public/mojo.gni b/third_party/mojo/src/mojo/public/mojo.gni
index 2e25814..bb06cdb 100644
--- a/third_party/mojo/src/mojo/public/mojo.gni
+++ b/third_party/mojo/src/mojo/public/mojo.gni
@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//build/module_args/dart.gni")
import("//build/module_args/mojo.gni")
# If using the prebuilt shell, gate its usage by the platforms for which it is
@@ -12,6 +13,16 @@ if (!defined(mojo_build_mojo_shell_from_source) ||
mojo_use_prebuilt_mojo_shell = is_linux || is_android
}
+# If using the prebuilt dart_snapshotter, gate its usage by the platforms for
+# which it is published.
+mojo_use_prebuilt_dart_snapshotter = false
+if (!defined(mojo_build_dart_snapshotter_from_source) ||
+ !mojo_build_dart_snapshotter_from_source) {
+ mojo_use_prebuilt_dart_snapshotter = true
+} else {
+ assert(defined(dart_snapshotter_bin))
+}
+
# If using the prebuilt network service, gate its usage by the platforms for
# which it is published.
mojo_use_prebuilt_network_service = false
diff --git a/third_party/mojo/src/mojo/public/mojo_application.gni b/third_party/mojo/src/mojo/public/mojo_application.gni
index 32bdb7a..3b8aec8d 100644
--- a/third_party/mojo/src/mojo/public/mojo_application.gni
+++ b/third_party/mojo/src/mojo/public/mojo_application.gni
@@ -430,8 +430,13 @@ if (is_android) {
"--output=${rebase_output}",
]
+ deps = [
+ ":${android_standalone_library_name}",
+ ":${shared_library_name}",
+ ]
+
if (defined(invoker.deps)) {
- deps = invoker.deps
+ deps += invoker.deps
}
if (defined(invoker.public_deps)) {
public_deps = invoker.public_deps
diff --git a/third_party/mojo/src/mojo/public/platform/native/BUILD.gn b/third_party/mojo/src/mojo/public/platform/native/BUILD.gn
index df464f8..f8804f1 100644
--- a/third_party/mojo/src/mojo/public/platform/native/BUILD.gn
+++ b/third_party/mojo/src/mojo/public/platform/native/BUILD.gn
@@ -62,6 +62,8 @@ mojo_sdk_source_set("system_impl_private_tests") {
mojo_sdk_source_set("gles2") {
sources = [
+ "gles2_impl_chromium_bind_uniform_location_thunks.cc",
+ "gles2_impl_chromium_bind_uniform_location_thunks.h",
"gles2_impl_chromium_copy_texture_thunks.cc",
"gles2_impl_chromium_copy_texture_thunks.h",
"gles2_impl_chromium_image_thunks.cc",
@@ -70,14 +72,20 @@ mojo_sdk_source_set("gles2") {
"gles2_impl_chromium_miscellaneous_thunks.h",
"gles2_impl_chromium_pixel_transfer_buffer_object_thunks.cc",
"gles2_impl_chromium_pixel_transfer_buffer_object_thunks.h",
+ "gles2_impl_chromium_resize_thunks.cc",
+ "gles2_impl_chromium_resize_thunks.h",
"gles2_impl_chromium_sub_image_thunks.cc",
"gles2_impl_chromium_sub_image_thunks.h",
"gles2_impl_chromium_sync_point_thunks.cc",
"gles2_impl_chromium_sync_point_thunks.h",
"gles2_impl_chromium_texture_mailbox_thunks.cc",
"gles2_impl_chromium_texture_mailbox_thunks.h",
+ "gles2_impl_ext_debug_marker_thunks.cc",
+ "gles2_impl_ext_debug_marker_thunks.h",
"gles2_impl_occlusion_query_ext_thunks.cc",
"gles2_impl_occlusion_query_ext_thunks.h",
+ "gles2_impl_oes_vertex_array_object_thunks.cc",
+ "gles2_impl_oes_vertex_array_object_thunks.h",
"gles2_impl_thunks.cc",
"gles2_impl_thunks.h",
"gles2_thunks.cc",
@@ -99,3 +107,25 @@ mojo_sdk_source_set("gles2") {
# 'DYLIB_INSTALL_NAME_BASE': '@loader_path',
}
}
+
+mojo_sdk_source_set("gpu_thunks") {
+ sources = []
+}
+
+mojo_sdk_source_set("mgl_thunks") {
+ sources = [
+ "mgl_thunks.c",
+ "mgl_thunks.h",
+ ]
+
+ mojo_sdk_deps = [ "mojo/public/c/gpu:MGL" ]
+}
+
+mojo_sdk_source_set("mgl_onscreen_thunks") {
+ sources = [
+ "mgl_onscreen_thunks.c",
+ "mgl_onscreen_thunks.h",
+ ]
+
+ mojo_sdk_deps = [ "mojo/public/c/gpu:MGL_onscreen" ]
+}
diff --git a/third_party/mojo/src/mojo/public/platform/native/gles2_impl_chromium_bind_uniform_location_thunks.cc b/third_party/mojo/src/mojo/public/platform/native/gles2_impl_chromium_bind_uniform_location_thunks.cc
new file mode 100644
index 0000000..83147d5
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/platform/native/gles2_impl_chromium_bind_uniform_location_thunks.cc
@@ -0,0 +1,34 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/public/platform/native/gles2_impl_chromium_bind_uniform_location_thunks.h"
+
+#include <assert.h>
+
+#include "mojo/public/platform/native/thunk_export.h"
+
+extern "C" {
+static MojoGLES2ImplChromiumBindUniformLocationThunks
+ g_impl_chromium_bind_uniform_location_thunks = {0};
+
+#define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \
+ ReturnType GL_APIENTRY gl##Function PARAMETERS { \
+ assert(g_impl_chromium_bind_uniform_location_thunks.Function); \
+ return g_impl_chromium_bind_uniform_location_thunks.Function ARGUMENTS; \
+ }
+#include "mojo/public/c/gles2/gles2_call_visitor_chromium_bind_uniform_location_autogen.h"
+#undef VISIT_GL_CALL
+
+extern "C" THUNK_EXPORT size_t
+MojoSetGLES2ImplChromiumBindUniformLocationThunks(
+ const MojoGLES2ImplChromiumBindUniformLocationThunks*
+ gles2_impl_chromium_bind_uniform_location_thunks) {
+ if (gles2_impl_chromium_bind_uniform_location_thunks->size >=
+ sizeof(g_impl_chromium_bind_uniform_location_thunks))
+ g_impl_chromium_bind_uniform_location_thunks =
+ *gles2_impl_chromium_bind_uniform_location_thunks;
+ return sizeof(g_impl_chromium_bind_uniform_location_thunks);
+}
+
+} // extern "C"
diff --git a/third_party/mojo/src/mojo/public/platform/native/gles2_impl_chromium_bind_uniform_location_thunks.h b/third_party/mojo/src/mojo/public/platform/native/gles2_impl_chromium_bind_uniform_location_thunks.h
new file mode 100644
index 0000000..6bb5296
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/platform/native/gles2_impl_chromium_bind_uniform_location_thunks.h
@@ -0,0 +1,47 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_IMPL_CHROMIUM_BIND_UNIFORM_LOCATION_THUNKS_H_
+#define MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_IMPL_CHROMIUM_BIND_UNIFORM_LOCATION_THUNKS_H_
+
+#include <stddef.h>
+
+#include "mojo/public/c/gles2/chromium_bind_uniform_location.h"
+
+// Specifies the frozen API for the GLES2 CHROMIUM_bind_uniform_location
+// extension.
+#pragma pack(push, 8)
+struct MojoGLES2ImplChromiumBindUniformLocationThunks {
+ size_t size; // Should be set to sizeof(*this).
+
+#define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \
+ ReturnType(GL_APIENTRY* Function) PARAMETERS;
+#include "mojo/public/c/gles2/gles2_call_visitor_chromium_bind_uniform_location_autogen.h"
+#undef VISIT_GL_CALL
+};
+#pragma pack(pop)
+
+// Intended to be called from the embedder to get the embedder's implementation
+// of GLES2.
+inline MojoGLES2ImplChromiumBindUniformLocationThunks
+MojoMakeGLES2ImplChromiumBindUniformLocationThunks() {
+ MojoGLES2ImplChromiumBindUniformLocationThunks
+ gles2_impl_chromium_bind_uniform_location_thunks = {
+ sizeof(MojoGLES2ImplChromiumBindUniformLocationThunks),
+#define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) gl##Function,
+#include "mojo/public/c/gles2/gles2_call_visitor_chromium_bind_uniform_location_autogen.h"
+#undef VISIT_GL_CALL
+ };
+
+ return gles2_impl_chromium_bind_uniform_location_thunks;
+}
+
+// Use this type for the function found by dynamically discovering it in
+// a DSO linked with mojo_system.
+// The contents of |gles2_impl_chromium_bind_uniform_location_thunks| are
+// copied.
+typedef size_t (*MojoSetGLES2ImplChromiumBindUniformLocationThunksFn)(
+ const MojoGLES2ImplChromiumBindUniformLocationThunks* thunks);
+
+#endif // MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_IMPL_CHROMIUM_BIND_UNIFORM_LOCATION_THUNKS_H_
diff --git a/third_party/mojo/src/mojo/public/platform/native/gles2_impl_chromium_resize_thunks.cc b/third_party/mojo/src/mojo/public/platform/native/gles2_impl_chromium_resize_thunks.cc
new file mode 100644
index 0000000..0d17df0
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/platform/native/gles2_impl_chromium_resize_thunks.cc
@@ -0,0 +1,31 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/public/platform/native/gles2_impl_chromium_resize_thunks.h"
+
+#include <assert.h>
+
+#include "mojo/public/platform/native/thunk_export.h"
+
+extern "C" {
+static MojoGLES2ImplChromiumResizeThunks g_impl_chromium_resize_thunks = {0};
+
+#define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \
+ ReturnType GL_APIENTRY gl##Function PARAMETERS { \
+ assert(g_impl_chromium_resize_thunks.Function); \
+ return g_impl_chromium_resize_thunks.Function ARGUMENTS; \
+ }
+#include "mojo/public/c/gles2/gles2_call_visitor_chromium_resize_autogen.h"
+#undef VISIT_GL_CALL
+
+extern "C" THUNK_EXPORT size_t
+MojoSetGLES2ImplChromiumResizeThunks(const MojoGLES2ImplChromiumResizeThunks*
+ gles2_impl_chromium_resize_thunks) {
+ if (gles2_impl_chromium_resize_thunks->size >=
+ sizeof(g_impl_chromium_resize_thunks))
+ g_impl_chromium_resize_thunks = *gles2_impl_chromium_resize_thunks;
+ return sizeof(g_impl_chromium_resize_thunks);
+}
+
+} // extern "C"
diff --git a/third_party/mojo/src/mojo/public/platform/native/gles2_impl_chromium_resize_thunks.h b/third_party/mojo/src/mojo/public/platform/native/gles2_impl_chromium_resize_thunks.h
new file mode 100644
index 0000000..55d87e9
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/platform/native/gles2_impl_chromium_resize_thunks.h
@@ -0,0 +1,44 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_IMPL_CHROMIUM_RESIZE_THUNKS_H_
+#define MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_IMPL_CHROMIUM_RESIZE_THUNKS_H_
+
+#include <stddef.h>
+
+#include "mojo/public/c/gles2/chromium_resize.h"
+
+// Specifies the frozen API for the GLES2 CHROMIUM_resize extension.
+#pragma pack(push, 8)
+struct MojoGLES2ImplChromiumResizeThunks {
+ size_t size; // Should be set to sizeof(*this).
+
+#define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \
+ ReturnType(GL_APIENTRY *Function) PARAMETERS;
+#include "mojo/public/c/gles2/gles2_call_visitor_chromium_resize_autogen.h"
+#undef VISIT_GL_CALL
+};
+#pragma pack(pop)
+
+// Intended to be called from the embedder to get the embedder's implementation
+// of GLES2.
+inline MojoGLES2ImplChromiumResizeThunks
+MojoMakeGLES2ImplChromiumResizeThunks() {
+ MojoGLES2ImplChromiumResizeThunks gles2_impl_chromium_resize_thunks = {
+ sizeof(MojoGLES2ImplChromiumResizeThunks),
+#define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) gl##Function,
+#include "mojo/public/c/gles2/gles2_call_visitor_chromium_resize_autogen.h"
+#undef VISIT_GL_CALL
+ };
+
+ return gles2_impl_chromium_resize_thunks;
+}
+
+// Use this type for the function found by dynamically discovering it in
+// a DSO linked with mojo_system.
+// The contents of |gles2_impl_chromium_resize_thunks| are copied.
+typedef size_t (*MojoSetGLES2ImplChromiumResizeThunksFn)(
+ const MojoGLES2ImplChromiumResizeThunks* thunks);
+
+#endif // MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_IMPL_CHROMIUM_RESIZE_THUNKS_H_
diff --git a/third_party/mojo/src/mojo/public/platform/native/gles2_impl_ext_debug_marker_thunks.cc b/third_party/mojo/src/mojo/public/platform/native/gles2_impl_ext_debug_marker_thunks.cc
new file mode 100644
index 0000000..525eae1
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/platform/native/gles2_impl_ext_debug_marker_thunks.cc
@@ -0,0 +1,33 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/public/platform/native/gles2_impl_ext_debug_marker_thunks.h"
+
+#include <assert.h>
+
+#include "mojo/public/platform/native/thunk_export.h"
+
+extern "C" {
+
+static MojoGLES2ImplExtDebugMarkerThunks g_impl_ext_debug_marker_thunks = {0};
+
+#define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \
+ ReturnType GL_APIENTRY gl##Function PARAMETERS { \
+ assert(g_impl_ext_debug_marker_thunks.Function); \
+ return g_impl_ext_debug_marker_thunks.Function ARGUMENTS; \
+ }
+#include "mojo/public/c/gles2/gles2_call_visitor_ext_debug_marker_autogen.h"
+#undef VISIT_GL_CALL
+
+extern "C" THUNK_EXPORT size_t
+MojoSetGLES2ImplExtDebugMarkerThunks(const MojoGLES2ImplExtDebugMarkerThunks*
+ gles2_impl_ext_debug_marker_thunks) {
+ if (gles2_impl_ext_debug_marker_thunks->size >=
+ sizeof(g_impl_ext_debug_marker_thunks)) {
+ g_impl_ext_debug_marker_thunks = *gles2_impl_ext_debug_marker_thunks;
+ }
+ return sizeof(g_impl_ext_debug_marker_thunks);
+}
+
+} // extern "C"
diff --git a/third_party/mojo/src/mojo/public/platform/native/gles2_impl_ext_debug_marker_thunks.h b/third_party/mojo/src/mojo/public/platform/native/gles2_impl_ext_debug_marker_thunks.h
new file mode 100644
index 0000000..503a606
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/platform/native/gles2_impl_ext_debug_marker_thunks.h
@@ -0,0 +1,44 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_IMPL_EXT_DEBUG_MARKER_THUNKS_H_
+#define MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_IMPL_EXT_DEBUG_MARKER_THUNKS_H_
+
+#include <stddef.h>
+
+#include "mojo/public/c/gles2/ext_debug_marker.h"
+
+// Specifies the frozen API for the Vertex Array Object Extension.
+#pragma pack(push, 8)
+struct MojoGLES2ImplExtDebugMarkerThunks {
+ size_t size; // Should be set to sizeof(*this).
+
+#define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \
+ ReturnType(GL_APIENTRY *Function) PARAMETERS;
+#include "mojo/public/c/gles2/gles2_call_visitor_ext_debug_marker_autogen.h"
+#undef VISIT_GL_CALL
+};
+#pragma pack(pop)
+
+// Intended to be called from the embedder to get the embedder's implementation
+// of GLES2.
+inline MojoGLES2ImplExtDebugMarkerThunks
+MojoMakeGLES2ImplExtDebugMarkerThunks() {
+ MojoGLES2ImplExtDebugMarkerThunks gles2_impl_ext_debug_marker_thunks = {
+ sizeof(MojoGLES2ImplExtDebugMarkerThunks),
+#define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) gl##Function,
+#include "mojo/public/c/gles2/gles2_call_visitor_ext_debug_marker_autogen.h"
+#undef VISIT_GL_CALL
+ };
+
+ return gles2_impl_ext_debug_marker_thunks;
+}
+
+// Use this type for the function found by dynamically discovering it in
+// a DSO linked with mojo_system.
+// The contents of |gles2_impl_ext_debug_marker_thunks| are copied.
+typedef size_t (*MojoSetGLES2ImplExtDebugMarkerThunksFn)(
+ const MojoGLES2ImplExtDebugMarkerThunks* thunks);
+
+#endif // MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_IMPL_EXT_DEBUG_MARKER_THUNKS_H_
diff --git a/third_party/mojo/src/mojo/public/platform/native/gles2_impl_oes_vertex_array_object_thunks.cc b/third_party/mojo/src/mojo/public/platform/native/gles2_impl_oes_vertex_array_object_thunks.cc
new file mode 100644
index 0000000..cde3178
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/platform/native/gles2_impl_oes_vertex_array_object_thunks.cc
@@ -0,0 +1,35 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/public/platform/native/gles2_impl_oes_vertex_array_object_thunks.h"
+
+#include <assert.h>
+
+#include "mojo/public/platform/native/thunk_export.h"
+
+extern "C" {
+
+static MojoGLES2ImplOesVertexArrayObjectThunks
+ g_impl_oes_vertex_array_object_thunks = {0};
+
+#define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \
+ ReturnType GL_APIENTRY gl##Function PARAMETERS { \
+ assert(g_impl_oes_vertex_array_object_thunks.Function); \
+ return g_impl_oes_vertex_array_object_thunks.Function ARGUMENTS; \
+ }
+#include "mojo/public/c/gles2/gles2_call_visitor_oes_vertex_array_object_autogen.h"
+#undef VISIT_GL_CALL
+
+extern "C" THUNK_EXPORT size_t MojoSetGLES2ImplOesVertexArrayObjectThunks(
+ const MojoGLES2ImplOesVertexArrayObjectThunks*
+ gles2_impl_oes_vertex_array_object_thunks) {
+ if (gles2_impl_oes_vertex_array_object_thunks->size >=
+ sizeof(g_impl_oes_vertex_array_object_thunks)) {
+ g_impl_oes_vertex_array_object_thunks =
+ *gles2_impl_oes_vertex_array_object_thunks;
+ }
+ return sizeof(g_impl_oes_vertex_array_object_thunks);
+}
+
+} // extern "C"
diff --git a/third_party/mojo/src/mojo/public/platform/native/gles2_impl_oes_vertex_array_object_thunks.h b/third_party/mojo/src/mojo/public/platform/native/gles2_impl_oes_vertex_array_object_thunks.h
new file mode 100644
index 0000000..2a68178
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/platform/native/gles2_impl_oes_vertex_array_object_thunks.h
@@ -0,0 +1,45 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_IMPL_OES_VERTEX_ARRAY_OBJECT_THUNKS_H_
+#define MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_IMPL_OES_VERTEX_ARRAY_OBJECT_THUNKS_H_
+
+#include <stddef.h>
+
+#include "mojo/public/c/gles2/oes_vertex_array_object.h"
+
+// Specifies the frozen API for the Vertex Array Object Extension.
+#pragma pack(push, 8)
+struct MojoGLES2ImplOesVertexArrayObjectThunks {
+ size_t size; // Should be set to sizeof(*this).
+
+#define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \
+ ReturnType(GL_APIENTRY *Function) PARAMETERS;
+#include "mojo/public/c/gles2/gles2_call_visitor_oes_vertex_array_object_autogen.h"
+#undef VISIT_GL_CALL
+};
+#pragma pack(pop)
+
+// Intended to be called from the embedder to get the embedder's implementation
+// of GLES2.
+inline MojoGLES2ImplOesVertexArrayObjectThunks
+MojoMakeGLES2ImplOesVertexArrayObjectThunks() {
+ MojoGLES2ImplOesVertexArrayObjectThunks
+ gles2_impl_oes_vertex_array_object_thunks = {
+ sizeof(MojoGLES2ImplOesVertexArrayObjectThunks),
+#define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) gl##Function,
+#include "mojo/public/c/gles2/gles2_call_visitor_oes_vertex_array_object_autogen.h"
+#undef VISIT_GL_CALL
+ };
+
+ return gles2_impl_oes_vertex_array_object_thunks;
+}
+
+// Use this type for the function found by dynamically discovering it in
+// a DSO linked with mojo_system.
+// The contents of |gles2_impl_oes_vertex_array_object_thunks| are copied.
+typedef size_t (*MojoSetGLES2ImplOesVertexArrayObjectThunksFn)(
+ const MojoGLES2ImplOesVertexArrayObjectThunks* thunks);
+
+#endif // MOJO_PUBLIC_PLATFORM_NATIVE_GLES2_IMPL_OES_VERTEX_ARRAY_OBJECT_THUNKS_H_
diff --git a/third_party/mojo/src/mojo/public/platform/native/gles2_thunks.cc b/third_party/mojo/src/mojo/public/platform/native/gles2_thunks.cc
index 526d66a..82ca43a 100644
--- a/third_party/mojo/src/mojo/public/platform/native/gles2_thunks.cc
+++ b/third_party/mojo/src/mojo/public/platform/native/gles2_thunks.cc
@@ -41,11 +41,6 @@ void* MojoGLES2GetGLES2Interface(MojoGLES2Context context) {
return g_control_thunks.GLES2GetGLES2Interface(context);
}
-void* MojoGLES2GetContextSupport(MojoGLES2Context context) {
- assert(g_control_thunks.GLES2GetContextSupport);
- return g_control_thunks.GLES2GetContextSupport(context);
-}
-
void MojoGLES2SignalSyncPoint(MojoGLES2Context context,
uint32_t sync_point,
MojoGLES2SignalSyncPointCallback callback,
diff --git a/third_party/mojo/src/mojo/public/platform/native/gles2_thunks.h b/third_party/mojo/src/mojo/public/platform/native/gles2_thunks.h
index 1604d5e..eca03da 100644
--- a/third_party/mojo/src/mojo/public/platform/native/gles2_thunks.h
+++ b/third_party/mojo/src/mojo/public/platform/native/gles2_thunks.h
@@ -26,10 +26,9 @@ struct MojoGLES2ControlThunks {
void (*GLES2MakeCurrent)(MojoGLES2Context context);
void (*GLES2SwapBuffers)();
- // TODO(piman): We shouldn't have to leak these 2 interfaces, especially in a
+ // TODO(piman): We shouldn't have to leak this interface, especially in a
// type-unsafe way.
void* (*GLES2GetGLES2Interface)(MojoGLES2Context context);
- void* (*GLES2GetContextSupport)(MojoGLES2Context context);
void (*GLES2SignalSyncPoint)(MojoGLES2Context context,
uint32_t sync_point,
@@ -48,7 +47,6 @@ inline MojoGLES2ControlThunks MojoMakeGLES2ControlThunks() {
MojoGLES2MakeCurrent,
MojoGLES2SwapBuffers,
MojoGLES2GetGLES2Interface,
- MojoGLES2GetContextSupport,
MojoGLES2SignalSyncPoint,
};
diff --git a/third_party/mojo/src/mojo/public/platform/native/mgl_onscreen_thunks.c b/third_party/mojo/src/mojo/public/platform/native/mgl_onscreen_thunks.c
new file mode 100644
index 0000000..c41b583
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/platform/native/mgl_onscreen_thunks.c
@@ -0,0 +1,28 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/public/platform/native/mgl_onscreen_thunks.h"
+
+#include <assert.h>
+
+#include "mojo/public/platform/native/thunk_export.h"
+
+static struct MGLOnscreenThunks g_onscreen_thunks = {0};
+
+void MGLResizeSurface(uint32_t width, uint32_t height) {
+ assert(g_onscreen_thunks.MGLResizeSurface);
+ g_onscreen_thunks.MGLResizeSurface(width, height);
+}
+
+void MGLSwapBuffers(void) {
+ assert(g_onscreen_thunks.MGLSwapBuffers);
+ g_onscreen_thunks.MGLSwapBuffers();
+}
+
+THUNK_EXPORT size_t MojoSetMGLOnscreenThunks(
+ const struct MGLOnscreenThunks* mgl_onscreen_thunks) {
+ if (mgl_onscreen_thunks->size >= sizeof(g_onscreen_thunks))
+ g_onscreen_thunks = *mgl_onscreen_thunks;
+ return sizeof(g_onscreen_thunks);
+}
diff --git a/third_party/mojo/src/mojo/public/platform/native/mgl_onscreen_thunks.h b/third_party/mojo/src/mojo/public/platform/native/mgl_onscreen_thunks.h
new file mode 100644
index 0000000..40dcb80
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/platform/native/mgl_onscreen_thunks.h
@@ -0,0 +1,46 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_PUBLIC_PLATFORM_NATIVE_MGL_ONSCREEN_THUNKS_H_
+#define MOJO_PUBLIC_PLATFORM_NATIVE_MGL_ONSCREEN_THUNKS_H_
+
+#include <stddef.h>
+
+#include "mojo/public/c/gpu/MGL/mgl_onscreen.h"
+
+// Structure used to bind the interface which manipulates MGL contexts to a
+// DSO to theose of the embedder.
+//
+// This is the ABI between the embedder and the DSO. It can only have new
+// functions added to the end. No other changes are supported.
+#pragma pack(push, 8)
+struct MGLOnscreenThunks {
+ size_t size; // Should be set to sizeof(MojoMGLOnscreenThunks).
+
+ void (*MGLResizeSurface)(uint32_t width, uint32_t height);
+ void (*MGLSwapBuffers)(void);
+};
+#pragma pack(pop)
+
+// Intended to be called from the embedder. Returns an object initialized to
+// contain pointers to each of the embedder's MGLOnscreenThunks functions.
+inline struct MGLOnscreenThunks MojoMakeMGLOnscreenThunks() {
+ struct MGLOnscreenThunks mgl_onscreen_thunks = {
+ sizeof(struct MGLOnscreenThunks), MGLResizeSurface, MGLSwapBuffers,
+ };
+
+ return mgl_onscreen_thunks;
+}
+
+// Use this type for the function found by dynamically discovering it in
+// a DSO linked with mojo_system. For example:
+// MojoSetMGLOnscreenThunksFn mojo_set_gles2_thunks_fn =
+// reinterpret_cast<MojoSetMGLOnscreenThunksFn>(
+// app_library.GetFunctionPointer("MojoSetMGLOnscreenThunks"));
+// The expected size of |mgl_thunks| is returned.
+// The contents of |mgl_thunks| are copied.
+typedef size_t (*MojoSetMGLOnscreenThunksFn)(
+ const struct MGLOnscreenThunks* mgl_thunks);
+
+#endif // MOJO_PUBLIC_PLATFORM_NATIVE_MGL_ONSCREEN_THUNKS_H_
diff --git a/third_party/mojo/src/mojo/public/platform/native/mgl_thunks.c b/third_party/mojo/src/mojo/public/platform/native/mgl_thunks.c
new file mode 100644
index 0000000..2e8e9d8
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/platform/native/mgl_thunks.c
@@ -0,0 +1,45 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/public/platform/native/mgl_thunks.h"
+
+#include <assert.h>
+
+#include "mojo/public/platform/native/thunk_export.h"
+
+static struct MGLThunks g_thunks = {0};
+
+MGLContext MGLCreateContext(MGLOpenGLAPIVersion version,
+ MojoHandle command_buffer_handle,
+ MGLContext share_group,
+ MGLContextLostCallback lost_callback,
+ void* lost_callback_closure,
+ const struct MojoAsyncWaiter* async_waiter) {
+ assert(g_thunks.MGLCreateContext);
+ return g_thunks.MGLCreateContext(
+ version, command_buffer_handle, share_group, lost_callback,
+ lost_callback_closure, async_waiter);
+}
+
+void MGLDestroyContext(MGLContext context) {
+ assert(g_thunks.MGLDestroyContext);
+ g_thunks.MGLDestroyContext(context);
+}
+
+void MGLMakeCurrent(MGLContext context) {
+ assert(g_thunks.MGLMakeCurrent);
+ g_thunks.MGLMakeCurrent(context);
+}
+
+MGLContext MGLGetCurrentContext(void) {
+ assert(g_thunks.MGLGetCurrentContext);
+ return g_thunks.MGLGetCurrentContext();
+}
+
+THUNK_EXPORT size_t MojoSetMGLThunks(
+ const struct MGLThunks* mgl_thunks) {
+ if (mgl_thunks->size >= sizeof(g_thunks))
+ g_thunks = *mgl_thunks;
+ return sizeof(g_thunks);
+}
diff --git a/third_party/mojo/src/mojo/public/platform/native/mgl_thunks.h b/third_party/mojo/src/mojo/public/platform/native/mgl_thunks.h
new file mode 100644
index 0000000..8a56474
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/platform/native/mgl_thunks.h
@@ -0,0 +1,56 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_PUBLIC_PLATFORM_NATIVE_MGL_THUNKS_H_
+#define MOJO_PUBLIC_PLATFORM_NATIVE_MGL_THUNKS_H_
+
+#include <stddef.h>
+
+#include "mojo/public/c/gpu/MGL/mgl.h"
+
+// Structure used to bind the interface which manipulates MGL contexts to a
+// DSO to theose of the embedder.
+//
+// This is the ABI between the embedder and the DSO. It can only have new
+// functions added to the end. No other changes are supported.
+#pragma pack(push, 8)
+struct MGLThunks {
+ size_t size; // Should be set to sizeof(MGLThunks).
+
+ MGLContext (*MGLCreateContext)(MGLOpenGLAPIVersion version,
+ MojoHandle command_buffer_handle,
+ MGLContext share_group,
+ MGLContextLostCallback lost_callback,
+ void* lost_callback_closure,
+ const struct MojoAsyncWaiter* async_waiter);
+ void (*MGLDestroyContext)(MGLContext context);
+ void (*MGLMakeCurrent)(MGLContext context);
+ MGLContext (*MGLGetCurrentContext)(void);
+};
+#pragma pack(pop)
+
+// Intended to be called from the embedder. Returns an object initialized to
+// contain pointers to each of the embedder's MGLThunks functions.
+inline struct MGLThunks MojoMakeMGLThunks() {
+ struct MGLThunks mgl_thunks = {
+ sizeof(struct MGLThunks),
+ MGLCreateContext,
+ MGLDestroyContext,
+ MGLMakeCurrent,
+ MGLGetCurrentContext,
+ };
+
+ return mgl_thunks;
+}
+
+// Use this type for the function found by dynamically discovering it in
+// a DSO linked with mojo_system. For example:
+// MojoSetMGLThunksFn mojo_set_gles2_thunks_fn =
+// reinterpret_cast<MojoSetMGLThunksFn>(
+// app_library.GetFunctionPointer("MojoSetMGLThunks"));
+// The expected size of |mgl_thunks| is returned.
+// The contents of |mgl_thunks| are copied.
+typedef size_t (*MojoSetMGLThunksFn)(const struct MGLThunks* mgl_thunks);
+
+#endif // MOJO_PUBLIC_PLATFORM_NATIVE_MGL_THUNKS_H_
diff --git a/third_party/mojo/src/mojo/public/tools/BUILD.gn b/third_party/mojo/src/mojo/public/tools/BUILD.gn
index 2368ae9..28a4925 100644
--- a/third_party/mojo/src/mojo/public/tools/BUILD.gn
+++ b/third_party/mojo/src/mojo/public/tools/BUILD.gn
@@ -28,6 +28,24 @@ if (mojo_use_prebuilt_mojo_shell) {
}
}
+if (mojo_use_prebuilt_dart_snapshotter) {
+ copy("copy_dart_snapshotter") {
+ if (host_os == "linux") {
+ platform = "linux-x64"
+ } else if (host_os == "mac") {
+ platform = "mac-x64"
+ } else {
+ assert(false, "$host_os not supported")
+ }
+ sources = [
+ "prebuilt/dart_snapshotter/$platform/dart_snapshotter",
+ ]
+ outputs = [
+ "$root_out_dir/dart_snapshotter",
+ ]
+ }
+}
+
if (mojo_use_prebuilt_network_service) {
copy("copy_network_service") {
filename = "network_service.mojo"
diff --git a/third_party/mojo/src/mojo/public/tools/NETWORK_SERVICE_VERSION b/third_party/mojo/src/mojo/public/tools/NETWORK_SERVICE_VERSION
index 09436b5..91026c6 100644
--- a/third_party/mojo/src/mojo/public/tools/NETWORK_SERVICE_VERSION
+++ b/third_party/mojo/src/mojo/public/tools/NETWORK_SERVICE_VERSION
@@ -1 +1 @@
-f4116cee892c698374ee7ae9ad8e6cea69741122
+1b87e90f670ebfee2b55df21b07dc37dc628fe40
diff --git a/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/enum_declaration.tmpl b/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/enum_declaration.tmpl
deleted file mode 100644
index d212e8b..0000000
--- a/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/enum_declaration.tmpl
+++ /dev/null
@@ -1,9 +0,0 @@
-enum {{enum.name}} : int32_t {
-{%- for field in enum.fields %}
-{%- if field.value %}
- {{enum.name|to_all_caps}}_{{field.name}} = {{field.value|expression_to_text}},
-{%- else %}
- {{enum.name|to_all_caps}}_{{field.name}},
-{%- endif %}
-{%- endfor %}
-};
diff --git a/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/enum_macros.tmpl b/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/enum_macros.tmpl
new file mode 100644
index 0000000..0e44acd
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/enum_macros.tmpl
@@ -0,0 +1,46 @@
+{#---
+ Macro for enum definition, and the declaration of associated functions.
+ `is_static` is relevant if this enum declaration is defined within a class, in
+ which case associated functions need to be static.
+---#}
+{%- macro enum_decl(enum, is_static=false) %}
+enum {{enum.name}} : int32_t {
+{%- for field in enum.fields %}
+{%- if field.value %}
+ {{enum.name|to_all_caps}}_{{field.name}} = {{field.value|expression_to_text}},
+{%- else %}
+ {{enum.name|to_all_caps}}_{{field.name}},
+{%- endif %}
+{%- endfor %}
+};
+{{is_valid_enum_decl(enum, is_static)}}
+{%- endmacro %}
+
+{#--- macros for the declaration & definitions of enum-associated functions.
+ Namely:
+ * {enum_name}_IsValidValue: returns true if the given enum has a valid value
+ for this generated version of enum.
+---#}
+
+{%- macro is_valid_enum_decl(enum, is_static=false) %}
+{% if is_static %}static {% endif -%}
+bool {{enum.name}}_IsValidValue({{enum.name}} value);
+{%- endmacro %}
+
+{%- macro is_valid_enum_def(enum, class_name = '') %}
+{% if class_name != '' -%}
+// static
+bool {{class_name}}::
+{%- else -%}
+{{"bool "}}
+{%- endif -%}
+{{enum.name}}_IsValidValue({{enum.name}} value) {
+ switch (static_cast<int32_t>(value)) {
+{%- for enum_field in enum.fields|groupby('numeric_value') %}
+ case {{enum_field[0]}}:
+{%- endfor %}
+ return true;
+ }
+ return false;
+}
+{%- endmacro %}
diff --git a/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/interface_declaration.tmpl b/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/interface_declaration.tmpl
index cdfc0ab..9edc1db 100644
--- a/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/interface_declaration.tmpl
+++ b/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/interface_declaration.tmpl
@@ -23,9 +23,9 @@ class {{interface.name}} {
{%- endif %}
{#--- Enums #}
+{% from "enum_macros.tmpl" import enum_decl -%}
{%- for enum in interface.enums %}
-{% macro enum_def() %}{% include "enum_declaration.tmpl" %}{% endmacro %}
- {{enum_def()|indent(2)}}
+ {{enum_decl(enum, is_static=true)|indent(2)}}
{%- endfor %}
{#--- Constants #}
diff --git a/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl b/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl
index 38991a9..a06d849 100644
--- a/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl
+++ b/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl
@@ -1,5 +1,7 @@
{%- import "interface_macros.tmpl" as interface_macros %}
{%- import "struct_macros.tmpl" as struct_macros %}
+{%- from "enum_macros.tmpl" import is_valid_enum_def %}
+
{%- set class_name = interface.name %}
{%- set proxy_name = interface.name ~ "Proxy" %}
{%- set namespace_as_string = "%s"|format(namespace|replace(".","::")) %}
@@ -24,9 +26,7 @@ p_{{param.name}}
{%- macro build_message(struct, struct_display_name) -%}
{{struct_macros.serialize(struct, struct_display_name, "in_%s", "params", "builder.buffer()")}}
- mojo::Message message;
- params->EncodePointersAndHandles(message.mutable_handles());
- builder.Finish(&message);
+ params->EncodePointersAndHandles(builder.message()->mutable_handles());
{%- endmacro %}
{#--- Begin #}
@@ -42,6 +42,11 @@ MOJO_STATIC_CONST_MEMBER_DEFINITION const {{constant.kind|cpp_pod_type}} {{inter
{%- endif %}
{%- endfor %}
+{#--- Enums #}
+{%- for enum in interface.enums %}
+ {{is_valid_enum_def(enum, class_name=interface.name)|indent(2)}}
+{%- endfor %}
+
{#--- ForwardToCallback definition #}
{%- for method in interface.methods -%}
{%- if method.response_parameters != None %}
@@ -98,10 +103,10 @@ void {{proxy_name}}::{{method.name}}(
{%- if method.response_parameters != None %}
mojo::MessageReceiver* responder =
new {{class_name}}_{{method.name}}_ForwardToCallback(callback);
- if (!receiver_->AcceptWithResponder(&message, responder))
+ if (!receiver_->AcceptWithResponder(builder.message(), responder))
delete responder;
{%- else %}
- bool ok = receiver_->Accept(&message);
+ bool ok = receiver_->Accept(builder.message());
// This return value may be ignored as !ok implies the Connector has
// encountered an error, which will be visible through other means.
MOJO_ALLOW_UNUSED_LOCAL(ok);
@@ -152,7 +157,7 @@ void {{class_name}}_{{method.name}}_ProxyToResponder::Run(
mojo::internal::ResponseMessageBuilder builder(
{{message_name}}, size, request_id_);
{{build_message(response_params_struct, params_description)}}
- bool ok = responder_->Accept(&message);
+ bool ok = responder_->Accept(builder.message());
MOJO_ALLOW_UNUSED_LOCAL(ok);
// TODO(darin): !ok returned here indicates a malformed message, and that may
// be good reason to close the connection. However, we don't have a way to do
diff --git a/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl b/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl
index 463d260..05305e1 100644
--- a/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl
+++ b/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/module.cc.tmpl
@@ -78,6 +78,12 @@ const uint32_t {{method_name}} = {{method.ordinal}};
} // namespace internal
+{#--- Enums #}
+{%- from "enum_macros.tmpl" import is_valid_enum_def -%}
+{%- for enum in enums -%}
+ {{is_valid_enum_def(enum, class_name='')}}
+{%- endfor %}
+
{#--- Struct Constants #}
{%- for struct in structs %}
{%- for constant in struct.constants %}
diff --git a/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl b/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl
index 56a7047..39fe8bc 100644
--- a/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl
+++ b/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl
@@ -31,8 +31,9 @@ namespace {{namespace}} {
{%- endfor %}
{#--- Enums #}
+{% from "enum_macros.tmpl" import enum_decl -%}
{% for enum in enums %}
-{% include "enum_declaration.tmpl" %}
+ {{enum_decl(enum)}}
{%- endfor %}
{#--- Constants #}
diff --git a/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl b/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl
index 47e2df8..0293acc 100644
--- a/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl
+++ b/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl
@@ -1,12 +1,11 @@
-
+{% from "enum_macros.tmpl" import enum_decl -%}
class {{struct.name}} {
public:
using Data_ = internal::{{struct.name}}_Data;
{#--- Enums #}
{%- for enum in struct.enums -%}
-{% macro enum_def() %}{% include "enum_declaration.tmpl" %}{% endmacro %}
- {{enum_def()|indent(2)}}
+ {{enum_decl(enum, is_static=true)|indent(2)}}
{%- endfor %}
{#--- Constants #}
diff --git a/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_definition.tmpl b/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_definition.tmpl
index 5ab301c..8c61c86 100644
--- a/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_definition.tmpl
+++ b/third_party/mojo/src/mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_definition.tmpl
@@ -1,3 +1,10 @@
+{%- from "enum_macros.tmpl" import is_valid_enum_def %}
+
+{#--- Enums #}
+{%- for enum in struct.enums -%}
+ {{is_valid_enum_def(enum, class_name=struct.name)}}
+{%- endfor %}
+
// static
{{struct.name}}Ptr {{struct.name}}::New() {
{{struct.name}}Ptr rv;
diff --git a/third_party/mojo/src/mojo/public/tools/bindings/generators/java_templates/interface_definition.tmpl b/third_party/mojo/src/mojo/public/tools/bindings/generators/java_templates/interface_definition.tmpl
index 320abeb..527e15f 100644
--- a/third_party/mojo/src/mojo/public/tools/bindings/generators/java_templates/interface_definition.tmpl
+++ b/third_party/mojo/src/mojo/public/tools/bindings/generators/java_templates/interface_definition.tmpl
@@ -122,6 +122,7 @@ try {
return false;
}
} catch (org.chromium.mojo.bindings.DeserializationException e) {
+ System.err.println(e.toString());
return false;
}
{%- endmacro -%}
diff --git a/third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_cpp_generator.py b/third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
index 3d59087..160f657 100644
--- a/third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
+++ b/third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
@@ -146,7 +146,13 @@ def GetCppResultWrapperType(kind):
return "mojo::ScopedMessagePipeHandle"
if mojom.IsSharedBufferKind(kind):
return "mojo::ScopedSharedBufferHandle"
- return _kind_to_cpp_type[kind]
+ # TODO(rudominer) After improvements to compiler front end have landed,
+ # revisit strategy used below for emitting a useful error message when an
+ # undefined identifier is referenced.
+ val = _kind_to_cpp_type.get(kind)
+ if (val is not None):
+ return val
+ raise Exception("Unrecognized kind %s" % kind.spec)
def GetCppWrapperType(kind):
if mojom.IsEnumKind(kind):
diff --git a/third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_dart_generator.py b/third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_dart_generator.py
index c324c9c..1db70cf 100644
--- a/third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_dart_generator.py
+++ b/third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_dart_generator.py
@@ -373,10 +373,21 @@ def IsPointerArrayKind(kind):
sub_kind = kind.kind
return mojom.IsObjectKind(sub_kind)
+def ParseStringAttribute(attribute):
+ assert isinstance(attribute, basestring)
+ return attribute
+
+def GetPackage(module):
+ if module.attributes and 'DartPackage' in module.attributes:
+ return ParseStringAttribute(module.attributes['DartPackage'])
+ # Default package.
+ return 'mojom'
+
def GetImportUri(module):
+ package = GetPackage(module);
elements = module.namespace.split('.')
elements.append("%s" % module.name)
- return os.path.join("mojom", *elements)
+ return os.path.join(package, *elements)
class Generator(generator.Generator):
@@ -423,11 +434,12 @@ class Generator(generator.Generator):
elements = self.module.namespace.split('.')
elements.append("%s.dart" % self.module.name)
+ package_name = GetPackage(self.module)
lib_module = self.GenerateLibModule(args)
- pkg_path = os.path.join("dart-pkg", "mojom/lib", *elements)
+ pkg_path = os.path.join("dart-pkg", package_name, "lib", *elements)
self.Write(lib_module, pkg_path)
- gen_path = os.path.join("dart-gen", "mojom/lib", *elements)
+ gen_path = os.path.join("dart-gen", package_name, "lib", *elements)
full_gen_path = os.path.join(self.output_dir, gen_path)
self.Write(lib_module, gen_path)
diff --git a/third_party/mojo/src/mojo/public/tools/bindings/mojom.gni b/third_party/mojo/src/mojo/public/tools/bindings/mojom.gni
index 03dd431..f990b21 100644
--- a/third_party/mojo/src/mojo/public/tools/bindings/mojom.gni
+++ b/third_party/mojo/src/mojo/public/tools/bindings/mojom.gni
@@ -55,7 +55,7 @@ template("mojom") {
generator_script = "$generator_root/mojom_bindings_generator.py"
generator_sources = [
generator_script,
- "$generator_root/generators/cpp_templates/enum_declaration.tmpl",
+ "$generator_root/generators/cpp_templates/enum_macros.tmpl",
"$generator_root/generators/cpp_templates/interface_declaration.tmpl",
"$generator_root/generators/cpp_templates/interface_definition.tmpl",
"$generator_root/generators/cpp_templates/interface_macros.tmpl",
diff --git a/third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom/generate/data.py b/third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom/generate/data.py
index bc727b4..0c64d4e 100644
--- a/third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom/generate/data.py
+++ b/third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom/generate/data.py
@@ -347,6 +347,33 @@ def EnumFieldFromData(module, enum, data, parent_kind):
module.values[value.GetSpec()] = value
return field
+def ResolveNumericEnumValues(enum_fields):
+ """
+ Given a reference to a list of mojom.EnumField, resolves and assigns their
+ values to EnumField.numeric_value.
+ """
+
+ # map of <name> -> integral value
+ resolved_enum_values = {}
+ prev_value = -1
+ for field in enum_fields:
+ # This enum value is +1 the previous enum value (e.g: BEGIN).
+ if field.value is None:
+ prev_value += 1
+
+ # Integral value (e.g: BEGIN = -0x1).
+ elif type(field.value) is str:
+ prev_value = int(field.value, 0)
+
+ # Reference to a previous enum value (e.g: INIT = BEGIN).
+ elif type(field.value) is mojom.EnumValue:
+ prev_value = resolved_enum_values[field.value.name]
+ else:
+ raise Exception("Unresolved enum value.")
+
+ resolved_enum_values[field.name] = prev_value
+ field.numeric_value = prev_value
+
def EnumFromData(module, data, parent_kind):
enum = mojom.Enum(module=module)
enum.name = data['name']
@@ -359,6 +386,7 @@ def EnumFromData(module, data, parent_kind):
lambda field: EnumFieldFromData(module, enum, field, parent_kind),
data['fields'])
enum.attributes = data.get('attributes')
+ ResolveNumericEnumValues(enum.fields)
module.kinds[enum.spec] = enum
return enum
diff --git a/third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom/generate/module.py b/third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom/generate/module.py
index df5c8dc..8596f22 100644
--- a/third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom/generate/module.py
+++ b/third_party/mojo/src/mojo/public/tools/bindings/pylib/mojom/generate/module.py
@@ -386,10 +386,12 @@ class Interface(ReferenceKind):
class EnumField(object):
- def __init__(self, name=None, value=None, attributes=None):
+ def __init__(self, name=None, value=None, attributes=None,
+ numeric_value=None):
self.name = name
self.value = value
self.attributes = attributes
+ self.numeric_value = numeric_value
@property
def min_version(self):
@@ -572,4 +574,3 @@ def HasCallbacks(interface):
if method.response_parameters != None:
return True
return False
-
diff --git a/third_party/mojo/src/mojo/public/tools/dart_analyze.py b/third_party/mojo/src/mojo/public/tools/dart_analyze.py
index 6e7dfc4..23119ee 100755
--- a/third_party/mojo/src/mojo/public/tools/dart_analyze.py
+++ b/third_party/mojo/src/mojo/public/tools/dart_analyze.py
@@ -3,13 +3,17 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-# To integrate dartanalyze with out build system, we take an input file, run
+# To integrate dartanalyze with our build system, we take an input file, run
# the analyzer on it, and write a stamp file if it passed.
-#
-# The first argument to this script is a reference to this build's gen
-# directory, which we treat as the package root. The second is the stamp file
-# to touch if we succeed. The rest are passed to the analyzer verbatim.
+# This script can either analyze a dartzip package, specified with the
+# --dartzip-file flag, or a set of entrypoints specified with the --entrypoints
+# flag. The location of the Dart SDK must be specified with the --dart-sdk
+# flag. A stamp file can optionally be written with the location given by the
+# --stamp-file flag. Any command line arguments not recognized by this script
+# are passed on to the Dart analyzer.
+
+import argparse
import glob
import os
import re
@@ -36,20 +40,30 @@ _IGNORED_PATTERNS = [
re.compile(r'.*cannot both be unnamed'),
]
+
def _success(stamp_file):
# We passed cleanly, so touch the stamp file so that we don't run again.
with open(stamp_file, 'a'):
os.utime(stamp_file, None)
return 0
-def main(args):
- dartzip_file = args.pop(0)
- stamp_file = args.pop(0)
-
- # Do not run dart analyzer on third_party sources.
- if "/third_party/" in dartzip_file:
- return _success(stamp_file)
+def analyze_and_filter(cmd, temp_dir=None, dirname=None):
+ errors = None
+ try:
+ subprocess.check_output(cmd, shell=False, stderr=subprocess.STDOUT)
+ except subprocess.CalledProcessError as e:
+ errors = set(l for l in e.output.split('\n')
+ if not any(p.match(l) for p in _IGNORED_PATTERNS))
+ for error in sorted(errors):
+ if dirname is None:
+ print >> sys.stderr, error
+ else:
+ print >> sys.stderr, error.replace(temp_dir + "/", dirname)
+ return errors
+
+
+def analyze_dartzip(dart_sdk, dartzip_file, stamp_file, args):
dartzip_basename = os.path.basename(dartzip_file) + ":"
# Unzip |dartzip_file| to a temporary directory.
@@ -57,9 +71,7 @@ def main(args):
temp_dir = tempfile.mkdtemp()
zipfile.ZipFile(dartzip_file).extractall(temp_dir)
- cmd = [
- "../../third_party/dart-sdk/dart-sdk/bin/dartanalyzer",
- ]
+ cmd = [ os.path.join(dart_sdk, 'bin', 'dartanalyzer') ]
# Grab all the toplevel dart files in the archive.
dart_files = glob.glob(os.path.join(temp_dir, "*.dart"))
@@ -72,20 +84,65 @@ def main(args):
cmd.append("--package-root=%s/packages" % temp_dir)
cmd.append("--fatal-warnings")
- errors = 0
- try:
- subprocess.check_output(cmd, shell=False, stderr=subprocess.STDOUT)
- except subprocess.CalledProcessError as e:
- errors = set(l for l in e.output.split('\n')
- if not any(p.match(l) for p in _IGNORED_PATTERNS))
- for error in sorted(errors):
- print >> sys.stderr, error.replace(temp_dir + "/", dartzip_basename)
+ errors = analyze_and_filter(cmd, temp_dir, dartzip_basename)
- if not errors:
+ if errors is None:
return _success(stamp_file)
return min(255, len(errors))
finally:
shutil.rmtree(temp_dir)
+
+def analyze_entrypoints(dart_sdk, entrypoints, args):
+ cmd = [ os.path.join(dart_sdk, 'bin', 'dartanalyzer') ]
+ cmd.extend(entrypoints)
+ cmd.extend(args)
+ cmd.append("--fatal-warnings")
+ errors = analyze_and_filter(cmd)
+ if errors is None:
+ return 0
+ return min(255, len(errors))
+
+
+def main():
+ parser = argparse.ArgumentParser(description='Run the Dart analyzer.')
+ parser.add_argument('--dart-sdk',
+ action='store',
+ type=str,
+ metavar='dart_sdk',
+ help='Path to the Dart SDK',
+ required=True)
+ parser.add_argument('--dartzip-file',
+ action='store',
+ type=str,
+ metavar='dartzip_file',
+ help='dartzip file whose contents to analyze',
+ default=None)
+ parser.add_argument('--stamp-file',
+ action='store',
+ type=str,
+ metavar='stamp_file',
+ help='Stamp file to write on success.',
+ default=None)
+ parser.add_argument('--entrypoints',
+ help='Entry points to analyze',
+ nargs='*',
+ default=[])
+ args, remainder = parser.parse_known_args()
+
+ if args.dartzip_file is None and args.entrypoints == []:
+ parser.print_help()
+ return 1
+
+ if args.dartzip_file is not None:
+ # Do not run dart analyzer on third_party sources.
+ if "/third_party/" in args.dartzip_file:
+ return _success(args.stamp_file)
+ return analyze_dartzip(args.dart_sdk, args.dartzip_file, args.stamp_file,
+ remainder)
+
+ if args.entrypoints != []:
+ return analyze_entrypoints(args.dart_sdk, args.entrypoints, remainder)
+
if __name__ == '__main__':
- sys.exit(main(sys.argv[1:]))
+ sys.exit(main())
diff --git a/third_party/mojo/src/mojo/public/tools/dart_package.py b/third_party/mojo/src/mojo/public/tools/dart_package.py
index 0ded17d..9dcfdf4 100755
--- a/third_party/mojo/src/mojo/public/tools/dart_package.py
+++ b/third_party/mojo/src/mojo/public/tools/dart_package.py
@@ -21,11 +21,10 @@ def IsMojomPath(path):
def IsMojomDartFile(path):
return path.endswith('.mojom.dart')
-# Strips off mojom/lib/ returning module/interface.mojom.dart
-def MojomDartRelativePath(path):
- assert IsMojomPath(path)
+# Strips off |package_name|/lib/ returning module/interface.mojom.dart
+def MojomDartRelativePath(package_name, path):
assert IsMojomDartFile(path)
- return os.path.relpath(path, 'mojom/lib/')
+ return os.path.relpath(path, package_name + '/lib/')
# Line is a line from pubspec.yaml
def PackageName(line):
@@ -106,7 +105,14 @@ def DoZip(inputs, zip_inputs, output, base_dir):
# Copy any direct mojom dependencies into mojom/
if IsMojomPath(f):
mojom_dep_copy = os.path.join("lib/mojom/",
- MojomDartRelativePath(f))
+ MojomDartRelativePath("mojom", f))
+ if mojom_dep_copy not in files:
+ files.append(mojom_dep_copy)
+ with zf.open(f) as zff:
+ outfile.writestr(mojom_dep_copy, zff.read())
+ # Copy under lib/ as well.
+ mojom_dep_copy = os.path.join("lib/",
+ MojomDartRelativePath("mojom", f))
if mojom_dep_copy not in files:
files.append(mojom_dep_copy)
with zf.open(f) as zff:
@@ -115,10 +121,11 @@ def DoZip(inputs, zip_inputs, output, base_dir):
# Rewrite output file name, if it isn't a packages/ path.
output_name = None
if not IsPackagesPath(f):
- if IsMojomDartFile(f) and IsMojomPath(f):
- # Place mojom/lib/*.mojom.dart files into packages/mojom/
- output_name = os.path.join("packages/mojom/",
- MojomDartRelativePath(f))
+ if IsMojomDartFile(f):
+ # Place $package/lib/*.mojom.dart files into packages/$package/
+ package = next(p for p in f.split(os.path.sep) if p)
+ output_name = os.path.join("packages/" + package + "/",
+ MojomDartRelativePath(package, f))
else:
# We are processing a package, it must have a package name.
assert not (package_name is None)
diff --git a/third_party/mojo/src/mojo/public/tools/dart_pkg.py b/third_party/mojo/src/mojo/public/tools/dart_pkg.py
index 86ae5d5..71e25a7 100755
--- a/third_party/mojo/src/mojo/public/tools/dart_pkg.py
+++ b/third_party/mojo/src/mojo/public/tools/dart_pkg.py
@@ -11,6 +11,7 @@ import errno
import json
import os
import shutil
+import subprocess
import sys
# Disable lint check for finding modules:
@@ -24,253 +25,314 @@ from mojom.parse.translate import Translate
USE_LINKS = sys.platform != "win32"
+DART_ANALYZE = os.path.join(os.path.dirname(os.path.abspath(__file__)),
+ "dart_analyze.py")
def mojom_dart_filter(path):
- if os.path.isdir(path):
- return True
- # Don't include all .dart, just .mojom.dart.
- return path.endswith('.mojom.dart')
+ if os.path.isdir(path):
+ return True
+ # Don't include all .dart, just .mojom.dart.
+ return path.endswith('.mojom.dart')
def dart_filter(path):
- if os.path.isdir(path):
- return True
- _, ext = os.path.splitext(path)
- # .dart includes '.mojom.dart'
- return ext == '.dart'
+ if os.path.isdir(path):
+ return True
+ _, ext = os.path.splitext(path)
+ # .dart includes '.mojom.dart'
+ return ext == '.dart'
def mojom_filter(path):
- if os.path.isdir(path):
- return True
- _, ext = os.path.splitext(path)
- return ext == '.mojom'
+ if os.path.isdir(path):
+ return True
+ _, ext = os.path.splitext(path)
+ return ext == '.mojom'
def ensure_dir_exists(path):
- abspath = os.path.abspath(path)
- if not os.path.exists(abspath):
- os.makedirs(abspath)
+ abspath = os.path.abspath(path)
+ if not os.path.exists(abspath):
+ os.makedirs(abspath)
def has_pubspec_yaml(paths):
- for path in paths:
- _, filename = os.path.split(path)
- if 'pubspec.yaml' == filename:
- return True
- return False
+ for path in paths:
+ _, filename = os.path.split(path)
+ if 'pubspec.yaml' == filename:
+ return True
+ return False
def link(from_root, to_root):
- ensure_dir_exists(os.path.dirname(to_root))
- if os.path.exists(to_root):
- os.unlink(to_root)
- try:
- os.symlink(from_root, to_root)
- except OSError as e:
- if e.errno == errno.EEXIST:
- pass
+ ensure_dir_exists(os.path.dirname(to_root))
+ if os.path.exists(to_root):
+ os.unlink(to_root)
+ try:
+ os.symlink(from_root, to_root)
+ except OSError as e:
+ if e.errno == errno.EEXIST:
+ pass
def copy(from_root, to_root, filter_func=None):
- if not os.path.exists(from_root):
- return
- if os.path.isfile(from_root):
- ensure_dir_exists(os.path.dirname(to_root))
- shutil.copy(from_root, to_root)
- return
+ if not os.path.exists(from_root):
+ return
+ if os.path.isfile(from_root):
+ ensure_dir_exists(os.path.dirname(to_root))
+ shutil.copy(from_root, to_root)
+ return
- ensure_dir_exists(to_root)
+ ensure_dir_exists(to_root)
- for root, dirs, files in os.walk(from_root):
- # filter_func expects paths not names, so wrap it to make them absolute.
- wrapped_filter = None
- if filter_func:
- wrapped_filter = lambda name: filter_func(os.path.join(root, name))
+ for root, dirs, files in os.walk(from_root):
+ # filter_func expects paths not names, so wrap it to make them absolute.
+ wrapped_filter = None
+ if filter_func:
+ wrapped_filter = lambda name: filter_func(os.path.join(root, name))
- for name in filter(wrapped_filter, files):
- from_path = os.path.join(root, name)
- root_rel_path = os.path.relpath(from_path, from_root)
- to_path = os.path.join(to_root, root_rel_path)
- to_dir = os.path.dirname(to_path)
- if not os.path.exists(to_dir):
- os.makedirs(to_dir)
- shutil.copy(from_path, to_path)
+ for name in filter(wrapped_filter, files):
+ from_path = os.path.join(root, name)
+ root_rel_path = os.path.relpath(from_path, from_root)
+ to_path = os.path.join(to_root, root_rel_path)
+ to_dir = os.path.dirname(to_path)
+ if not os.path.exists(to_dir):
+ os.makedirs(to_dir)
+ shutil.copy(from_path, to_path)
- dirs[:] = filter(wrapped_filter, dirs)
+ dirs[:] = filter(wrapped_filter, dirs)
def copy_or_link(from_root, to_root, filter_func=None):
- if USE_LINKS:
- link(from_root, to_root)
- else:
- copy(from_root, to_root, filter_func)
+ if USE_LINKS:
+ link(from_root, to_root)
+ else:
+ copy(from_root, to_root, filter_func)
+
+
+def link_if_possible(from_root, to_root):
+ if USE_LINKS:
+ link(from_root, to_root)
def remove_if_exists(path):
- try:
- os.remove(path)
- except OSError as e:
- if e.errno != errno.ENOENT:
- raise
+ try:
+ os.remove(path)
+ except OSError as e:
+ if e.errno != errno.ENOENT:
+ raise
+
def list_files(from_root, filter_func=None):
- file_list = []
- for root, dirs, files in os.walk(from_root):
- # filter_func expects paths not names, so wrap it to make them absolute.
- wrapped_filter = None
- if filter_func:
- wrapped_filter = lambda name: filter_func(os.path.join(root, name))
- for name in filter(wrapped_filter, files):
- path = os.path.join(root, name)
- file_list.append(path)
- dirs[:] = filter(wrapped_filter, dirs)
- return file_list
+ file_list = []
+ for root, dirs, files in os.walk(from_root):
+ # filter_func expects paths not names, so wrap it to make them absolute.
+ wrapped_filter = None
+ if filter_func:
+ wrapped_filter = lambda name: filter_func(os.path.join(root, name))
+ for name in filter(wrapped_filter, files):
+ path = os.path.join(root, name)
+ file_list.append(path)
+ dirs[:] = filter(wrapped_filter, dirs)
+ return file_list
def remove_broken_symlink(path):
- try:
- link_path = os.readlink(path)
- except OSError as e:
- # Path was not a symlink.
- if e.errno == errno.EINVAL:
- pass
- else:
- if not os.path.exists(link_path):
- os.unlink(path)
+ try:
+ link_path = os.readlink(path)
+ except OSError as e:
+ # Path was not a symlink.
+ if e.errno == errno.EINVAL:
+ pass
+ else:
+ if not os.path.exists(link_path):
+ os.unlink(path)
def remove_broken_symlinks(root_dir):
- for current_dir, _, child_files in os.walk(root_dir):
- for filename in child_files:
- path = os.path.join(current_dir, filename)
- remove_broken_symlink(path)
+ for current_dir, _, child_files in os.walk(root_dir):
+ for filename in child_files:
+ path = os.path.join(current_dir, filename)
+ remove_broken_symlink(path)
def mojom_path(filename):
- with open(filename) as f:
- source = f.read()
- tree = Parse(source, filename)
- _, name = os.path.split(filename)
- mojom = Translate(tree, name)
- elements = mojom['namespace'].split('.')
- elements.append("%s" % mojom['name'])
- return os.path.join(*elements)
+ with open(filename) as f:
+ source = f.read()
+ tree = Parse(source, filename)
+ _, name = os.path.split(filename)
+ mojom = Translate(tree, name)
+ elements = mojom['namespace'].split('.')
+ elements.append("%s" % mojom['name'])
+ return os.path.join(*elements)
+
+
+def analyze_entrypoints(dart_sdk, package_root, entrypoints):
+ cmd = [ "python", DART_ANALYZE ]
+ cmd.append("--dart-sdk")
+ cmd.append(dart_sdk)
+ cmd.append("--entrypoints")
+ cmd.extend(entrypoints)
+ cmd.append("--package-root")
+ cmd.append(package_root)
+ cmd.append("--no-hints")
+ try:
+ subprocess.check_call(cmd)
+ except subprocess.CalledProcessError as e:
+ print('Failed analyzing %s' % entrypoints)
+ return e.returncode
+ return 0
def main():
- parser = argparse.ArgumentParser(description='Generate a dart-pkg')
- parser.add_argument('--package-name',
- action='store',
- type=str,
- metavar='package_name',
- help='Name of package',
- required=True)
- parser.add_argument('--gen-directory',
- metavar='gen_directory',
- help="dart-gen directory",
- required=True)
- parser.add_argument('--pkg-directory',
- metavar='pkg_directory',
- help='Directory where dart_pkg should go',
- required=True)
- parser.add_argument('--package-root',
- metavar='package_root',
- help='packages/ directory',
- required=True)
- parser.add_argument('--stamp-file',
- metavar='stamp_file',
- help='timestamp file',
- required=True)
- parser.add_argument('--package-sources',
- metavar='package_sources',
- help='Package sources',
- nargs='+')
- parser.add_argument('--mojom-sources',
- metavar='mojom_sources',
- help='.mojom and .mojom.dart sources',
- nargs='*',
- default=[])
- parser.add_argument('--sdk-ext-directories',
- metavar='sdk_ext_directories',
- help='Directory containing .dart sources',
- nargs='*',
- default=[])
- parser.add_argument('--sdk-ext-files',
- metavar='sdk_ext_files',
- help='List of .dart files that are part of of sdk_ext.',
- nargs='*',
- default=[])
- parser.add_argument('--sdk-ext-mappings',
- metavar='sdk_ext_mappings',
- help='Mappings for SDK extension libraries.',
- nargs='*',
- default=[])
- args = parser.parse_args()
-
- # We must have a pubspec.yaml.
- assert has_pubspec_yaml(args.package_sources)
-
- target_dir = os.path.join(args.pkg_directory, args.package_name)
- lib_path = os.path.join(target_dir, "lib")
-
- mappings = {}
- for mapping in args.sdk_ext_mappings:
- library, path = mapping.split(',', 1)
- mappings[library] = '../sdk_ext/%s' % path
-
- sdkext_path = os.path.join(lib_path, '_sdkext')
- if mappings:
- ensure_dir_exists(lib_path)
- with open(sdkext_path, 'w') as stream:
- json.dump(mappings, stream, sort_keys=True,
- indent=2, separators=(',', ': '))
- else:
- remove_if_exists(sdkext_path)
-
- # Copy or symlink package sources into pkg directory.
- common_source_prefix = os.path.commonprefix(args.package_sources)
- for source in args.package_sources:
- relative_source = os.path.relpath(source, common_source_prefix)
- target = os.path.join(target_dir, relative_source)
- copy_or_link(source, target)
-
- # Copy sdk-ext sources into pkg directory
- sdk_ext_dir = os.path.join(target_dir, 'sdk_ext')
- for directory in args.sdk_ext_directories:
- sdk_ext_sources = list_files(directory, dart_filter)
- common_prefix = os.path.commonprefix(sdk_ext_sources)
- for source in sdk_ext_sources:
- relative_source = os.path.relpath(source, common_prefix)
- target = os.path.join(sdk_ext_dir, relative_source)
- copy_or_link(source, target)
- for source in args.sdk_ext_files:
- common_prefix = os.path.commonprefix(args.sdk_ext_files)
- relative_source = os.path.relpath(source, common_prefix)
- target = os.path.join(sdk_ext_dir, relative_source)
- copy_or_link(source, target)
-
- lib_mojom_path = os.path.join(lib_path, "mojom")
-
- # Copy generated mojom.dart files.
- generated_mojom_lib_path = os.path.join(args.gen_directory, "mojom/lib")
- for mojom_source_path in args.mojom_sources:
- path = mojom_path(mojom_source_path)
- source_path = '%s.dart' % os.path.join(generated_mojom_lib_path, path)
- target_path = '%s.dart' % os.path.join(lib_mojom_path, path)
- copy(source_path, target_path)
-
- # Symlink packages/
- package_path = os.path.join(args.package_root, args.package_name)
- link(lib_path, package_path)
-
- # Remove any broken symlinks in target_dir and package root.
- remove_broken_symlinks(target_dir)
- remove_broken_symlinks(args.package_root)
-
- # Write stamp file.
- with open(args.stamp_file, 'w'):
- pass
+ parser = argparse.ArgumentParser(description='Generate a dart-pkg')
+ parser.add_argument('--dart-sdk',
+ action='store',
+ metavar='dart_sdk',
+ help='Path to the Dart SDK.')
+ parser.add_argument('--package-name',
+ action='store',
+ metavar='package_name',
+ help='Name of package',
+ required=True)
+ parser.add_argument('--gen-directory',
+ metavar='gen_directory',
+ help="dart-gen directory",
+ required=True)
+ parser.add_argument('--pkg-directory',
+ metavar='pkg_directory',
+ help='Directory where dart_pkg should go',
+ required=True)
+ parser.add_argument('--package-root',
+ metavar='package_root',
+ help='packages/ directory',
+ required=True)
+ parser.add_argument('--stamp-file',
+ metavar='stamp_file',
+ help='timestamp file',
+ required=True)
+ parser.add_argument('--package-sources',
+ metavar='package_sources',
+ help='Package sources',
+ nargs='+')
+ parser.add_argument('--package-entrypoints',
+ metavar='package_entrypoints',
+ help='Package entry points for analyzer',
+ nargs='*',
+ default=[])
+ parser.add_argument('--mojom-sources',
+ metavar='mojom_sources',
+ help='.mojom and .mojom.dart sources',
+ nargs='*',
+ default=[])
+ parser.add_argument('--sdk-ext-directories',
+ metavar='sdk_ext_directories',
+ help='Directory containing .dart sources',
+ nargs='*',
+ default=[])
+ parser.add_argument('--sdk-ext-files',
+ metavar='sdk_ext_files',
+ help='List of .dart files that are part of of sdk_ext.',
+ nargs='*',
+ default=[])
+ parser.add_argument('--sdk-ext-mappings',
+ metavar='sdk_ext_mappings',
+ help='Mappings for SDK extension libraries.',
+ nargs='*',
+ default=[])
+ args = parser.parse_args()
+
+ # We must have a pubspec.yaml.
+ assert has_pubspec_yaml(args.package_sources)
+
+ target_dir = os.path.join(args.pkg_directory, args.package_name)
+ target_packages_dir = os.path.join(target_dir, 'packages')
+ lib_path = os.path.join(target_dir, "lib")
+
+ mappings = {}
+ for mapping in args.sdk_ext_mappings:
+ library, path = mapping.split(',', 1)
+ mappings[library] = '../sdk_ext/%s' % path
+
+ sdkext_path = os.path.join(lib_path, '_sdkext')
+ if mappings:
+ ensure_dir_exists(lib_path)
+ with open(sdkext_path, 'w') as stream:
+ json.dump(mappings, stream, sort_keys=True,
+ indent=2, separators=(',', ': '))
+ else:
+ remove_if_exists(sdkext_path)
+
+ # Copy or symlink package sources into pkg directory.
+ common_source_prefix = os.path.dirname(os.path.commonprefix(
+ args.package_sources))
+ for source in args.package_sources:
+ relative_source = os.path.relpath(source, common_source_prefix)
+ target = os.path.join(target_dir, relative_source)
+ copy_or_link(source, target)
+
+ entrypoint_targets = []
+ for source in args.package_entrypoints:
+ relative_source = os.path.relpath(source, common_source_prefix)
+ target = os.path.join(target_dir, relative_source)
+ copy_or_link(source, target)
+ entrypoint_targets.append(target)
+
+ # Copy sdk-ext sources into pkg directory
+ sdk_ext_dir = os.path.join(target_dir, 'sdk_ext')
+ for directory in args.sdk_ext_directories:
+ sdk_ext_sources = list_files(directory, dart_filter)
+ common_prefix = os.path.commonprefix(sdk_ext_sources)
+ for source in sdk_ext_sources:
+ relative_source = os.path.relpath(source, common_prefix)
+ target = os.path.join(sdk_ext_dir, relative_source)
+ copy_or_link(source, target)
+ for source in args.sdk_ext_files:
+ common_prefix = os.path.commonprefix(args.sdk_ext_files)
+ relative_source = os.path.relpath(source, common_prefix)
+ target = os.path.join(sdk_ext_dir, relative_source)
+ copy_or_link(source, target)
+
+ # Symlink packages/
+ package_path = os.path.join(args.package_root, args.package_name)
+ link(lib_path, package_path)
+
+ # Symlink non-dart-pkg dependent packages
+ dep_packages = os.path.join(common_source_prefix, 'packages')
+ if os.path.exists(dep_packages):
+ for package in os.listdir(dep_packages):
+ source = os.path.join(dep_packages, package)
+ target = os.path.join(args.package_root, package)
+ if not os.path.exists(target):
+ link(source, target)
+
+ # Link dart-pkg/$package/packages to dart-pkg/packages
+ link_if_possible(args.package_root, target_packages_dir)
+
+ # Remove any broken symlinks in target_dir and package root.
+ remove_broken_symlinks(target_dir)
+ remove_broken_symlinks(args.package_root)
+
+ # If any entrypoints are defined, invoke the analyzer on them.
+ if entrypoint_targets != []:
+ # Make sure we have a Dart SDK.
+ dart_sdk = args.dart_sdk
+ if dart_sdk is None:
+ dart_sdk = os.environ.get('DART_SDK')
+ if dart_sdk is None:
+ print "Pass --dart-sdk, or define the DART_SDK environment variable"
+ return 1
+
+ result = analyze_entrypoints(dart_sdk, args.package_root,
+ entrypoint_targets)
+ if result != 0:
+ return result
+
+ # Write stamp file.
+ with open(args.stamp_file, 'w'):
+ pass
+
+ return 0
if __name__ == '__main__':
- sys.exit(main())
+ sys.exit(main())
diff --git a/third_party/mojo/src/mojo/public/tools/dart_snapshotter.py b/third_party/mojo/src/mojo/public/tools/dart_snapshotter.py
new file mode 100755
index 0000000..5727fd0
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/tools/dart_snapshotter.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import argparse
+import subprocess
+import sys
+import os
+
+def main():
+ parser = argparse.ArgumentParser(description='Snapshots Mojo applications')
+ parser.add_argument('executable', type=str)
+ parser.add_argument('main', type=str)
+ parser.add_argument('--package-root', type=str)
+ parser.add_argument('--snapshot', type=str)
+
+ args = parser.parse_args()
+ if not os.path.isfile(args.executable):
+ print "file not found: " + args.executable
+ return subprocess.check_call([
+ args.executable,
+ args.main,
+ '--package-root=%s' % args.package_root,
+ '--snapshot=%s' % args.snapshot,
+ ])
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/third_party/mojo/src/mojo/public/tools/dartx.py b/third_party/mojo/src/mojo/public/tools/dartx.py
new file mode 100755
index 0000000..0ca84e9
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/tools/dartx.py
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Creates a dartx archive.
+"""
+
+import argparse
+import os
+import sys
+import zipfile
+
+def main():
+ parser = argparse.ArgumentParser(description='dartx packager.')
+ parser.add_argument('--snapshot',
+ help='Snapshot file.',
+ type=str)
+ parser.add_argument('--output',
+ help='Path to output archive.',
+ type=str)
+ arguments = parser.parse_args()
+
+ snapshot = arguments.snapshot
+ output = arguments.output
+
+ with zipfile.ZipFile(output, 'w', zipfile.ZIP_DEFLATED) as outfile:
+ outfile.write(snapshot, 'snapshot_blob.bin')
+
+ return 0
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/third_party/mojo/src/mojo/public/tools/download_dart_snapshotter.py b/third_party/mojo/src/mojo/public/tools/download_dart_snapshotter.py
new file mode 100755
index 0000000..0227c68
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/tools/download_dart_snapshotter.py
@@ -0,0 +1,101 @@
+#!/usr/bin/env python
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import argparse
+import os
+import subprocess
+import sys
+import tempfile
+import zipfile
+
+BINARY_FOR_PLATFORM = {
+ "linux-x64" : "dart_snapshotter",
+ "mac-x64": "dart_snapshotter",
+}
+
+CURRENT_PATH = os.path.dirname(os.path.realpath(__file__))
+sys.path.insert(0, os.path.join(CURRENT_PATH, "pylib"))
+import gs
+
+PREBUILT_FILE_PATH = os.path.join(CURRENT_PATH, "prebuilt", "dart_snapshotter")
+
+
+def download(tools_directory, version_file):
+ stamp_path = os.path.join(PREBUILT_FILE_PATH, "VERSION")
+
+ version_path = os.path.join(CURRENT_PATH, version_file)
+ with open(version_path) as version_file:
+ version = version_file.read().strip()
+
+ try:
+ with open(stamp_path) as stamp_file:
+ current_version = stamp_file.read().strip()
+ if current_version == version:
+ return 0 # Already have the right version.
+ except IOError:
+ pass # If the stamp file does not exist we need to download new binaries.
+
+ if sys.platform.startswith("linux"):
+ platforms = ["linux-x64"]
+ elif sys.platform.startswith("darwin"):
+ platforms = ["mac-x64"]
+ else:
+ print "No prebuilt dart_snapshotter available for %s" % sys.platform
+ return 0
+
+ for platform in platforms:
+ download_version_for_platform(version, platform, tools_directory)
+
+ with open(stamp_path, 'w') as stamp_file:
+ stamp_file.write(version)
+ return 0
+
+def download_version_for_platform(version, platform, tools_directory):
+ find_depot_tools_path = os.path.join(CURRENT_PATH, tools_directory)
+ sys.path.insert(0, find_depot_tools_path)
+ # pylint: disable=F0401
+ import find_depot_tools
+ depot_tools_path = find_depot_tools.add_depot_tools_to_path()
+
+ basename = platform + ".zip"
+ gs_path = "gs://mojo/dart_snapshotter/" + version + "/" + basename
+
+ with tempfile.NamedTemporaryFile() as temp_zip_file:
+ gs.download_from_public_bucket(gs_path, temp_zip_file.name,
+ depot_tools_path)
+ binary_name = BINARY_FOR_PLATFORM[platform]
+ output_dir = os.path.join(PREBUILT_FILE_PATH, platform)
+ with zipfile.ZipFile(temp_zip_file.name) as z:
+ zi = z.getinfo(binary_name)
+ mode = zi.external_attr >> 16
+ z.extract(zi, output_dir)
+ os.chmod(os.path.join(output_dir, binary_name), mode)
+
+
+def main():
+ parser = argparse.ArgumentParser(
+ description="Download dart_snapshotter binaries from google storage")
+ parser.add_argument("--tools-directory",
+ dest="tools_directory",
+ metavar="<tools-directory>",
+ type=str,
+ required=True,
+ help="Path to the directory containing "
+ "find_depot_tools.py, specified as a relative path "
+ "from the location of this file.")
+ parser.add_argument("--version-file",
+ dest="version_file",
+ metavar="<version-file>",
+ type=str,
+ default="../VERSION",
+ help="Path to the file containing the version of the "
+ "dart_snapshotter to be fetched, specified as a"
+ "relative path from the location of this file "
+ "(default: %(default)s).")
+ args = parser.parse_args()
+ return download(args.tools_directory, args.version_file)
+
+if __name__ == "__main__":
+ sys.exit(main())