text:
<?php

require_once __DIR__.'/../vendor/autoload.php';

$loop = React\EventLoop\Factory::create();

$address = 'localhost:1337';

$factory = new Socket\React\Datagram\Factory($loop);

$factory->createClient($address)->then(function (Socket\React\Datagram\Socket $socket) use ($loop, $address) {
    var_dump('Client socket connected to ' . $address . ' created');

    var_dump('Sending "test"');
    $socket->send('test');

    $socket->on('message', function($data, $peer) {
        var_dump('Received', $data, 'from', $peer);
        echo PHP_EOL;
    });
    $socket->on('close', function() {
        var_dump('Connection closed');
    });
    $socket->on('error', function($error) {
        var_dump('Error');
        echo $error;
    });

    var_dump('Reading and forwarding everything from STDIN');
    $loop->addReadStream(STDIN, function() use ($socket) {
        $line = trim(fgets(STDIN,8192));
        var_dump('Sending input', $line);
        $socket->send($line);
        echo PHP_EOL;
    });

    // send tick message every 2 seconds
//    $loop->addPeriodicTimer(2.0, function () use ($socket) {
//         $socket->send('tick');
//     });

}, function(Exception $e) {
    var_dump('Creation failed: ', $e->getMessage());
    echo $e;
});

$loop->run();


text:
'use strict';

angular.module('mean.users')

.factory('MeanUser', [

  function() {
    return {
      name: 'users'
    };
  }
])

// Factory to retrieve tree images
.factory('TreeImage', ['$http',
  function($http, $stateParams) {
    var imageStore = {};

    var loadTreeImage = function(treeId, cb) {
      if (imageStore[treeId]){
        cb(imageStore[treeId]);
      } else {
        $http.get('/treeimage/'+treeId)
        .success(function(url){
          imageStore[treeId] = url;
          cb(url);
        })
        .error(function(){
          console.log('Error getting tree image URL');
        });
      }
    };

    return  {
        loadTreeImage: loadTreeImage,
      };
  }
])

.factory('UserLikes', ['$http',
  function($http) {

    var getLikes = function(username, cb){
      var treeLikes = [];
      $http.post('/userlikes', {username: username})
      .success(function(data){
        data.forEach(function(treeLike){
          console.log(treeLike);
          if (treeLikes.indexOf(treeLike.name) === -1){
            treeLikes.push({
              name: treeLike.name,
              id:  treeLike.treeid,
              imgUrl: treeLike.url
            });
          }
        });
        cb(treeLikes);
      })
      .error(function(error){
        console.log('error getting userlikes');
      });
    };

    return {
      getLikes: getLikes,
    };
  }
])

/**
 * GetUserMessages factory to handle the routing to the server for getting user messages
 */
.factory('GetUserMessages', ['$resource', '$stateParams',
  function($resource, $stateParams) {
    return $resource('usermessages/:username', {
      treeid: '@_username'
    }, {
      get: {
        method: 'GET',
        isArray: true
      }
    });
  }
])

.factory('UserInfo', ['$http',
  function($http) {
    var get = function (username) {
      return $http({
        url: '/users/' + username,
        method: 'GET'
      });
    };

    var post = function (username, status) {
      return $http({
        url: '/users/' + username + '/status/',
        method:'POST',
        data: {status: status}
      });
    };

    return {
      get: get,
      post: post
    };
  }
]);

redpajama_set_name: RedPajamaGithub


text:
/**
 *
 * @creatTime 上午10:29:46
 * @author XuYi
 */
package org.eddy.datasource;

import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map.Entry;

import org.apache.hadoop.hbase.util.Bytes;
import org.eddy.exception.HbaseException;
import org.eddy.execute.Executable;

/**
 * @author XuYi
 *
 */
public class HandleExceute {

	/**
	 * 执行函数
	 * @param executable
	 * @param connection
	 * @return
	 * @creatTime 上午11:52:45
	 * @author XuYi
	 */
	protected Object excute(Executable executable, HbaseConnection connection) {
		try {
			return executable.execute(connection);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			throw new HbaseException("执行时I/O读写异常", e);
		}
	}

	/**
	 * 获取唯一值
	 * @param list
	 * @return
	 * @creatTime 上午11:52:55
	 * @author XuYi
	 */
	protected LinkedHashMap<String, byte[]> returnOneElementFromCollection(List<LinkedHashMap<String, byte[]>> list) {
		if (list == null || list.size() != 1) {
			throw new HbaseException("返回集合值不为1 result: " + list);
		}
		return list.get(0);
	}

	/**
	 * 将字节map转成字符串map
	 * @param map
	 * @return
	 * @creatTime 下午1:48:45
	 * @author XuYi
	 */
	protected LinkedHashMap<String, String> byteMap2StringMap(LinkedHashMap<String, byte[]> map) {
		LinkedHashMap<String, String> result = new LinkedHashMap<String, String>();
		for (Entry<String, byte[]> entry : map.entrySet()) {
			result.put(entry.getKey(), Bytes.toString(entry.getValue()));
		}
		return result;
	}
}


text:
from abc import abstractproperty

from jedi._compatibility import is_py3
from jedi import debug
from jedi.evaluate import compiled
from jedi.evaluate import filters
from jedi.evaluate.base_context import Context, NO_CONTEXTS, ContextSet, \
    iterator_to_context_set
from jedi.evaluate.lazy_context import LazyKnownContext, LazyKnownContexts
from jedi.evaluate.cache import evaluator_method_cache
from jedi.evaluate.arguments import AbstractArguments, AnonymousArguments
from jedi.cache import memoize_method
from jedi.evaluate.context.function import FunctionExecutionContext, FunctionContext
from jedi.evaluate.context.klass import ClassContext, apply_py__get__
from jedi.evaluate.context import iterable
from jedi.parser_utils import get_parent_scope

class InstanceFunctionExecution(FunctionExecutionContext):
    def __init__(self, instance, parent_context, function_context, var_args):
        self.instance = instance
        var_args = InstanceVarArgs(self, var_args)

        super(InstanceFunctionExecution, self).__init__(
            instance.evaluator, parent_context, function_context, var_args)

class AnonymousInstanceFunctionExecution(FunctionExecutionContext):
    function_execution_filter = filters.AnonymousInstanceFunctionExecutionFilter

    def __init__(self, instance, parent_context, function_context, var_args):
        self.instance = instance
        super(AnonymousInstanceFunctionExecution, self).__init__(
            instance.evaluator, parent_context, function_context, var_args)

class AbstractInstanceContext(Context):
    """
    This class is used to evaluate instances.
    """
    api_type = 'instance'
    function_execution_cls = InstanceFunctionExecution

    def __init__(self, evaluator, parent_context, class_context, var_args):
        super(AbstractInstanceContext, self).__init__(evaluator, parent_context)
        # Generated instances are classes that are just generated by self
        # (No var_args) used.
        self.class_context = class_context
        self.var_args = var_args

    def is_class(self):
        return False

    @property
    def py__call__(self):
        names = self.get_function_slot_names('__call__')
        if not names:
            # Means the Instance is not callable.
            raise AttributeError

        def execute(arguments):
            return ContextSet.from_sets(name.execute(arguments) for name in names)

        return execute

    def py__class__(self):
        return self.class_context

    def py__bool__(self):
        # Signalize that we don't know about the bool type.
        return None

    def get_function_slot_names(self, name):
        # Python classes don't look at the dictionary of the instance when
        # looking up `__call__`. This is something that has to do with Python's
        # internal slot system (note: not __slots__, but C slots).
        for filter in self.get_filters(include_self_names=False):
            names = filter.get(name)
            if names:
                return names
        return []

    def execute_function_slots(self, names, *evaluated_args):
        return ContextSet.from_sets(
            name.execute_evaluated(*evaluated_args)
            for name in names
        )

    def py__get__(self, obj):
        # Arguments in __get__ descriptors are obj, class.
        # `method` is the new parent of the array, don't know if that's good.
        names = self.get_function_slot_names('__get__')
        if names:
            if isinstance(obj, AbstractInstanceContext):
                return self.execute_function_slots(names, obj, obj.class_context)
            else:
                none_obj = compiled.create(self.evaluator, None)
                return self.execute_function_slots(names, none_obj, obj)
        else:
            return ContextSet(self)

    def get_filters(self, search_global=None, until_position=None,
                    origin_scope=None, include_self_names=True):
        if include_self_names:
            for cls in self.class_context.py__mro__():
                if isinstance(cls, compiled.CompiledObject):
                    if cls.tree_node is not None:
                        # In this case we're talking about a fake object, it
                        # doesn't make sense for normal compiled objects to
                        # search for self variables.
                        yield SelfNameFilter(self.evaluator, self, cls, origin_scope)
                else:
                    yield SelfNameFilter(self.evaluator, self, cls, origin_scope)

        for cls in self.class_context.py__mro__():
            if isinstance(cls, compiled.CompiledObject):
                yield CompiledInstanceClassFilter(self.evaluator, self, cls)
            else:
                yield InstanceClassFilter(self.evaluator, self, cls, origin_scope)

    def py__getitem__(self, index):
        try:
            names = self.get_function_slot_names('__getitem__')
        except KeyError:
            debug.warning('No __getitem__, cannot access the array.')
            return NO_CONTEXTS
        else:
            index_obj = compiled.create(self.evaluator, index)
            return self.execute_function_slots(names, index_obj)

    def py__iter__(self):
        iter_slot_names = self.get_function_slot_names('__iter__')
        if not iter_slot_names:
            debug.warning('No __iter__ on %s.' % self)
            return

        for generator in self.execute_function_slots(iter_slot_names):
            if isinstance(generator, AbstractInstanceContext):
                # `__next__` logic.
                name = '__next__' if is_py3 else 'next'
                iter_slot_names = generator.get_function_slot_names(name)
                if iter_slot_names:
                    yield LazyKnownContexts(
                        generator.execute_function_slots(iter_slot_names)
                    )
                else:
                    debug.warning('Instance has no __next__ function in %s.', generator)
            else:
                for lazy_context in generator.py__iter__():
                    yield lazy_context

    @abstractproperty
    def name(self):
        pass

    def _create_init_execution(self, class_context, func_node):
        bound_method = BoundMethod(
            self.evaluator, self, class_context, self.parent_context, func_node
        )
        return self.function_execution_cls(
            self,
            class_context.parent_context,
            bound_method,
            self.var_args
        )

    def create_init_executions(self):
        for name in self.get_function_slot_names('__init__'):
            if isinstance(name, LazyInstanceName):
                yield self._create_init_execution(name.class_context, name.tree_name.parent)

    @evaluator_method_cache()
    def create_instance_context(self, class_context, node):
        if node.parent.type in ('funcdef', 'classdef'):
            node = node.parent
        scope = get_parent_scope(node)
        if scope == class_context.tree_node:
            return class_context
        else:
            parent_context = self.create_instance_context(class_context, scope)
            if scope.type == 'funcdef':
                if scope.name.value == '__init__' and parent_context == class_context:
                    return self._create_init_execution(class_context, scope)
                else:
                    bound_method = BoundMethod(
                        self.evaluator, self, class_context,
                        parent_context, scope
                    )
                    return bound_method.get_function_execution()
            elif scope.type == 'classdef':
                class_context = ClassContext(self.evaluator, scope, parent_context)
                return class_context
            elif scope.type == 'comp_for':
                # Comprehensions currently don't have a special scope in Jedi.
                return self.create_instance_context(class_context, scope)
            else:
                raise NotImplementedError
        return class_context

    def __repr__(self):
        return "<%s of %s(%s)>" % (self.__class__.__name__, self.class_context,
                                   self.var_args)

class CompiledInstance(AbstractInstanceContext):
    def __init__(self, *args, **kwargs):
        super(CompiledInstance, self).__init__(*args, **kwargs)
        # I don't think that dynamic append lookups should happen here. That
        # sounds more like something that should go to py__iter__.
        if self.class_context.name.string_name in ['list', 'set'] \
                and self.parent_context.get_root_context() == self.evaluator.BUILTINS:
            # compare the module path with the builtin name.
            self.var_args = iterable.get_dynamic_array_instance(self)

    @property
    def name(self):
        return compiled.CompiledContextName(self, self.class_context.name.string_name)

    def create_instance_context(self, class_context, node):
        if get_parent_scope(node).type == 'classdef':
            return class_context
        else:
            return super(CompiledInstance, self).create_instance_context(class_context, node)

class TreeInstance(AbstractInstanceContext):
    def __init__(self, evaluator, parent_context, class_context, var_args):
        super(TreeInstance, self).__init__(evaluator, parent_context,
                                           class_context, var_args)
        self.tree_node = class_context.tree_node

    @property
    def name(self):
        return filters.ContextName(self, self.class_context.name.tree_name)

class AnonymousInstance(TreeInstance):
    function_execution_cls = AnonymousInstanceFunctionExecution

    def __init__(self, evaluator, parent_context, class_context):
        super(AnonymousInstance, self).__init__(
            evaluator,
            parent_context,
            class_context,
            var_args=AnonymousArguments(),
        )

class CompiledInstanceName(compiled.CompiledName):
    def __init__(self, evaluator, instance, parent_context, name):
        super(CompiledInstanceName, self).__init__(evaluator, parent_context, name)
        self._instance = instance

    @iterator_to_context_set
    def infer(self):
        for result_context in super(CompiledInstanceName, self).infer():
            if isinstance(result_context, FunctionContext):
                parent_context = result_context.parent_context
                while parent_context.is_class():
                    parent_context = parent_context.parent_context

                yield BoundMethod(
                    result_context.evaluator, self._instance, self.parent_context,
                    parent_context, result_context.tree_node
                )
            else:
                if result_context.api_type == 'function':
                    yield CompiledBoundMethod(result_context)
                else:
                    yield result_context

class CompiledInstanceClassFilter(compiled.CompiledObjectFilter):
    name_class = CompiledInstanceName

    def __init__(self, evaluator, instance, compiled_object):
        super(CompiledInstanceClassFilter, self).__init__(
            evaluator,
            compiled_object,
            is_instance=True,
        )
        self._instance = instance

    def _create_name(self, name):
        return self.name_class(
            self._evaluator, self._instance, self._compiled_object, name)

class BoundMethod(FunctionContext):
    def __init__(self, evaluator, instance, class_context, *args, **kwargs):
        super(BoundMethod, self).__init__(evaluator, *args, **kwargs)
        self._instance = instance
        self._class_context = class_context

    def get_function_execution(self, arguments=None):
        if arguments is None:
            arguments = AnonymousArguments()
            return AnonymousInstanceFunctionExecution(
                self._instance, self.parent_context, self, arguments)
        else:
            return InstanceFunctionExecution(
                self._instance, self.parent_context, self, arguments)

class CompiledBoundMethod(compiled.CompiledObject):
    def __init__(self, func):
        super(CompiledBoundMethod, self).__init__(
            func.evaluator, func.obj, func.parent_context, func.tree_node)

    def get_param_names(self):
        return list(super(CompiledBoundMethod, self).get_param_names())[1:]

class InstanceNameDefinition(filters.TreeNameDefinition):
    def infer(self):
        return super(InstanceNameDefinition, self).infer()

class LazyInstanceName(filters.TreeNameDefinition):
    """
    This name calculates the parent_context lazily.
    """
    def __init__(self, instance, class_context, tree_name):
        self._instance = instance
        self.class_context = class_context
        self.tree_name = tree_name

    @property
    def parent_context(self):
        return self._instance.create_instance_context(self.class_context, self.tree_name)

class LazyInstanceClassName(LazyInstanceName):
    @iterator_to_context_set
    def infer(self):
        for result_context in super(LazyInstanceClassName, self).infer():
            if isinstance(result_context, FunctionContext):
                # Classes are never used to resolve anything within the
                # functions. Only other functions and modules will resolve
                # those things.
                parent_context = result_context.parent_context
                while parent_context.is_class():
                    parent_context = parent_context.parent_context

                yield BoundMethod(
                    result_context.evaluator, self._instance, self.class_context,
                    parent_context, result_context.tree_node
                )
            else:
                for c in apply_py__get__(result_context, self._instance):
                    yield c

class InstanceClassFilter(filters.ParserTreeFilter):
    name_class = LazyInstanceClassName

    def __init__(self, evaluator, context, class_context, origin_scope):
        super(InstanceClassFilter, self).__init__(
            evaluator=evaluator,
            context=context,
            node_context=class_context,
            origin_scope=origin_scope
        )
        self._class_context = class_context

    def _equals_origin_scope(self):
        node = self._origin_scope
        while node is not None:
            if node == self._parser_scope or node == self.context:
                return True
            node = get_parent_scope(node)
        return False

    def _access_possible(self, name):
        return not name.value.startswith('__') or name.value.endswith('__') \
            or self._equals_origin_scope()

    def _filter(self, names):
        names = super(InstanceClassFilter, self)._filter(names)
        return [name for name in names if self._access_possible(name)]

    def _convert_names(self, names):
        return [self.name_class(self.context, self._class_context, name) for name in names]

class SelfNameFilter(InstanceClassFilter):
    name_class = LazyInstanceName

    def _filter(self, names):
        names = self._filter_self_names(names)
        if isinstance(self._parser_scope, compiled.CompiledObject) and False:
            # This would be for builtin skeletons, which are not yet supported.
            return list(names)
        else:
            start, end = self._parser_scope.start_pos, self._parser_scope.end_pos
            return [n for n in names if start < n.start_pos < end]

    def _filter_self_names(self, names):
        for name in names:
            trailer = name.parent
            if trailer.type == 'trailer' \
                    and len(trailer.children) == 2 \
                    and trailer.children[0] == '.':
                if name.is_definition() and self._access_possible(name):
                    yield name

    def _check_flows(self, names):
        return names

class InstanceVarArgs(AbstractArguments):
    def __init__(self, execution_context, var_args):
        self._execution_context = execution_context
        self._var_args = var_args

    @memoize_method
    def _get_var_args(self):
        return self._var_args

    @property
    def argument_node(self):
        return self._var_args.argument_node

    @property
    def trailer(self):
        return self._var_args.trailer

    def unpack(self, func=None):
        yield None, LazyKnownContext(self._execution_context.instance)
        for values in self._get_var_args().unpack(func):
            yield values

    def get_calling_nodes(self):
        return self._get_var_args().get_calling_nodes()


text:
/*
* ucs2be_verifier.h
*
* In this file, the interface of UCS2BE Verifier is implemented.
*
*/

#ifndef _UCS2BE_VERIFIER_H_
#define _UCS2BE_VERIFIER_H_

#include "i_charset_verifier.h"

class CUCS2BEVerifier :
	public ICharsetVerifier
{
public:
	CUCS2BEVerifier();

	virtual	~CUCS2BEVerifier();

	virtual	long	Init();

public:
	virtual ECodepageType	Charset();

	virtual bool	IsUCS2();
};

#endif //_UCS2BE_VERIFIER_H_


text:
import React, { PureComponent } from 'react';
import { func, number, object } from 'prop-types';
import {
  calculateInitialState,
  calculateNextState,
  calculateNumericValue,
  renderChildOfType,
} from './Utils';
import { COARSE_INCREMENT_CLS } from './Constants';

export default class CoarseIncrement extends PureComponent {
  static displayName = 'CoarseIncrement';

  static propTypes = {
    _onChange: func,
    _value: number,
    max: number,
    min: number,
    step: number,
    style: object,
    valueStyle: object,
  }

  static defaultProps = {
    _onChange: () => {},
    _value: 0,
    max: Number.MAX_SAFE_INTEGER,
    min: Number.MIN_SAFE_INTEGER,
    step: 1,
    style: {},
    valueStyle: {},
  }

  constructor(props) {
    super(props);
    this.state = {
      style: {},
      value: null,
    };
  }

  componentWillMount() {
    this.setState(calculateInitialState.call(this, diffProps));
  }

  componentWillReceiveProps(nextProps) {
    const nextState = calculateNextState.call(this, nextProps, diffProps);
    if (Object.keys(nextState).length) {
      this.setState(nextState);
    }
  }

  componentWillUpdate(nextProps, nextState) {
    const { value } = this.state;
    if (value !== nextState.value && nextState.value !== nextProps._value) {
      nextProps._onChange(nextState.value);
    }
  }

  onMinusIconClick = () => {
    this.setState((state, props) => {
      const newValue = state.value - props.step;
      return {
        value: newValue >= props.min ? newValue : state.value,
      };
    });
  }

  onPlusIconClick = () => {
    this.setState((state, props) => {
      const newValue = state.value + props.step;
      return {
        value: newValue <= props.max ? newValue : state.value,
      };
    });
  }

  calculateStyle({ style }) {
    return { ...styles.coarse, ...style };
  }

  calculateValue({ _value, max, min }) {
    return calculateNumericValue(_value, max, min);
  }

  renderMinusIcon() {
    return renderChildOfType.call(this, 'MinusIcon', {
      _onClick: this.onMinusIconClick,
    });
  }

  renderPlusIcon() {
    return renderChildOfType.call(this, 'PlusIcon', {
      _onClick: this.onPlusIconClick,
    });
  }

  render() {
    const { valueStyle } = this.props;
    const { style, value } = this.state;
    return (

        {this.renderMinusIcon()}
        <span
          className={`${COARSE_INCREMENT_CLS}_value`}
          style={valueStyle}
        >{value}
        {this.renderPlusIcon()}

    );
  }
}

const diffProps = {
  value: ['_value'],
  style: ['style'],
};

const styles = {
  coarse: {
    display: 'flex',
    flexDirection: 'row',
    alignItems: 'center',
    cursor: 'default',
  },
};


text:
"""Split nose/nose2 xunit xml to multiple xmls"""

import argparse
import os.path
import xml.etree.ElementTree as ET

def write_suite(suite, outpath):
    """write individual testsuite XML"""
    filename = 'TEST-' + suite.attrib['name'] + '.xml'
    full_path = os.path.join(outpath, filename)
    ET.ElementTree(suite).write(full_path, xml_declaration=True, encoding='utf-8')

def main():
    parser = argparse.ArgumentParser(description='split xunit xml')
    parser.add_argument('infile', help='xunit xml from nose or nose2')
    args = parser.parse_args()

    # write to same location as infile
    outpath = os.path.dirname(args.infile)
    tree = ET.parse(args.infile)
    input_suite = tree.getroot()

    prev_suite_name = ''
    suite = None
    for test_case in input_suite:
        suite_name = '.'.join(test_case.attrib['classname'].split('.')[1:])

        if prev_suite_name != suite_name:
            # first testcase
            if suite is not None:
                write_suite(suite, outpath)
            suite = ET.Element('testsuite', attrib={'name': suite_name, 'tests': '0', 'failures': '0',
                                                    'errors': '0', 'skipped': '0', 'time': '0.0'})

        suite.append(test_case)
        suite.attrib['tests'] = str(int(suite.attrib['tests']) + 1)
        suite.attrib['time'] = str(float(suite.attrib['time']) + float(test_case.attrib['time']))
        if len(test_case):
            if test_case[0].tag == 'failure':
                suite.attrib['failures'] = str(int(suite.attrib['failures']) + 1)
            if test_case[0].tag == 'error':
                suite.attrib['errors'] = str(int(suite.attrib['errors']) + 1)
            if test_case[0].tag == 'skipped':
                suite.attrib['skipped'] = str(int(suite.attrib['skipped']) + 1)

        prev_suite_name = suite_name

    # write last testsuite
    if suite is not None:
        write_suite(suite, outpath)

if __name__ == "__main__":
    main()


text:
static DWORD currentTLS = TLS_OUT_OF_INDEXES;

extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
{
    switch (reason)
    {
      case DLL_PROCESS_ATTACH:
        {
            currentTLS = TlsAlloc();

            if (currentTLS == TLS_OUT_OF_INDEXES)
            {
                return FALSE;
            }
        }
        // Fall throught to initialize index
      case DLL_THREAD_ATTACH:
        {
            gl::Current *current = (gl::Current*)LocalAlloc(LPTR, sizeof(gl::Current));

            if (current)
            {
                TlsSetValue(currentTLS, current);

                current->context = NULL;
                current->display = NULL;
            }
        }
        break;
      case DLL_THREAD_DETACH:
        {
            void *current = TlsGetValue(currentTLS);

            if (current)
            {
                LocalFree((HLOCAL)current);
            }
        }
        break;
      case DLL_PROCESS_DETACH:
        {
            void *current = TlsGetValue(currentTLS);

            if (current)
            {
                LocalFree((HLOCAL)current);
            }

            TlsFree(currentTLS);
        }
        break;
      default:
        break;
    }

    return TRUE;
}

#endif // !QT_OPENGL_ES_2_ANGLE_STATIC

namespace gl
{
Current *getCurrent()
{
#ifndef QT_OPENGL_ES_2_ANGLE_STATIC
    return (Current*)TlsGetValue(currentTLS);
#else
    // No precautions for thread safety taken as ANGLE is used single-threaded in Qt.
    static gl::Current curr = { 0, 0 };
    return &curr;
#endif
}

void makeCurrent(Context *context, egl::Display *display, egl::Surface *surface)
{
    Current *current = getCurrent();

    current->context = context;
    current->display = display;

    if (context && display && surface)
    {
        context->makeCurrent(surface);
    }
}

Context *getContext()
{
    Current *current = getCurrent();

    return current->context;
}

Context *getNonLostContext()
{
    Context *context = getContext();

    if (context)
    {
        if (context->isContextLost())
        {
            gl::error(GL_OUT_OF_MEMORY);
            return NULL;
        }
        else
        {
            return context;
        }
    }
    return NULL;
}

egl::Display *getDisplay()
{
    Current *current = getCurrent();

    return current->display;
}

// Records an error code
void error(GLenum errorCode)
{
    gl::Context *context = glGetCurrentContext();

    if (context)
    {
        switch (errorCode)
        {
          case GL_INVALID_ENUM:
            context->recordInvalidEnum();
            TRACE("\t! Error generated: invalid enum\n");
            break;
          case GL_INVALID_VALUE:
            context->recordInvalidValue();
            TRACE("\t! Error generated: invalid value\n");
            break;
          case GL_INVALID_OPERATION:
            context->recordInvalidOperation();
            TRACE("\t! Error generated: invalid operation\n");
            break;
          case GL_OUT_OF_MEMORY:
            context->recordOutOfMemory();
            TRACE("\t! Error generated: out of memory\n");
            break;
          case GL_INVALID_FRAMEBUFFER_OPERATION:
            context->recordInvalidFramebufferOperation();
            TRACE("\t! Error generated: invalid framebuffer operation\n");
            break;
          default: UNREACHABLE();
        }
    }
}

}


text:
class OverridesProvider {
 public:
  OverridesProvider();
  virtual ~OverridesProvider();

  virtual void InstallOverrides();
};

#endif  // IOS_PUBLIC_PROVIDER_CHROME_BROWSER_OVERRIDES_PROVIDER_H_