diff
stringlengths 41
2.03M
| msg
stringlengths 1
1.5k
⌀ | repo
stringlengths 5
40
| sha
stringlengths 40
40
| time
stringlengths 20
20
|
---|---|---|---|---|
mmm a / src / Makefile . am <nl> ppp b / src / Makefile . am <nl> crypto_libbitcoin_crypto_base_a_SOURCES = \ <nl> crypto / chacha20 . h \ <nl> crypto / chacha20 . cpp \ <nl> crypto / common . h \ <nl> + crypto / hkdf_sha256_32 . cpp \ <nl> + crypto / hkdf_sha256_32 . h \ <nl> crypto / hmac_sha256 . cpp \ <nl> crypto / hmac_sha256 . h \ <nl> crypto / hmac_sha512 . cpp \ <nl> new file mode 100644 <nl> index 000000000000 . . 9cea5995eca9 <nl> mmm / dev / null <nl> ppp b / src / crypto / hkdf_sha256_32 . cpp <nl> <nl> + / / Copyright ( c ) 2018 The Bitcoin Core developers <nl> + / / Distributed under the MIT software license , see the accompanying <nl> + / / file COPYING or http : / / www . opensource . org / licenses / mit - license . php . <nl> + <nl> + # include < crypto / hkdf_sha256_32 . h > <nl> + <nl> + # include < assert . h > <nl> + # include < string . h > <nl> + <nl> + CHKDF_HMAC_SHA256_L32 : : CHKDF_HMAC_SHA256_L32 ( const unsigned char * ikm , size_t ikmlen , const std : : string & salt ) <nl> + { <nl> + CHMAC_SHA256 ( ( const unsigned char * ) salt . c_str ( ) , salt . size ( ) ) . Write ( ikm , ikmlen ) . Finalize ( m_prk ) ; <nl> + } <nl> + <nl> + void CHKDF_HMAC_SHA256_L32 : : Expand32 ( const std : : string & info , unsigned char hash [ OUTPUT_SIZE ] ) <nl> + { <nl> + / / expand a 32byte key ( single round ) <nl> + assert ( info . size ( ) < = 128 ) ; <nl> + static const unsigned char one [ 1 ] = { 1 } ; <nl> + CHMAC_SHA256 ( m_prk , 32 ) . Write ( ( const unsigned char * ) info . data ( ) , info . size ( ) ) . Write ( one , 1 ) . Finalize ( hash ) ; <nl> + } <nl> new file mode 100644 <nl> index 000000000000 . . fa1e42aec164 <nl> mmm / dev / null <nl> ppp b / src / crypto / hkdf_sha256_32 . h <nl> <nl> + / / Copyright ( c ) 2018 The Bitcoin Core developers <nl> + / / Distributed under the MIT software license , see the accompanying <nl> + / / file COPYING or http : / / www . opensource . org / licenses / mit - license . php . <nl> + <nl> + # ifndef BITCOIN_CRYPTO_HKDF_SHA256_32_H <nl> + # define BITCOIN_CRYPTO_HKDF_SHA256_32_H <nl> + <nl> + # include < crypto / hmac_sha256 . h > <nl> + <nl> + # include < stdint . h > <nl> + # include < stdlib . h > <nl> + <nl> + / * * A rfc5869 HKDF implementation with HMAC_SHA256 and fixed key output length of 32 bytes ( L = 32 ) * / <nl> + class CHKDF_HMAC_SHA256_L32 <nl> + { <nl> + private : <nl> + unsigned char m_prk [ 32 ] ; <nl> + static const size_t OUTPUT_SIZE = 32 ; <nl> + <nl> + public : <nl> + CHKDF_HMAC_SHA256_L32 ( const unsigned char * ikm , size_t ikmlen , const std : : string & salt ) ; <nl> + void Expand32 ( const std : : string & info , unsigned char hash [ OUTPUT_SIZE ] ) ; <nl> + } ; <nl> + <nl> + # endif / / BITCOIN_CRYPTO_HKDF_SHA256_32_H <nl> mmm a / src / key . cpp <nl> ppp b / src / key . cpp <nl> void CKey : : MakeNewKey ( bool fCompressedIn ) { <nl> fCompressed = fCompressedIn ; <nl> } <nl> <nl> + bool CKey : : Negate ( ) <nl> + { <nl> + assert ( fValid ) ; <nl> + return secp256k1_ec_privkey_negate ( secp256k1_context_sign , keydata . data ( ) ) ; <nl> + } <nl> + <nl> CPrivKey CKey : : GetPrivKey ( ) const { <nl> assert ( fValid ) ; <nl> CPrivKey privkey ; <nl> mmm a / src / key . h <nl> ppp b / src / key . h <nl> class CKey <nl> / / ! Generate a new private key using a cryptographic PRNG . <nl> void MakeNewKey ( bool fCompressed ) ; <nl> <nl> + / / ! Negate private key <nl> + bool Negate ( ) ; <nl> + <nl> / * * <nl> * Convert the private key to a CPrivKey ( serialized OpenSSL private key data ) . <nl> * This is expensive . <nl> mmm a / src / test / crypto_tests . cpp <nl> ppp b / src / test / crypto_tests . cpp <nl> <nl> # include < crypto / aes . h > <nl> # include < crypto / chacha20 . h > <nl> # include < crypto / poly1305 . h > <nl> + # include < crypto / hkdf_sha256_32 . h > <nl> + # include < crypto / hmac_sha256 . h > <nl> + # include < crypto / hmac_sha512 . h > <nl> # include < crypto / ripemd160 . h > <nl> # include < crypto / sha1 . h > <nl> # include < crypto / sha256 . h > <nl> # include < crypto / sha512 . h > <nl> - # include < crypto / hmac_sha256 . h > <nl> - # include < crypto / hmac_sha512 . h > <nl> # include < random . h > <nl> # include < util / strencodings . h > <nl> # include < test / setup_common . h > <nl> static void TestPoly1305 ( const std : : string & hexmessage , const std : : string & hexke <nl> BOOST_CHECK ( tag = = tagres ) ; <nl> } <nl> <nl> + static void TestHKDF_SHA256_32 ( const std : : string & ikm_hex , const std : : string & salt_hex , const std : : string & info_hex , const std : : string & okm_check_hex ) { <nl> + std : : vector < unsigned char > initial_key_material = ParseHex ( ikm_hex ) ; <nl> + std : : vector < unsigned char > salt = ParseHex ( salt_hex ) ; <nl> + std : : vector < unsigned char > info = ParseHex ( info_hex ) ; <nl> + <nl> + <nl> + / / our implementation only supports strings for the " info " and " salt " , stringify them <nl> + std : : string salt_stringified ( reinterpret_cast < char * > ( salt . data ( ) ) , salt . size ( ) ) ; <nl> + std : : string info_stringified ( reinterpret_cast < char * > ( info . data ( ) ) , info . size ( ) ) ; <nl> + <nl> + CHKDF_HMAC_SHA256_L32 hkdf32 ( initial_key_material . data ( ) , initial_key_material . size ( ) , salt_stringified ) ; <nl> + unsigned char out [ 32 ] ; <nl> + hkdf32 . Expand32 ( info_stringified , out ) ; <nl> + BOOST_CHECK ( HexStr ( out , out + 32 ) = = okm_check_hex ) ; <nl> + } <nl> + <nl> static std : : string LongTestString ( ) { <nl> std : : string ret ; <nl> for ( int i = 0 ; i < 200000 ; i + + ) { <nl> BOOST_AUTO_TEST_CASE ( poly1305_testvector ) <nl> " 13000000000000000000000000000000 " ) ; <nl> } <nl> <nl> + BOOST_AUTO_TEST_CASE ( hkdf_hmac_sha256_l32_tests ) <nl> + { <nl> + / / Use rfc5869 test vectors but trucated to 32 bytes ( our implementation only support length 32 ) <nl> + TestHKDF_SHA256_32 ( <nl> + / * IKM * / " 0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b " , <nl> + / * salt * / " 000102030405060708090a0b0c " , <nl> + / * info * / " f0f1f2f3f4f5f6f7f8f9 " , <nl> + / * expected OKM * / " 3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf " ) ; <nl> + TestHKDF_SHA256_32 ( <nl> + " 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f " , <nl> + " 606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf " , <nl> + " b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff " , <nl> + " b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c " ) ; <nl> + TestHKDF_SHA256_32 ( <nl> + " 0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b " , <nl> + " " , <nl> + " " , <nl> + " 8da4e775a563c18f715f802a063c5a31b8a11f5c5ee1879ec3454e5f3c738d2d " ) ; <nl> + } <nl> + <nl> BOOST_AUTO_TEST_CASE ( countbits_tests ) <nl> { <nl> FastRandomContext ctx ; <nl> mmm a / src / test / key_tests . cpp <nl> ppp b / src / test / key_tests . cpp <nl> BOOST_AUTO_TEST_CASE ( key_signature_tests ) <nl> BOOST_CHECK ( found_small ) ; <nl> } <nl> <nl> + BOOST_AUTO_TEST_CASE ( key_key_negation ) <nl> + { <nl> + / / create a dummy hash for signature comparison <nl> + unsigned char rnd [ 8 ] ; <nl> + std : : string str = " Bitcoin key verification \ n " ; <nl> + GetRandBytes ( rnd , sizeof ( rnd ) ) ; <nl> + uint256 hash ; <nl> + CHash256 ( ) . Write ( ( unsigned char * ) str . data ( ) , str . size ( ) ) . Write ( rnd , sizeof ( rnd ) ) . Finalize ( hash . begin ( ) ) ; <nl> + <nl> + / / import the static test key <nl> + CKey key = DecodeSecret ( strSecret1C ) ; <nl> + <nl> + / / create a signature <nl> + std : : vector < unsigned char > vch_sig ; <nl> + std : : vector < unsigned char > vch_sig_cmp ; <nl> + key . Sign ( hash , vch_sig ) ; <nl> + <nl> + / / negate the key twice <nl> + BOOST_CHECK ( key . GetPubKey ( ) . data ( ) [ 0 ] = = 0x03 ) ; <nl> + key . Negate ( ) ; <nl> + / / after the first negation , the signature must be different <nl> + key . Sign ( hash , vch_sig_cmp ) ; <nl> + BOOST_CHECK ( vch_sig_cmp ! = vch_sig ) ; <nl> + BOOST_CHECK ( key . GetPubKey ( ) . data ( ) [ 0 ] = = 0x02 ) ; <nl> + key . Negate ( ) ; <nl> + / / after the second negation , we should have the original key and thus the <nl> + / / same signature <nl> + key . Sign ( hash , vch_sig_cmp ) ; <nl> + BOOST_CHECK ( vch_sig_cmp = = vch_sig ) ; <nl> + BOOST_CHECK ( key . GetPubKey ( ) . data ( ) [ 0 ] = = 0x03 ) ; <nl> + } <nl> + <nl> BOOST_AUTO_TEST_SUITE_END ( ) <nl> | Merge : Add HKDF_HMAC256_L32 and method to negate a private key | bitcoin/bitcoin | 376638afcf945ec43089625d115286594ce0ab16 | 2019-05-16T17:24:52Z |
mmm a / osquery / tables / system / bash_history . cpp <nl> ppp b / osquery / tables / system / bash_history . cpp <nl> QueryData genBashHistory ( ) { <nl> } <nl> std : : string user_history = directory + hfile ; <nl> Status s = readFile ( user_history , history_content ) ; <nl> - if ( ! s . ok ( ) ) { <nl> - LOG ( ERROR ) < < " Error reading history file " < < user_history < < " : " < < s . toString ( ) ; <nl> - continue ; <nl> - } else { <nl> + if ( s . ok ( ) ) { <nl> for ( const auto & line : split ( history_content , " \ n " ) ) { <nl> Row r ; <nl> r [ " username " ] = std : : string ( username ) ; <nl> | Changed logic to ignore when history file is not found ( expected ) | osquery/osquery | c8c3363455b912b3923ef1eff3d157933de5d845 | 2014-10-25T03:38:09Z |
mmm a / xbmc / cores / omxplayer / OMXImage . cpp <nl> ppp b / xbmc / cores / omxplayer / OMXImage . cpp <nl> <nl> # include " settings / AdvancedSettings . h " <nl> # include " settings / DisplaySettings . h " <nl> # include " settings / Settings . h " <nl> + # include " linux / RBP . h " <nl> + <nl> + # define EXIF_TAG_ORIENTATION 0x0112 <nl> + <nl> <nl> # ifdef CLASSNAME <nl> # undef CLASSNAME <nl> # endif <nl> # define CLASSNAME " COMXImage " <nl> <nl> - # define CONTENTURI_MAXLEN 256 <nl> - <nl> - # define EXIF_TAG_ORIENTATION 0x0112 <nl> - <nl> - static CCriticalSection g_OMXSection ; <nl> - <nl> - COMXImage : : COMXImage ( ) <nl> + bool COMXImage : : CreateThumbnailFromSurface ( unsigned char * buffer , unsigned int width , unsigned int height , <nl> + unsigned int format , unsigned int pitch , const CStdString & destFile ) <nl> { <nl> - m_is_open = false ; <nl> - m_image_size = 0 ; <nl> - m_image_buffer = NULL ; <nl> - m_progressive = false ; <nl> - m_alpha = false ; <nl> - m_orientation = 0 ; <nl> - m_width = 0 ; <nl> - m_height = 0 ; <nl> - <nl> - m_decoded_buffer = NULL ; <nl> - m_encoded_buffer = NULL ; <nl> - <nl> - m_decoder_open = false ; <nl> - m_encoder_open = false ; <nl> - <nl> - OMX_INIT_STRUCTURE ( m_decoded_format ) ; <nl> - OMX_INIT_STRUCTURE ( m_encoded_format ) ; <nl> - memset ( & m_omx_image , 0x0 , sizeof ( OMX_IMAGE_PORTDEFINITIONTYPE ) ) ; <nl> + COMXImageEnc omxImageEnc ; <nl> + bool ret = omxImageEnc . CreateThumbnailFromSurface ( buffer , width , height , format , pitch , destFile ) ; <nl> + if ( ! ret ) <nl> + CLog : : Log ( LOGNOTICE , " % s : unable to create thumbnail % s % dx % d " , __func__ , destFile . c_str ( ) , width , height ) ; <nl> + return ret ; <nl> } <nl> <nl> - COMXImage : : ~ COMXImage ( ) <nl> + COMXImageFile * COMXImage : : LoadJpeg ( const CStdString & texturePath ) <nl> { <nl> - Close ( ) ; <nl> + COMXImageFile * file = new COMXImageFile ( ) ; <nl> + if ( ! file - > ReadFile ( texturePath ) ) <nl> + { <nl> + CLog : : Log ( LOGNOTICE , " % s : unable to load % s " , __func__ , texturePath . c_str ( ) ) ; <nl> + delete file ; <nl> + file = NULL ; <nl> + } <nl> + return file ; <nl> } <nl> <nl> - void COMXImage : : Close ( ) <nl> + void COMXImage : : CloseJpeg ( COMXImageFile * file ) <nl> { <nl> - CSingleLock lock ( g_OMXSection ) ; <nl> - <nl> - OMX_INIT_STRUCTURE ( m_decoded_format ) ; <nl> - OMX_INIT_STRUCTURE ( m_encoded_format ) ; <nl> - memset ( & m_omx_image , 0x0 , sizeof ( OMX_IMAGE_PORTDEFINITIONTYPE ) ) ; <nl> + delete file ; <nl> + } <nl> <nl> - if ( m_image_buffer ) <nl> - free ( m_image_buffer ) ; <nl> + bool COMXImage : : DecodeJpeg ( COMXImageFile * file , unsigned int width , unsigned int height , unsigned int stride , void * pixels ) <nl> + { <nl> + bool ret = false ; <nl> + COMXImageDec omx_image ; <nl> + if ( omx_image . Decode ( file - > GetImageBuffer ( ) , file - > GetImageSize ( ) , width , height , stride , pixels ) ) <nl> + { <nl> + assert ( width = = omx_image . GetDecodedWidth ( ) ) ; <nl> + assert ( height = = omx_image . GetDecodedHeight ( ) ) ; <nl> + assert ( stride = = omx_image . GetDecodedStride ( ) ) ; <nl> + ret = true ; <nl> + } <nl> + else <nl> + CLog : : Log ( LOGNOTICE , " % s : unable to decode % s % dx % d " , __func__ , file - > GetFilename ( ) , width , height ) ; <nl> + omx_image . Close ( ) ; <nl> + return ret ; <nl> + } <nl> <nl> - m_image_buffer = NULL ; <nl> - m_image_size = 0 ; <nl> - m_width = 0 ; <nl> - m_height = 0 ; <nl> - m_is_open = false ; <nl> - m_progressive = false ; <nl> - m_orientation = 0 ; <nl> - m_decoded_buffer = NULL ; <nl> - m_encoded_buffer = NULL ; <nl> + bool COMXImage : : ClampLimits ( unsigned int & width , unsigned int & height , unsigned int m_width , unsigned int m_height , bool transposed ) <nl> + { <nl> + RESOLUTION_INFO & res_info = CDisplaySettings : : Get ( ) . GetResolutionInfo ( g_graphicsContext . GetVideoResolution ( ) ) ; <nl> + unsigned int max_width = width ; <nl> + unsigned int max_height = height ; <nl> + const unsigned int gui_width = transposed ? res_info . iHeight : res_info . iWidth ; <nl> + const unsigned int gui_height = transposed ? res_info . iWidth : res_info . iHeight ; <nl> + const float aspect = ( float ) m_width / m_height ; <nl> + bool clamped = false ; <nl> <nl> - if ( m_decoder_open ) <nl> + if ( max_width = = 0 | | max_height = = 0 ) <nl> { <nl> - m_omx_decoder . FlushInput ( ) ; <nl> - m_omx_decoder . FreeInputBuffers ( ) ; <nl> - m_omx_resize . FlushOutput ( ) ; <nl> - m_omx_resize . FreeOutputBuffers ( ) ; <nl> + max_height = g_advancedSettings . m_imageRes ; <nl> <nl> - m_omx_tunnel_decode . Deestablish ( ) ; <nl> - m_omx_decoder . Deinitialize ( ) ; <nl> - m_omx_resize . Deinitialize ( ) ; <nl> - m_decoder_open = false ; <nl> + if ( g_advancedSettings . m_fanartRes > g_advancedSettings . m_imageRes ) <nl> + { / / 16x9 images larger than the fanart res use that rather than the image res <nl> + if ( fabsf ( aspect / ( 16 . 0f / 9 . 0f ) - 1 . 0f ) < = 0 . 01f & & m_height > = g_advancedSettings . m_fanartRes ) <nl> + { <nl> + max_height = g_advancedSettings . m_fanartRes ; <nl> + } <nl> + } <nl> + max_width = max_height * 16 / 9 ; <nl> } <nl> <nl> - if ( m_encoder_open ) <nl> + if ( gui_width ) <nl> + max_width = min ( max_width , gui_width ) ; <nl> + if ( gui_height ) <nl> + max_height = min ( max_height , gui_height ) ; <nl> + <nl> + max_width = min ( max_width , 2048U ) ; <nl> + max_height = min ( max_height , 2048U ) ; <nl> + <nl> + width = m_width ; <nl> + height = m_height ; <nl> + if ( width > max_width | | height > max_height ) <nl> { <nl> - m_omx_encoder . Deinitialize ( ) ; <nl> - m_encoder_open = false ; <nl> + if ( ( unsigned int ) ( max_width / aspect + 0 . 5f ) > max_height ) <nl> + max_width = ( unsigned int ) ( max_height * aspect + 0 . 5f ) ; <nl> + else <nl> + max_height = ( unsigned int ) ( max_width / aspect + 0 . 5f ) ; <nl> + width = max_width ; <nl> + height = max_height ; <nl> + clamped = true ; <nl> } <nl> + / / Texture . cpp wants even width / height <nl> + width = ( width + 15 ) & ~ 15 ; <nl> + height = ( height + 15 ) & ~ 15 ; <nl> <nl> - m_pFile . Close ( ) ; <nl> + return clamped ; <nl> + } <nl> + <nl> + # ifdef CLASSNAME <nl> + # undef CLASSNAME <nl> + # endif <nl> + # define CLASSNAME " COMXImageFile " <nl> + <nl> + COMXImageFile : : COMXImageFile ( ) <nl> + { <nl> + m_image_size = 0 ; <nl> + m_image_buffer = NULL ; <nl> + m_orientation = 0 ; <nl> + m_width = 0 ; <nl> + m_height = 0 ; <nl> + m_filename = " " ; <nl> + } <nl> + <nl> + COMXImageFile : : ~ COMXImageFile ( ) <nl> + { <nl> + if ( m_image_buffer ) <nl> + free ( m_image_buffer ) ; <nl> } <nl> <nl> typedef enum { / * JPEG marker codes * / <nl> static void inline SKIPN ( uint8_t * & p , unsigned int n ) <nl> p + = n ; <nl> } <nl> <nl> - <nl> - OMX_IMAGE_CODINGTYPE COMXImage : : GetCodingType ( ) <nl> + OMX_IMAGE_CODINGTYPE COMXImageFile : : GetCodingType ( unsigned int & width , unsigned int & height ) <nl> { <nl> - memset ( & m_omx_image , 0x0 , sizeof ( OMX_IMAGE_PORTDEFINITIONTYPE ) ) ; <nl> - m_width = 0 ; <nl> - m_height = 0 ; <nl> - m_progressive = false ; <nl> + OMX_IMAGE_CODINGTYPE eCompressionFormat = OMX_IMAGE_CodingMax ; <nl> + bool progressive = false ; <nl> int components = 0 ; <nl> m_orientation = 0 ; <nl> <nl> - m_omx_image . eCompressionFormat = OMX_IMAGE_CodingMax ; <nl> - <nl> if ( ! m_image_size ) <nl> return OMX_IMAGE_CodingMax ; <nl> <nl> OMX_IMAGE_CODINGTYPE COMXImage : : GetCodingType ( ) <nl> / * JPEG Header * / <nl> if ( READ16 ( p ) = = 0xFFD8 ) <nl> { <nl> - m_omx_image . eCompressionFormat = OMX_IMAGE_CodingJPEG ; <nl> + eCompressionFormat = OMX_IMAGE_CodingJPEG ; <nl> <nl> READ8 ( p ) ; <nl> unsigned char marker = READ8 ( p ) ; <nl> OMX_IMAGE_CODINGTYPE COMXImage : : GetCodingType ( ) <nl> { <nl> if ( marker = = M_SOF2 | | marker = = M_SOF6 | | marker = = M_SOF10 | | marker = = M_SOF14 ) <nl> { <nl> - m_progressive = true ; <nl> + progressive = true ; <nl> } <nl> int readBits = 2 ; <nl> SKIPN ( p , 1 ) ; <nl> readBits + + ; <nl> - m_omx_image . nFrameHeight = READ16 ( p ) ; <nl> + height = READ16 ( p ) ; <nl> readBits + = 2 ; <nl> - m_omx_image . nFrameWidth = READ16 ( p ) ; <nl> + width = READ16 ( p ) ; <nl> readBits + = 2 ; <nl> components = READ8 ( p ) ; <nl> readBits + = 1 ; <nl> OMX_IMAGE_CODINGTYPE COMXImage : : GetCodingType ( ) <nl> marker = READ8 ( p ) ; <nl> <nl> } <nl> - <nl> - if ( components > 3 ) <nl> - { <nl> - CLog : : Log ( LOGWARNING , " % s : : % s Only YUV images are supported by decoder \ n " , CLASSNAME , __func__ ) ; <nl> - m_omx_image . eCompressionFormat = OMX_IMAGE_CodingMax ; <nl> - } <nl> } <nl> <nl> if ( m_orientation > 8 ) <nl> m_orientation = 0 ; <nl> <nl> - m_width = m_omx_image . nFrameWidth ; <nl> - m_height = m_omx_image . nFrameHeight ; <nl> - <nl> - return m_omx_image . eCompressionFormat ; <nl> - } <nl> - <nl> - bool COMXImage : : ClampLimits ( unsigned int & width , unsigned int & height ) <nl> - { <nl> - RESOLUTION_INFO & res_info = CDisplaySettings : : Get ( ) . GetResolutionInfo ( g_graphicsContext . GetVideoResolution ( ) ) ; <nl> - const bool transposed = m_orientation & 4 ; <nl> - unsigned int max_width = width ; <nl> - unsigned int max_height = height ; <nl> - const unsigned int gui_width = transposed ? res_info . iHeight : res_info . iWidth ; <nl> - const unsigned int gui_height = transposed ? res_info . iWidth : res_info . iHeight ; <nl> - const float aspect = ( float ) m_width / m_height ; <nl> - <nl> - if ( max_width = = 0 | | max_height = = 0 ) <nl> + if ( eCompressionFormat = = OMX_IMAGE_CodingMax ) <nl> { <nl> - max_height = g_advancedSettings . m_imageRes ; <nl> - <nl> - if ( g_advancedSettings . m_fanartRes > g_advancedSettings . m_imageRes ) <nl> - { / / 16x9 images larger than the fanart res use that rather than the image res <nl> - if ( fabsf ( aspect / ( 16 . 0f / 9 . 0f ) - 1 . 0f ) < = 0 . 01f & & m_height > = g_advancedSettings . m_fanartRes ) <nl> - { <nl> - max_height = g_advancedSettings . m_fanartRes ; <nl> - } <nl> - } <nl> - max_width = max_height * 16 / 9 ; <nl> + CLog : : Log ( LOGERROR , " % s : : % s error unsupported image format \ n " , CLASSNAME , __func__ ) ; <nl> } <nl> <nl> - if ( gui_width ) <nl> - max_width = min ( max_width , gui_width ) ; <nl> - if ( gui_height ) <nl> - max_height = min ( max_height , gui_height ) ; <nl> - <nl> - max_width = min ( max_width , 2048U ) ; <nl> - max_height = min ( max_height , 2048U ) ; <nl> - <nl> + if ( progressive ) <nl> + { <nl> + CLog : : Log ( LOGWARNING , " % s : : % s progressive images not supported by decoder \ n " , CLASSNAME , __func__ ) ; <nl> + eCompressionFormat = OMX_IMAGE_CodingMax ; <nl> + } <nl> <nl> - width = m_width ; <nl> - height = m_height ; <nl> - if ( width > max_width | | height > max_height ) <nl> + if ( components > 3 ) <nl> { <nl> - if ( ( unsigned int ) ( max_width / aspect + 0 . 5f ) > max_height ) <nl> - max_width = ( unsigned int ) ( max_height * aspect + 0 . 5f ) ; <nl> - else <nl> - max_height = ( unsigned int ) ( max_width / aspect + 0 . 5f ) ; <nl> - width = max_width ; <nl> - height = max_height ; <nl> - return true ; <nl> + CLog : : Log ( LOGWARNING , " % s : : % s Only YUV images are supported by decoder \ n " , CLASSNAME , __func__ ) ; <nl> + eCompressionFormat = OMX_IMAGE_CodingMax ; <nl> } <nl> - return false ; <nl> + <nl> + return eCompressionFormat ; <nl> } <nl> <nl> - bool COMXImage : : ReadFile ( const CStdString & inputFile ) <nl> + <nl> + bool COMXImageFile : : ReadFile ( const CStdString & inputFile ) <nl> { <nl> + XFILE : : CFile m_pFile ; <nl> + m_filename = inputFile . c_str ( ) ; <nl> if ( ! m_pFile . Open ( inputFile , 0 ) ) <nl> { <nl> CLog : : Log ( LOGERROR , " % s : : % s % s not found \ n " , CLASSNAME , __func__ , inputFile . c_str ( ) ) ; <nl> bool COMXImage : : ReadFile ( const CStdString & inputFile ) <nl> <nl> m_image_size = m_pFile . GetLength ( ) ; <nl> <nl> - if ( ! m_image_size ) { <nl> + if ( ! m_image_size ) <nl> + { <nl> CLog : : Log ( LOGERROR , " % s : : % s % s m_image_size zero \ n " , CLASSNAME , __func__ , inputFile . c_str ( ) ) ; <nl> return false ; <nl> } <nl> m_image_buffer = ( uint8_t * ) malloc ( m_image_size ) ; <nl> - if ( ! m_image_buffer ) { <nl> + if ( ! m_image_buffer ) <nl> + { <nl> CLog : : Log ( LOGERROR , " % s : : % s % s m_image_buffer null ( % lu ) \ n " , CLASSNAME , __func__ , inputFile . c_str ( ) , m_image_size ) ; <nl> return false ; <nl> } <nl> <nl> m_pFile . Read ( m_image_buffer , m_image_size ) ; <nl> + m_pFile . Close ( ) ; <nl> <nl> - if ( GetCodingType ( ) ! = OMX_IMAGE_CodingJPEG ) { <nl> - CLog : : Log ( LOGERROR , " % s : : % s % s GetCodingType = 0x % x \ n " , CLASSNAME , __func__ , inputFile . c_str ( ) , GetCodingType ( ) ) ; <nl> + OMX_IMAGE_CODINGTYPE eCompressionFormat = GetCodingType ( m_width , m_height ) ; <nl> + if ( eCompressionFormat ! = OMX_IMAGE_CodingJPEG ) <nl> + { <nl> + CLog : : Log ( LOGERROR , " % s : : % s % s GetCodingType = 0x % x \ n " , CLASSNAME , __func__ , inputFile . c_str ( ) , eCompressionFormat ) ; <nl> return false ; <nl> } <nl> <nl> - if ( m_width < 1 | | m_height < 1 ) { <nl> + if ( m_width < 1 | | m_height < 1 ) <nl> + { <nl> CLog : : Log ( LOGERROR , " % s : : % s % s m_width = % d m_height = % d \ n " , CLASSNAME , __func__ , inputFile . c_str ( ) , m_width , m_height ) ; <nl> return false ; <nl> } <nl> <nl> - m_is_open = true ; <nl> - <nl> return true ; <nl> } <nl> <nl> - bool COMXImage : : HandlePortSettingChange ( unsigned int resize_width , unsigned int resize_height ) <nl> + # ifdef CLASSNAME <nl> + # undef CLASSNAME <nl> + # endif <nl> + # define CLASSNAME " COMXImageDec " <nl> + <nl> + COMXImageDec : : COMXImageDec ( ) <nl> + { <nl> + m_decoded_buffer = NULL ; <nl> + OMX_INIT_STRUCTURE ( m_decoded_format ) ; <nl> + } <nl> + <nl> + COMXImageDec : : ~ COMXImageDec ( ) <nl> + { <nl> + Close ( ) ; <nl> + <nl> + OMX_INIT_STRUCTURE ( m_decoded_format ) ; <nl> + m_decoded_buffer = NULL ; <nl> + } <nl> + <nl> + void COMXImageDec : : Close ( ) <nl> + { <nl> + CSingleLock lock ( m_OMXSection ) ; <nl> + <nl> + if ( m_omx_decoder . IsInitialized ( ) ) <nl> + { <nl> + m_omx_decoder . FlushInput ( ) ; <nl> + m_omx_decoder . FreeInputBuffers ( ) ; <nl> + } <nl> + if ( m_omx_resize . IsInitialized ( ) ) <nl> + { <nl> + m_omx_resize . FlushOutput ( ) ; <nl> + m_omx_resize . FreeOutputBuffers ( ) ; <nl> + } <nl> + if ( m_omx_tunnel_decode . IsInitialized ( ) ) <nl> + m_omx_tunnel_decode . Deestablish ( ) ; <nl> + if ( m_omx_decoder . IsInitialized ( ) ) <nl> + m_omx_decoder . Deinitialize ( true ) ; <nl> + if ( m_omx_resize . IsInitialized ( ) ) <nl> + m_omx_resize . Deinitialize ( true ) ; <nl> + } <nl> + <nl> + bool COMXImageDec : : HandlePortSettingChange ( unsigned int resize_width , unsigned int resize_height ) <nl> { <nl> OMX_ERRORTYPE omx_err = OMX_ErrorNone ; <nl> / / on the first port settings changed event , we create the tunnel and alloc the buffer <nl> bool COMXImage : : HandlePortSettingChange ( unsigned int resize_width , unsigned int <nl> <nl> port_def . nPortIndex = m_omx_decoder . GetOutputPort ( ) ; <nl> m_omx_decoder . GetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> + port_def . format . image . nSliceHeight = 16 ; <nl> + m_omx_decoder . SetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> + <nl> port_def . nPortIndex = m_omx_resize . GetInputPort ( ) ; <nl> m_omx_resize . SetParameter ( OMX_IndexParamPortDefinition , & port_def ) ; <nl> <nl> bool COMXImage : : HandlePortSettingChange ( unsigned int resize_width , unsigned int <nl> } <nl> assert ( m_decoded_format . nBufferCountActual = = 1 ) ; <nl> <nl> - omx_err = m_omx_resize . AllocOutputBuffers ( ) ; / / false , true ) ; <nl> + omx_err = m_omx_resize . AllocOutputBuffers ( ) ; <nl> if ( omx_err ! = OMX_ErrorNone ) <nl> { <nl> CLog : : Log ( LOGERROR , " % s : : % s m_omx_resize . AllocOutputBuffers result ( 0x % x ) \ n " , CLASSNAME , __func__ , omx_err ) ; <nl> bool COMXImage : : HandlePortSettingChange ( unsigned int resize_width , unsigned int <nl> return true ; <nl> } <nl> <nl> - bool COMXImage : : Decode ( unsigned width , unsigned height ) <nl> + bool COMXImageDec : : Decode ( const uint8_t * demuxer_content , unsigned demuxer_bytes , unsigned width , unsigned height , unsigned stride , void * pixels ) <nl> { <nl> - CSingleLock lock ( g_OMXSection ) ; <nl> - std : : string componentName = " " ; <nl> - unsigned int demuxer_bytes = 0 ; <nl> - const uint8_t * demuxer_content = NULL ; <nl> + CSingleLock lock ( m_OMXSection ) ; <nl> OMX_ERRORTYPE omx_err = OMX_ErrorNone ; <nl> OMX_BUFFERHEADERTYPE * omx_buffer = NULL ; <nl> <nl> - if ( ! m_image_buffer ) <nl> + if ( ! demuxer_content | | ! demuxer_bytes ) <nl> { <nl> CLog : : Log ( LOGERROR , " % s : : % s no input buffer \ n " , CLASSNAME , __func__ ) ; <nl> return false ; <nl> } <nl> <nl> - if ( GetCompressionFormat ( ) = = OMX_IMAGE_CodingMax ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s error unsupported image format \ n " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> - <nl> - if ( IsProgressive ( ) ) <nl> + if ( ! m_omx_decoder . Initialize ( " OMX . broadcom . image_decode " , OMX_IndexParamImageInit ) ) <nl> { <nl> - CLog : : Log ( LOGWARNING , " % s : : % s progressive images not supported by decoder \ n " , CLASSNAME , __func__ ) ; <nl> + CLog : : Log ( LOGERROR , " % s : : % s error m_omx_decoder . Initialize \ n " , CLASSNAME , __func__ ) ; <nl> return false ; <nl> } <nl> <nl> - if ( ! m_is_open ) <nl> + if ( ! m_omx_resize . Initialize ( " OMX . broadcom . resize " , OMX_IndexParamImageInit ) ) <nl> { <nl> - CLog : : Log ( LOGERROR , " % s : : % s error not opened \ n " , CLASSNAME , __func__ ) ; <nl> + CLog : : Log ( LOGERROR , " % s : : % s error m_omx_resize . Initialize \ n " , CLASSNAME , __func__ ) ; <nl> return false ; <nl> } <nl> <nl> - componentName = " OMX . broadcom . image_decode " ; <nl> - if ( ! m_omx_decoder . Initialize ( ( const std : : string ) componentName , OMX_IndexParamImageInit ) ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " % s : : % s error m_omx_decoder . Initialize \ n " , CLASSNAME , __func__ ) ; <nl> - return false ; <nl> - } <nl> + / / set input format <nl> + OMX_PARAM_PORTDEFINITIONTYPE portParam ; <nl> + OMX_INIT_STRUCTURE ( portParam ) ; <nl> + portParam . nPortIndex = m_omx_decoder . GetInputPort ( ) ; <nl> <nl> - componentName = " OMX . broadcom . resize " ; <nl> - if ( ! m_omx_resize . Initialize ( ( const std : : string ) componentName , OMX_IndexParamImageInit ) ) <nl> + omx_err = m_omx_decoder . GetParameter ( OMX_IndexParamPortDefinition , & portParam ) ; <nl> + if ( omx_err ! = OMX_ErrorNone ) <nl> { <nl> - CLog : : Log ( LOGERROR , " % s : : % s error m_omx_resize . Initialize \ n " , CLASSNAME , __func__ ) ; <nl> + CLog : : Log ( LOGERROR , " % s : : % s error GetParameter : OMX_IndexParamPortDefinition omx_err ( 0x % 08x ) \ n " , CLASSNAME , __func__ , omx_err ) ; <nl> return false ; <nl> } <nl> <nl> - m_decoder_open = true ; <nl> - ClampLimits ( width , height ) ; <nl> - <nl> - / / set input format <nl> - OMX_IMAGE_PARAM_PORTFORMATTYPE imagePortFormat ; <nl> - OMX_INIT_STRUCTURE ( imagePortFormat ) ; <nl> - imagePortFormat . nPortIndex = m_omx_decoder . GetInputPort ( ) ; <nl> - imagePortFormat . eCompressionFormat = OMX_IMAGE_CodingJPEG ; <nl> + portParam . nBufferCountActual = portParam . nBufferCountMin ; <nl> + portParam . nBufferSize = std : : max ( portParam . nBufferSize , ALIGN_UP ( demuxer_bytes , portParam . nBufferAlignment ) ) ; <nl> + portParam . format . image . eCompressionFormat = OMX_IMAGE_CodingJPEG ; <nl> <nl> - omx_err = m_omx_decoder . SetParameter ( OMX_IndexParamImagePortFormat , & imagePortFormat ) ; <nl> + omx_err = m_omx_decoder . SetParameter ( OMX_IndexParamPortDefinition , & portParam ) ; <nl> if ( omx_err ! = OMX_ErrorNone ) <nl> { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_decoder . SetParameter OMX_IndexParamImagePortFormat result ( 0x % x ) \ n " , CLASSNAME , __func__ , omx_err ) ; <nl> + CLog : : Log ( LOGERROR , " % s : : % s error SetParameter : OMX_IndexParamPortDefinition omx_err ( 0x % 08x ) \ n " , CLASSNAME , __func__ , omx_err ) ; <nl> return false ; <nl> } <nl> <nl> bool COMXImage : : Decode ( unsigned width , unsigned height ) <nl> return false ; <nl> } <nl> <nl> - demuxer_bytes = GetImageSize ( ) ; <nl> - demuxer_content = GetImageBuffer ( ) ; <nl> - if ( ! demuxer_bytes | | ! demuxer_content ) <nl> - return false ; <nl> - <nl> while ( demuxer_bytes > 0 | | ! m_decoded_buffer ) <nl> { <nl> long timeout = 0 ; <nl> bool COMXImage : : Decode ( unsigned width , unsigned height ) <nl> return false ; <nl> } <nl> } <nl> - else <nl> + if ( ! demuxer_bytes ) <nl> { <nl> / / we ' ve submitted all buffers so can wait now <nl> timeout = 1000 ; <nl> bool COMXImage : : Decode ( unsigned width , unsigned height ) <nl> return false ; <nl> } <nl> } <nl> - / / we treat it as an error if a real timeout occurred <nl> - else if ( timeout ) <nl> + else if ( omx_err = = OMX_ErrorStreamCorrupt ) <nl> { <nl> - CLog : : Log ( LOGERROR , " % s : : % s HandlePortSettingChange ( ) failed \ n " , CLASSNAME , __func__ ) ; <nl> + CLog : : Log ( LOGERROR , " % s : : % s - image not supported " , CLASSNAME , __func__ ) ; <nl> + return false ; <nl> + } <nl> + else if ( timeout | | omx_err ! = OMX_ErrorTimeout ) <nl> + { <nl> + CLog : : Log ( LOGERROR , " % s : : % s WaitForEvent : OMX_EventPortSettingsChanged failed ( % x ) \ n " , CLASSNAME , __func__ , omx_err ) ; <nl> return false ; <nl> } <nl> } <nl> <nl> - omx_err = m_omx_decoder . WaitForEvent ( OMX_EventBufferFlag , 1000 ) ; <nl> + omx_err = m_omx_resize . WaitForOutputDone ( 1000 ) ; <nl> if ( omx_err ! = OMX_ErrorNone ) <nl> { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_decoder . WaitForEvent result ( 0x % x ) \ n " , CLASSNAME , __func__ , omx_err ) ; <nl> + CLog : : Log ( LOGERROR , " % s : : % s m_omx_resize . WaitForOutputDone result ( 0x % x ) \ n " , CLASSNAME , __func__ , omx_err ) ; <nl> return false ; <nl> } <nl> <nl> - m_omx_tunnel_decode . Deestablish ( ) ; <nl> - <nl> if ( m_omx_decoder . BadState ( ) ) <nl> return false ; <nl> <nl> + assert ( m_decoded_buffer - > nFilledLen < = stride * height ) ; <nl> + memcpy ( ( char * ) pixels , m_decoded_buffer - > pBuffer , m_decoded_buffer - > nFilledLen ) ; <nl> + <nl> + Close ( ) ; <nl> return true ; <nl> } <nl> <nl> + # ifdef CLASSNAME <nl> + # undef CLASSNAME <nl> + # endif <nl> + # define CLASSNAME " COMXImageEnc " <nl> + <nl> + COMXImageEnc : : COMXImageEnc ( ) <nl> + { <nl> + CSingleLock lock ( m_OMXSection ) ; <nl> + OMX_INIT_STRUCTURE ( m_encoded_format ) ; <nl> + m_encoded_buffer = NULL ; <nl> + } <nl> + <nl> + COMXImageEnc : : ~ COMXImageEnc ( ) <nl> + { <nl> + CSingleLock lock ( m_OMXSection ) ; <nl> <nl> - bool COMXImage : : Encode ( unsigned char * buffer , int size , unsigned width , unsigned height , unsigned int pitch ) <nl> + OMX_INIT_STRUCTURE ( m_encoded_format ) ; <nl> + m_encoded_buffer = NULL ; <nl> + if ( m_omx_encoder . IsInitialized ( ) ) <nl> + m_omx_encoder . Deinitialize ( true ) ; <nl> + } <nl> + <nl> + bool COMXImageEnc : : Encode ( unsigned char * buffer , int size , unsigned width , unsigned height , unsigned int pitch ) <nl> { <nl> - CSingleLock lock ( g_OMXSection ) ; <nl> + CSingleLock lock ( m_OMXSection ) ; <nl> <nl> - std : : string componentName = " " ; <nl> unsigned int demuxer_bytes = 0 ; <nl> const uint8_t * demuxer_content = NULL ; <nl> OMX_ERRORTYPE omx_err = OMX_ErrorNone ; <nl> bool COMXImage : : Encode ( unsigned char * buffer , int size , unsigned width , unsigned <nl> return false ; <nl> } <nl> <nl> - componentName = " OMX . broadcom . image_encode " ; <nl> - if ( ! m_omx_encoder . Initialize ( ( const std : : string ) componentName , OMX_IndexParamImageInit ) ) <nl> + if ( ! m_omx_encoder . Initialize ( " OMX . broadcom . image_encode " , OMX_IndexParamImageInit ) ) <nl> { <nl> CLog : : Log ( LOGERROR , " % s : : % s error m_omx_encoder . Initialize \ n " , CLASSNAME , __func__ ) ; <nl> return false ; <nl> } <nl> <nl> - m_encoder_open = true ; <nl> - <nl> OMX_PARAM_PORTDEFINITIONTYPE port_def ; <nl> OMX_INIT_STRUCTURE ( port_def ) ; <nl> port_def . nPortIndex = m_omx_encoder . GetInputPort ( ) ; <nl> bool COMXImage : : Encode ( unsigned char * buffer , int size , unsigned width , unsigned <nl> if ( omx_err ! = OMX_ErrorNone ) <nl> return false ; <nl> <nl> - omx_err = m_omx_encoder . WaitForEvent ( OMX_EventBufferFlag , 1000 ) ; <nl> + omx_err = m_omx_encoder . WaitForOutputDone ( 1000 ) ; <nl> if ( omx_err ! = OMX_ErrorNone ) <nl> { <nl> - CLog : : Log ( LOGERROR , " % s : : % s m_omx_encoder WaitForEvent result ( 0x % x ) \ n " , CLASSNAME , __func__ , omx_err ) ; <nl> + CLog : : Log ( LOGERROR , " % s : : % s m_omx_resize . WaitForOutputDone result ( 0x % x ) \ n " , CLASSNAME , __func__ , omx_err ) ; <nl> return false ; <nl> } <nl> <nl> bool COMXImage : : Encode ( unsigned char * buffer , int size , unsigned width , unsigned <nl> return true ; <nl> } <nl> <nl> - unsigned char * COMXImage : : GetDecodedData ( ) <nl> - { <nl> - if ( ! m_decoded_buffer ) <nl> - return NULL ; <nl> - <nl> - return ( unsigned char * ) m_decoded_buffer - > pBuffer ; <nl> - } <nl> - <nl> - unsigned int COMXImage : : GetDecodedSize ( ) <nl> - { <nl> - if ( ! m_decoded_buffer ) <nl> - return 0 ; <nl> - return ( unsigned int ) m_decoded_buffer - > nFilledLen ; <nl> - } <nl> - <nl> - unsigned char * COMXImage : : GetEncodedData ( ) <nl> - { <nl> - if ( ! m_encoded_buffer ) <nl> - return NULL ; <nl> - <nl> - return ( unsigned char * ) m_encoded_buffer - > pBuffer ; <nl> - } <nl> - <nl> - unsigned int COMXImage : : GetEncodedSize ( ) <nl> - { <nl> - if ( ! m_encoded_buffer ) <nl> - return 0 ; <nl> - return ( unsigned int ) m_encoded_buffer - > nFilledLen ; <nl> - } <nl> - <nl> - bool COMXImage : : SwapBlueRed ( unsigned char * pixels , unsigned int height , unsigned int pitch , <nl> - unsigned int elements , unsigned int offset ) <nl> - { <nl> - if ( ! pixels ) return false ; <nl> - unsigned char * dst = pixels ; <nl> - for ( unsigned int y = 0 ; y < height ; y + + ) <nl> - { <nl> - dst = pixels + ( y * pitch ) ; <nl> - for ( unsigned int x = 0 ; x < pitch ; x + = elements ) <nl> - std : : swap ( dst [ x + offset ] , dst [ x + 2 + offset ] ) ; <nl> - } <nl> - return true ; <nl> - } <nl> - <nl> - bool COMXImage : : CreateThumbnail ( const CStdString & sourceFile , const CStdString & destFile , <nl> - int minx , int miny , bool rotateExif ) <nl> - { <nl> - if ( ! ReadFile ( sourceFile ) ) <nl> - return false ; <nl> - <nl> - return CreateThumbnailFromMemory ( m_image_buffer , m_image_size , destFile , minx , miny ) ; <nl> - } <nl> - <nl> - bool COMXImage : : CreateThumbnailFromMemory ( unsigned char * buffer , unsigned int bufSize , const CStdString & destFile , <nl> - unsigned int minx , unsigned int miny ) <nl> - { <nl> - if ( ! bufSize | | ! buffer ) <nl> - return false ; <nl> - <nl> - if ( ! m_is_open ) <nl> - { <nl> - m_image_size = bufSize ; <nl> - m_image_buffer = ( uint8_t * ) malloc ( m_image_size ) ; <nl> - if ( ! m_image_buffer ) <nl> - return false ; <nl> - <nl> - memcpy ( m_image_buffer , buffer , m_image_size ) ; <nl> - <nl> - if ( GetCodingType ( ) ! = OMX_IMAGE_CodingJPEG ) { <nl> - CLog : : Log ( LOGERROR , " % s : : % s : % s GetCodingType ( ) = 0x % x \ n " , CLASSNAME , __func__ , destFile . c_str ( ) , GetCodingType ( ) ) ; <nl> - return false ; <nl> - } <nl> - m_is_open = true ; <nl> - } <nl> - <nl> - if ( ! Decode ( minx , miny ) ) <nl> - return false ; <nl> - <nl> - return CreateThumbnailFromSurface ( GetDecodedData ( ) , GetDecodedWidth ( ) , GetDecodedHeight ( ) , <nl> - XB_FMT_A8R8G8B8 , GetDecodedStride ( ) , destFile ) ; <nl> - } <nl> - <nl> - bool COMXImage : : CreateThumbnailFromSurface ( unsigned char * buffer , unsigned int width , unsigned int height , <nl> + bool COMXImageEnc : : CreateThumbnailFromSurface ( unsigned char * buffer , unsigned int width , unsigned int height , <nl> unsigned int format , unsigned int pitch , const CStdString & destFile ) <nl> { <nl> - if ( format ! = XB_FMT_A8R8G8B8 | | ! buffer ) { <nl> + if ( format ! = XB_FMT_A8R8G8B8 | | ! buffer ) <nl> + { <nl> CLog : : Log ( LOGDEBUG , " % s : : % s : % s failed format = 0x % x \ n " , CLASSNAME , __func__ , destFile . c_str ( ) , format ) ; <nl> return false ; <nl> } <nl> <nl> - if ( ! Encode ( buffer , height * pitch , width , height , pitch ) ) { <nl> + if ( ! Encode ( buffer , height * pitch , width , height , pitch ) ) <nl> + { <nl> CLog : : Log ( LOGDEBUG , " % s : : % s : % s encode failed \ n " , CLASSNAME , __func__ , destFile . c_str ( ) ) ; <nl> return false ; <nl> } <nl> bool COMXImage : : CreateThumbnailFromSurface ( unsigned char * buffer , unsigned int w <nl> { <nl> CLog : : Log ( LOGDEBUG , " % s : : % s : % s width % d height % d \ n " , CLASSNAME , __func__ , destFile . c_str ( ) , width , height ) ; <nl> <nl> - file . Write ( GetEncodedData ( ) , GetEncodedSize ( ) ) ; <nl> + file . Write ( m_encoded_buffer - > pBuffer , m_encoded_buffer - > nFilledLen ) ; <nl> file . Close ( ) ; <nl> return true ; <nl> } <nl> mmm a / xbmc / cores / omxplayer / OMXImage . h <nl> ppp b / xbmc / cores / omxplayer / OMXImage . h <nl> <nl> using namespace XFILE ; <nl> using namespace std ; <nl> <nl> + class COMXImageFile ; <nl> + <nl> class COMXImage <nl> { <nl> public : <nl> - COMXImage ( ) ; <nl> - virtual ~ COMXImage ( ) ; <nl> + static COMXImageFile * LoadJpeg ( const CStdString & texturePath ) ; <nl> + static void CloseJpeg ( COMXImageFile * file ) ; <nl> <nl> - / / Required overrides <nl> - void Close ( void ) ; <nl> - bool ClampLimits ( unsigned int & width , unsigned int & height ) ; <nl> + static bool DecodeJpeg ( COMXImageFile * file , unsigned int maxWidth , unsigned int maxHeight , unsigned int stride , void * pixels ) ; <nl> + static bool CreateThumbnailFromSurface ( unsigned char * buffer , unsigned int width , unsigned int height , <nl> + unsigned int format , unsigned int pitch , const CStdString & destFile ) ; <nl> + static bool ClampLimits ( unsigned int & width , unsigned int & height , unsigned int m_width , unsigned int m_height , bool transposed = false ) ; <nl> + } ; <nl> + <nl> + class COMXImageFile <nl> + { <nl> + public : <nl> + COMXImageFile ( ) ; <nl> + virtual ~ COMXImageFile ( ) ; <nl> bool ReadFile ( const CStdString & inputFile ) ; <nl> - bool IsProgressive ( ) { return m_progressive ; } ; <nl> - bool IsAlpha ( ) { return m_alpha ; } ; <nl> int GetOrientation ( ) { return m_orientation ; } ; <nl> - unsigned int GetOriginalWidth ( ) { return m_omx_image . nFrameWidth ; } ; <nl> - unsigned int GetOriginalHeight ( ) { return m_omx_image . nFrameHeight ; } ; <nl> unsigned int GetWidth ( ) { return m_width ; } ; <nl> unsigned int GetHeight ( ) { return m_height ; } ; <nl> - OMX_IMAGE_CODINGTYPE GetCodingType ( ) ; <nl> - const uint8_t * GetImageBuffer ( ) { return ( const uint8_t * ) m_image_buffer ; } ; <nl> unsigned long GetImageSize ( ) { return m_image_size ; } ; <nl> - OMX_IMAGE_CODINGTYPE GetCompressionFormat ( ) { return m_omx_image . eCompressionFormat ; } ; <nl> - bool Decode ( unsigned int width , unsigned int height ) ; <nl> - bool Encode ( unsigned char * buffer , int size , unsigned int width , unsigned int height , unsigned int pitch ) ; <nl> - unsigned int GetDecodedWidth ( ) { return ( unsigned int ) m_decoded_format . format . image . nFrameWidth ; } ; <nl> - unsigned int GetDecodedHeight ( ) { return ( unsigned int ) m_decoded_format . format . image . nFrameHeight ; } ; <nl> - unsigned int GetDecodedStride ( ) { return ( unsigned int ) m_decoded_format . format . image . nStride ; } ; <nl> - unsigned char * GetDecodedData ( ) ; <nl> - unsigned int GetDecodedSize ( ) ; <nl> - unsigned int GetEncodedWidth ( ) { return ( unsigned int ) m_encoded_format . format . image . nFrameWidth ; } ; <nl> - unsigned int GetEncodedHeight ( ) { return ( unsigned int ) m_encoded_format . format . image . nFrameHeight ; } ; <nl> - unsigned int GetEncodedStride ( ) { return ( unsigned int ) m_encoded_format . format . image . nStride ; } ; <nl> - unsigned char * GetEncodedData ( ) ; <nl> - unsigned int GetEncodedSize ( ) ; <nl> - bool SwapBlueRed ( unsigned char * pixels , unsigned int height , unsigned int pitch , <nl> - unsigned int elements = 4 , unsigned int offset = 0 ) ; <nl> - bool CreateThumbnail ( const CStdString & sourceFile , const CStdString & destFile , <nl> - int minx , int miny , bool rotateExif ) ; <nl> - bool CreateThumbnailFromMemory ( unsigned char * buffer , unsigned int bufSize , <nl> - const CStdString & destFile , unsigned int minx , unsigned int miny ) ; <nl> - bool CreateThumbnailFromSurface ( unsigned char * buffer , unsigned int width , unsigned int height , <nl> - unsigned int format , unsigned int pitch , const CStdString & destFile ) ; <nl> + const uint8_t * GetImageBuffer ( ) { return ( const uint8_t * ) m_image_buffer ; } ; <nl> + const char * GetFilename ( ) { return m_filename ; } ; <nl> protected : <nl> - bool HandlePortSettingChange ( unsigned int resize_width , unsigned int resize_height ) ; <nl> + OMX_IMAGE_CODINGTYPE GetCodingType ( unsigned int & width , unsigned int & height ) ; <nl> uint8_t * m_image_buffer ; <nl> - bool m_is_open ; <nl> unsigned long m_image_size ; <nl> unsigned int m_width ; <nl> unsigned int m_height ; <nl> - bool m_progressive ; <nl> - bool m_alpha ; <nl> int m_orientation ; <nl> - XFILE : : CFile m_pFile ; <nl> - OMX_IMAGE_PORTDEFINITIONTYPE m_omx_image ; <nl> + const char * m_filename ; <nl> + } ; <nl> <nl> + class COMXImageDec <nl> + { <nl> + public : <nl> + COMXImageDec ( ) ; <nl> + virtual ~ COMXImageDec ( ) ; <nl> + <nl> + / / Required overrides <nl> + void Close ( ) ; <nl> + bool Decode ( const uint8_t * data , unsigned size , unsigned int width , unsigned int height , unsigned stride , void * pixels ) ; <nl> + unsigned int GetDecodedWidth ( ) { return ( unsigned int ) m_decoded_format . format . image . nFrameWidth ; } ; <nl> + unsigned int GetDecodedHeight ( ) { return ( unsigned int ) m_decoded_format . format . image . nFrameHeight ; } ; <nl> + unsigned int GetDecodedStride ( ) { return ( unsigned int ) m_decoded_format . format . image . nStride ; } ; <nl> + protected : <nl> + bool HandlePortSettingChange ( unsigned int resize_width , unsigned int resize_height ) ; <nl> / / Components <nl> COMXCoreComponent m_omx_decoder ; <nl> - COMXCoreComponent m_omx_encoder ; <nl> COMXCoreComponent m_omx_resize ; <nl> COMXCoreTunel m_omx_tunnel_decode ; <nl> OMX_BUFFERHEADERTYPE * m_decoded_buffer ; <nl> - OMX_BUFFERHEADERTYPE * m_encoded_buffer ; <nl> OMX_PARAM_PORTDEFINITIONTYPE m_decoded_format ; <nl> - OMX_PARAM_PORTDEFINITIONTYPE m_encoded_format ; <nl> + CCriticalSection m_OMXSection ; <nl> + } ; <nl> + <nl> + class COMXImageEnc <nl> + { <nl> + public : <nl> + COMXImageEnc ( ) ; <nl> + virtual ~ COMXImageEnc ( ) ; <nl> <nl> - bool m_decoder_open ; <nl> - bool m_encoder_open ; <nl> + / / Required overrides <nl> + bool CreateThumbnailFromSurface ( unsigned char * buffer , unsigned int width , unsigned int height , <nl> + unsigned int format , unsigned int pitch , const CStdString & destFile ) ; <nl> + protected : <nl> + bool Encode ( unsigned char * buffer , int size , unsigned int width , unsigned int height , unsigned int pitch ) ; <nl> + / / Components <nl> + COMXCoreComponent m_omx_encoder ; <nl> + OMX_BUFFERHEADERTYPE * m_encoded_buffer ; <nl> + OMX_PARAM_PORTDEFINITIONTYPE m_encoded_format ; <nl> + CCriticalSection m_OMXSection ; <nl> } ; <nl> <nl> # endif <nl> mmm a / xbmc / guilib / Texture . cpp <nl> ppp b / xbmc / guilib / Texture . cpp <nl> bool CBaseTexture : : LoadFromFileInternal ( const CStdString & texturePath , unsigned <nl> if ( URIUtils : : HasExtension ( texturePath , " . jpg | . tbn " ) <nl> / * | | URIUtils : : HasExtension ( texturePath , " . png " ) * / ) <nl> { <nl> - COMXImage omx_image ; <nl> - <nl> - if ( omx_image . ReadFile ( texturePath ) ) <nl> + COMXImageFile * file = COMXImage : : LoadJpeg ( texturePath ) ; <nl> + if ( file ) <nl> { <nl> - if ( omx_image . Decode ( maxWidth , maxHeight ) ) <nl> - { <nl> - Allocate ( omx_image . GetDecodedWidth ( ) , omx_image . GetDecodedHeight ( ) , XB_FMT_A8R8G8B8 ) ; <nl> - <nl> - if ( ! m_pixels ) <nl> - { <nl> - CLog : : Log ( LOGERROR , " Texture manager ( OMX ) out of memory " ) ; <nl> - omx_image . Close ( ) ; <nl> - return false ; <nl> - } <nl> - <nl> - m_originalWidth = omx_image . GetOriginalWidth ( ) ; <nl> - m_originalHeight = omx_image . GetOriginalHeight ( ) ; <nl> - <nl> - m_hasAlpha = omx_image . IsAlpha ( ) ; <nl> - <nl> - if ( autoRotate & & omx_image . GetOrientation ( ) ) <nl> - m_orientation = omx_image . GetOrientation ( ) - 1 ; <nl> - <nl> - if ( m_textureWidth ! = omx_image . GetDecodedWidth ( ) | | m_textureHeight ! = omx_image . GetDecodedHeight ( ) ) <nl> - { <nl> - unsigned int imagePitch = GetPitch ( m_imageWidth ) ; <nl> - unsigned int imageRows = GetRows ( m_imageHeight ) ; <nl> - unsigned int texturePitch = GetPitch ( m_textureWidth ) ; <nl> - <nl> - unsigned char * src = omx_image . GetDecodedData ( ) ; <nl> - unsigned char * dst = m_pixels ; <nl> - for ( unsigned int y = 0 ; y < imageRows ; y + + ) <nl> - { <nl> - memcpy ( dst , src , imagePitch ) ; <nl> - src + = imagePitch ; <nl> - dst + = texturePitch ; <nl> - } <nl> - } <nl> - else <nl> - { <nl> - if ( omx_image . GetDecodedData ( ) ) <nl> - { <nl> - int size = ( ( GetPitch ( ) * GetRows ( ) ) > omx_image . GetDecodedSize ( ) ) ? <nl> - omx_image . GetDecodedSize ( ) : ( GetPitch ( ) * GetRows ( ) ) ; <nl> - <nl> - memcpy ( m_pixels , ( unsigned char * ) omx_image . GetDecodedData ( ) , size ) ; <nl> - } <nl> - } <nl> - <nl> - omx_image . Close ( ) ; <nl> - <nl> - return true ; <nl> - } <nl> - else <nl> + bool okay = false ; <nl> + int orientation = file - > GetOrientation ( ) ; <nl> + / / limit the sizes of jpegs ( even if we fail to decode ) <nl> + COMXImage : : ClampLimits ( maxWidth , maxHeight , file - > GetWidth ( ) , file - > GetHeight ( ) , orientation & 4 ) ; <nl> + Allocate ( maxWidth , maxHeight , XB_FMT_A8R8G8B8 ) ; <nl> + if ( m_pixels & & COMXImage : : DecodeJpeg ( file , maxWidth , GetRows ( ) , GetPitch ( ) , ( void * ) m_pixels ) ) <nl> { <nl> - omx_image . Close ( ) ; <nl> + m_hasAlpha = false ; <nl> + if ( autoRotate & & orientation ) <nl> + m_orientation = orientation - 1 ; <nl> + okay = true ; <nl> } <nl> + COMXImage : : CloseJpeg ( file ) ; <nl> + if ( okay ) <nl> + return true ; <nl> } <nl> - / / this limits the sizes of jpegs we failed to decode <nl> - omx_image . ClampLimits ( maxWidth , maxHeight ) ; <nl> } <nl> # endif <nl> if ( URIUtils : : HasExtension ( texturePath , " . dds " ) ) <nl> mmm a / xbmc / pictures / Picture . cpp <nl> ppp b / xbmc / pictures / Picture . cpp <nl> bool CPicture : : CreateThumbnailFromSurface ( const unsigned char * buffer , int width <nl> if ( URIUtils : : HasExtension ( thumbFile , " . jpg " ) ) <nl> { <nl> # if defined ( HAS_OMXPLAYER ) <nl> - COMXImage * omxImage = new COMXImage ( ) ; <nl> - if ( omxImage & & omxImage - > CreateThumbnailFromSurface ( ( BYTE * ) buffer , width , height , XB_FMT_A8R8G8B8 , stride , thumbFile . c_str ( ) ) ) <nl> - { <nl> - delete omxImage ; <nl> + if ( COMXImage : : CreateThumbnailFromSurface ( ( BYTE * ) buffer , width , height , XB_FMT_A8R8G8B8 , stride , thumbFile . c_str ( ) ) ) <nl> return true ; <nl> - } <nl> - delete omxImage ; <nl> # endif <nl> } <nl> <nl> | Merge pull request from popcornmix / omximagerestructure | xbmc/xbmc | 95dcfcf4d269ad03a73fe3590b1868042137931c | 2013-10-10T03:14:39Z |
mmm a / xbmc / cores / amlplayer / AMLPlayer . cpp <nl> ppp b / xbmc / cores / amlplayer / AMLPlayer . cpp <nl> int CAMLPlayer : : UpdatePlayerInfo ( int pid , player_info_t * info ) <nl> / / we get called when status changes or after update time expires . <nl> / / static callback from libamplayer , since it does not pass an opaque , <nl> / / we have to retreve our player class reference the hard way . <nl> - CAMLPlayer * amlplayer = dynamic_cast < CAMLPlayer * > ( g_application . m_pPlayer ) ; <nl> + CAMLPlayer * amlplayer = boost : : dynamic_cast < CAMLPlayer * > ( g_application . m_pPlayer ) ; <nl> if ( amlplayer ) <nl> { <nl> CSingleLock lock ( amlplayer - > m_aml_state_csection ) ; <nl> | Merge pull request from mvdroest / patch - 2 | xbmc/xbmc | 09c76f8fccb8494284981111a51046d759d1daad | 2013-07-23T15:28:39Z |
mmm a / project / BuildDependencies / scripts / 1_copy_deps_d . bat <nl> ppp b / project / BuildDependencies / scripts / 1_copy_deps_d . bat <nl> <nl> @ ECHO OFF <nl> <nl> + IF EXIST " % XBMC_PATH % \ system \ webserver " rmdir " % XBMC_PATH % \ system \ webserver " / S / Q <nl> + <nl> rem create directories <nl> IF NOT EXIST " % XBMC_PATH % \ system \ players \ paplayer " md " % XBMC_PATH % \ system \ players \ paplayer " <nl> IF NOT EXIST " % XBMC_PATH % \ project \ VS2010Express \ XBMC \ Debug ( DirectX ) " md " % XBMC_PATH % \ project \ VS2010Express \ XBMC \ Debug ( DirectX ) " <nl> mmm a / project / BuildDependencies / scripts / libmicrohttpd_d . bat <nl> ppp b / project / BuildDependencies / scripts / libmicrohttpd_d . bat <nl> CALL dlextract . bat libmicrohttpd % FILES % <nl> <nl> cd % TMP_PATH % <nl> <nl> - xcopy libmicrohttpd - 0 . 9 . 12 - win32 \ include \ * " % CUR_PATH % \ include " / E / Q / I / Y <nl> - xcopy libmicrohttpd - 0 . 9 . 12 - win32 \ bin \ * . dll " % XBMC_PATH % \ system \ webserver " / E / Q / I / Y <nl> - copy libmicrohttpd - 0 . 9 . 12 - win32 \ lib \ libmicrohttpd . dll . lib " % CUR_PATH % \ lib \ " / Y <nl> + xcopy libmicrohttpd - 0 . 4 . 5 - win32 \ include \ * " % CUR_PATH % \ include " / E / Q / I / Y <nl> + xcopy libmicrohttpd - 0 . 4 . 5 - win32 \ bin \ * . dll " % XBMC_PATH % \ system \ webserver " / E / Q / I / Y <nl> + copy libmicrohttpd - 0 . 4 . 5 - win32 \ lib \ libmicrohttpd . dll . lib " % CUR_PATH % \ lib \ " / Y <nl> <nl> cd % LOC_PATH % <nl> mmm a / project / BuildDependencies / scripts / libmicrohttpd_d . txt <nl> ppp b / project / BuildDependencies / scripts / libmicrohttpd_d . txt <nl> <nl> ; filename source of the file <nl> - libmicrohttpd - 0 . 9 . 12 - win32 . 7z http : / / mirrors . xbmc . org / build - deps / win32 / <nl> + libmicrohttpd - 0 . 4 . 5 - win32 . 7z http : / / mirrors . xbmc . org / build - deps / win32 / <nl> mmm a / project / VS2010Express / XBMC . vcxproj <nl> ppp b / project / VS2010Express / XBMC . vcxproj <nl> <nl> < IgnoreSpecificDefaultLibraries > libc ; msvcrt ; libcmt ; msvcrtd ; msvcprtd ; % ( IgnoreSpecificDefaultLibraries ) < / IgnoreSpecificDefaultLibraries > <nl> < ModuleDefinitionFile > <nl> < / ModuleDefinitionFile > <nl> - < DelayLoadDLLs > dwmapi . dll ; libmicrohttpd - 10 . dll ; ssh . dll ; sqlite3 . dll ; libsamplerate - 0 . dll ; % ( DelayLoadDLLs ) < / DelayLoadDLLs > <nl> + < DelayLoadDLLs > dwmapi . dll ; libmicrohttpd - 5 . dll ; ssh . dll ; sqlite3 . dll ; libsamplerate - 0 . dll ; % ( DelayLoadDLLs ) < / DelayLoadDLLs > <nl> < GenerateDebugInformation > true < / GenerateDebugInformation > <nl> < ProgramDatabaseFile > $ ( OutDir ) XBMC . pdb < / ProgramDatabaseFile > <nl> < SubSystem > Windows < / SubSystem > <nl> <nl> < OutputFile > $ ( OutDir ) XBMC . exe < / OutputFile > <nl> < AdditionalLibraryDirectories > . . \ . . \ lib \ libSDL - WIN32 \ lib ; . . \ . . \ xbmc \ cores \ DSPlayer \ Libs ; % ( AdditionalLibraryDirectories ) < / AdditionalLibraryDirectories > <nl> < IgnoreSpecificDefaultLibraries > libc ; msvcrt ; libci ; msvcprt ; % ( IgnoreSpecificDefaultLibraries ) < / IgnoreSpecificDefaultLibraries > <nl> - < DelayLoadDLLs > dwmapi . dll ; libmicrohttpd - 10 . dll ; ssh . dll ; sqlite3 . dll ; libsamplerate - 0 . dll ; % ( DelayLoadDLLs ) < / DelayLoadDLLs > <nl> + < DelayLoadDLLs > dwmapi . dll ; libmicrohttpd - 5 . dll ; ssh . dll ; sqlite3 . dll ; libsamplerate - 0 . dll ; % ( DelayLoadDLLs ) < / DelayLoadDLLs > <nl> < GenerateDebugInformation > true < / GenerateDebugInformation > <nl> < ProgramDatabaseFile > $ ( OutDir ) XBMC . pdb < / ProgramDatabaseFile > <nl> < SubSystem > Windows < / SubSystem > <nl> | [ WIN32 ] switch back to libmicrohttpd 0 . 4 . 5 since 0 . 9 . 12 won ' t stop in certain cases and hang XBMC . But we download the old version via our dep downloader now . | xbmc/xbmc | b5713f38a8974a2a5ffb62b455ea48ea44b7d77f | 2011-06-26T12:44:01Z |
mmm a / osquery / tables / CMakeLists . txt <nl> ppp b / osquery / tables / CMakeLists . txt <nl> if ( APPLE ) <nl> ADD_OSQUERY_LINK_ADDITIONAL ( " - framework OpenDirectory " ) <nl> ADD_OSQUERY_LINK_ADDITIONAL ( " - framework DiskArbitration " ) <nl> <nl> - ADD_OSQUERY_LINK_ADDITIONAL ( " archive " ) <nl> + ADD_OSQUERY_LINK_ADDITIONAL ( " libresolv . dylib " ) <nl> + ADD_OSQUERY_LINK_ADDITIONAL ( " libarchive . dylib " ) <nl> ADD_OSQUERY_LINK_ADDITIONAL ( " magic " ) <nl> ADD_OSQUERY_LINK_ADDITIONAL ( " tsk " ) <nl> elseif ( FREEBSD ) <nl> else ( ) <nl> ADD_OSQUERY_LINK_ADDITIONAL ( " apt - pkg dpkg " ) <nl> endif ( ) <nl> <nl> + ADD_OSQUERY_LINK_ADDITIONAL ( " libresolv . so " ) <nl> ADD_OSQUERY_LINK_ADDITIONAL ( " blkid " ) <nl> ADD_OSQUERY_LINK_ADDITIONAL ( " cryptsetup libdevmapper . so libgcrypt . so " ) <nl> ADD_OSQUERY_LINK_ADDITIONAL ( " libuuid . so " ) <nl> new file mode 100644 <nl> index 0000000000 . . aad2e9ec51 <nl> mmm / dev / null <nl> ppp b / osquery / tables / networking / dns_resolvers . cpp <nl> <nl> + / * <nl> + * Copyright ( c ) 2014 , Facebook , Inc . <nl> + * All rights reserved . <nl> + * <nl> + * This source code is licensed under the BSD - style license found in the <nl> + * LICENSE file in the root directory of this source tree . An additional grant <nl> + * of patent rights can be found in the PATENTS file in the same directory . <nl> + * <nl> + * / <nl> + <nl> + # include < resolv . h > <nl> + <nl> + # include < osquery / core . h > <nl> + # include < osquery / tables . h > <nl> + # include < osquery / logger . h > <nl> + <nl> + # include " osquery / tables / networking / utils . h " <nl> + <nl> + namespace osquery { <nl> + namespace tables { <nl> + <nl> + QueryData genDNSResolvers ( QueryContext & context ) { <nl> + QueryData results ; <nl> + <nl> + / / libresolv will populate a global structure with resolver information . <nl> + if ( res_init ( ) = = - 1 ) { <nl> + return { } ; <nl> + } <nl> + <nl> + / / The global structure is called " _res " and is of the semi - opaque type <nl> + / / struct __res_state from the same resolv . h . An application many communicate <nl> + / / with the resolver discovery , but we are interested in the default state . <nl> + struct __res_state & rr = _res ; <nl> + if ( rr . nscount > 0 ) { <nl> + for ( size_t i = 0 ; i < static_cast < size_t > ( _res . nscount ) ; i + + ) { <nl> + Row r ; <nl> + r [ " id " ] = INTEGER ( i ) ; <nl> + r [ " type " ] = " nameserver " ; <nl> + r [ " address " ] = ipAsString ( ( const struct sockaddr * ) & _res . nsaddr_list [ i ] ) ; <nl> + r [ " netmask " ] = " 32 " ; <nl> + / / Options applies to every resolver . <nl> + r [ " options " ] = BIGINT ( _res . options ) ; <nl> + results . push_back ( r ) ; <nl> + } <nl> + } <nl> + <nl> + if ( _res . nsort > 0 ) { <nl> + for ( size_t i = 0 ; i < static_cast < size_t > ( _res . nsort ) ; i + + ) { <nl> + Row r ; <nl> + r [ " id " ] = INTEGER ( i ) ; <nl> + r [ " type " ] = " sortlist " ; <nl> + r [ " address " ] = <nl> + ipAsString ( ( const struct sockaddr * ) & _res . sort_list [ i ] . addr ) ; <nl> + r [ " netmask " ] = INTEGER ( _res . sort_list [ i ] . mask ) ; <nl> + r [ " options " ] = BIGINT ( _res . options ) ; <nl> + results . push_back ( r ) ; <nl> + } <nl> + } <nl> + <nl> + for ( size_t i = 0 ; i < MAXDNSRCH ; i + + ) { <nl> + if ( _res . dnsrch [ i ] ! = nullptr ) { <nl> + Row r ; <nl> + r [ " id " ] = INTEGER ( i ) ; <nl> + r [ " type " ] = " search " ; <nl> + r [ " address " ] = std : : string ( _res . dnsrch [ 0 ] ) ; <nl> + r [ " options " ] = BIGINT ( _res . options ) ; <nl> + results . push_back ( r ) ; <nl> + } <nl> + } <nl> + <nl> + res_close ( ) ; <nl> + return results ; <nl> + } <nl> + } <nl> + } <nl> new file mode 100644 <nl> index 0000000000 . . aa83a2eb73 <nl> mmm / dev / null <nl> ppp b / specs / dns_resolvers . table <nl> <nl> + table_name ( " dns_resolvers " ) <nl> + description ( " Resolvers used by this host " ) <nl> + schema ( [ <nl> + Column ( " id " , INTEGER , " Address type index or order " ) , <nl> + Column ( " type " , TEXT , " Address type : sortlist , nameserver , search " ) , <nl> + Column ( " address " , TEXT , " Resolver IP / IPv6 address " ) , <nl> + Column ( " netmask " , TEXT , " Address ( sortlist ) netmask length " ) , <nl> + Column ( " options " , BIGINT , " Resolver options " ) , <nl> + ] ) <nl> + implementation ( " dns_resolvers @ genDNSResolvers " ) <nl> | Merge pull request from theopolis / dns | osquery/osquery | 09788cd0008962f58df57aa0e3c1d42dc21a2bfe | 2016-02-09T17:38:26Z |
mmm a / include / swift / SIL / SILValue . h <nl> ppp b / include / swift / SIL / SILValue . h <nl> class alignas ( 8 ) ValueBase : public SILAllocated < ValueBase > { <nl> <nl> static bool classof ( const ValueBase * V ) { return true ; } <nl> <nl> + / / If this is a SILArgument or a SILInstruction get its parent basic block , <nl> + / / otherwise return null . <nl> SILBasicBlock * getParentBB ( ) ; <nl> } ; <nl> <nl> | Document ValueBase : : getParentBB | apple/swift | 855657511a22ac645798e74416ec3206bc5d2f83 | 2014-09-12T21:12:11Z |
mmm a / src / library_pthread . js <nl> ppp b / src / library_pthread . js <nl> var LibraryPThread = { <nl> / / signature pointer , and vararg buffer pointer , in that order . <nl> var sigPtr = _emscripten_receive_on_main_thread_js_callArgs [ 1 ] ; <nl> var varargPtr = _emscripten_receive_on_main_thread_js_callArgs [ 2 ] ; <nl> - var args = readAsmConstArgs ( sigPtr , varargPtr ) ; <nl> - return func . apply ( null , args ) ; <nl> + var constArgs = readAsmConstArgs ( sigPtr , varargPtr ) ; <nl> + return func . apply ( null , constArgs ) ; <nl> } <nl> # endif <nl> # if ASSERTIONS <nl> | Rename args to constArgs to avoid name conflicts ( ) | emscripten-core/emscripten | 0974b3f71624bf3eca37ca9b61452257e443c815 | 2019-10-11T00:25:30Z |
mmm a / tensorflow / core / kernels / variable_ops . cc <nl> ppp b / tensorflow / core / kernels / variable_ops . cc <nl> TF_CALL_GPU_NUMBER_TYPES_NO_HALF ( REGISTER_SYCL_KERNEL ) ; <nl> . HostMemory ( " is_initialized " ) , \ <nl> IsVariableInitializedOp ) ; <nl> <nl> - TF_CALL_GPU_NUMBER_TYPES ( REGISTER_GPU_KERNELS ) ; <nl> + TF_CALL_GPU_ALL_TYPES ( REGISTER_GPU_KERNELS ) ; <nl> TF_CALL_int64 ( REGISTER_GPU_KERNELS ) ; <nl> TF_CALL_uint32 ( REGISTER_GPU_KERNELS ) ; <nl> # undef REGISTER_GPU_KERNELS <nl> | Use TF_CALL_GPU_ALL_TYPES for variable ops | tensorflow/tensorflow | d89a1aa53ec30324eedf9d2b8c30ce4d608c107c | 2020-04-23T20:24:06Z |
mmm a / arangod / Aql / IndexBlock . cpp <nl> ppp b / arangod / Aql / IndexBlock . cpp <nl> IndexBlock : : IndexBlock ( ExecutionEngine * engine , IndexNode const * en ) <nl> _hasV8Expression ( false ) , <nl> _indexesExhausted ( false ) , <nl> _isLastIndex ( false ) , <nl> + _returned ( 0 ) , <nl> _collector ( & _engine - > _itemBlockManager ) { <nl> _mmdr . reset ( new ManagedDocumentResult ) ; <nl> <nl> | Fixed initialisation of Member variable in IndexBlock | arangodb/arangodb | 8daa3820c7c505b8379e34144e98c4123a7f9410 | 2017-04-05T07:33:50Z |
mmm a / Makefile <nl> ppp b / Makefile <nl> os . o : src / os . cpp <nl> <nl> . PHONY : clean <nl> clean : <nl> - rm - f * . o testlog <nl> + rm - f * . o libc11log . a testlog <nl> | small fix | gabime/spdlog | bbfa3f49bec04d7f273a50aa9b069c08a6f1575b | 2014-01-26T19:33:57Z |
mmm a / src / share / human_interface_device . hpp <nl> ppp b / src / share / human_interface_device . hpp <nl> class human_interface_device final { <nl> IOHIDDeviceRef _Nonnull device ) : logger_ ( logger ) , <nl> device_ ( device ) , <nl> registry_entry_id_ ( 0 ) , <nl> + modifier_flags_queue_ ( nullptr ) , <nl> queue_ ( nullptr ) , <nl> is_grabbable_log_reducer_ ( logger ) , <nl> observed_ ( false ) , <nl> class human_interface_device final { <nl> / / setup queue_ <nl> <nl> const CFIndex depth = 1024 ; <nl> + <nl> + modifier_flags_queue_ = IOHIDQueueCreate ( kCFAllocatorDefault , device_ , depth , kIOHIDOptionsTypeNone ) ; <nl> queue_ = IOHIDQueueCreate ( kCFAllocatorDefault , device_ , depth , kIOHIDOptionsTypeNone ) ; <nl> - if ( ! queue_ ) { <nl> + if ( ! modifier_flags_queue_ | | ! queue_ ) { <nl> logger_ . error ( " IOHIDQueueCreate error @ { 0 } " , __PRETTY_FUNCTION__ ) ; <nl> } else { <nl> / / Add elements into queue_ . <nl> for ( const auto & it : elements_ ) { <nl> - IOHIDQueueAddElement ( queue_ , it . second ) ; <nl> + bool is_modifier = false ; <nl> + <nl> + auto usage_page = IOHIDElementGetUsagePage ( it . second ) ; <nl> + auto usage = IOHIDElementGetUsage ( it . second ) ; <nl> + if ( auto key_code = krbn : : types : : get_key_code ( usage_page , usage ) ) { <nl> + if ( krbn : : types : : get_modifier_flag ( * key_code ) ! = krbn : : modifier_flag : : zero ) { <nl> + is_modifier = true ; <nl> + } <nl> + } <nl> + <nl> + if ( is_modifier ) { <nl> + IOHIDQueueAddElement ( modifier_flags_queue_ , it . second ) ; <nl> + } else { <nl> + IOHIDQueueAddElement ( queue_ , it . second ) ; <nl> + } <nl> } <nl> + IOHIDQueueRegisterValueAvailableCallback ( modifier_flags_queue_ , static_queue_value_available_callback , this ) ; <nl> IOHIDQueueRegisterValueAvailableCallback ( queue_ , static_queue_value_available_callback , this ) ; <nl> } <nl> } <nl> class human_interface_device final { <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> / / release queue_ <nl> <nl> + if ( modifier_flags_queue_ ) { <nl> + CFRelease ( modifier_flags_queue_ ) ; <nl> + modifier_flags_queue_ = nullptr ; <nl> + } <nl> if ( queue_ ) { <nl> CFRelease ( queue_ ) ; <nl> queue_ = nullptr ; <nl> class human_interface_device final { <nl> void schedule ( void ) { <nl> gcd_utility : : dispatch_sync_in_main_queue ( ^ { <nl> IOHIDDeviceScheduleWithRunLoop ( device_ , CFRunLoopGetMain ( ) , kCFRunLoopDefaultMode ) ; <nl> + if ( modifier_flags_queue_ ) { <nl> + IOHIDQueueScheduleWithRunLoop ( modifier_flags_queue_ , CFRunLoopGetMain ( ) , kCFRunLoopDefaultMode ) ; <nl> + } <nl> if ( queue_ ) { <nl> IOHIDQueueScheduleWithRunLoop ( queue_ , CFRunLoopGetMain ( ) , kCFRunLoopDefaultMode ) ; <nl> } <nl> class human_interface_device final { <nl> <nl> void unschedule ( void ) { <nl> gcd_utility : : dispatch_sync_in_main_queue ( ^ { <nl> + if ( modifier_flags_queue_ ) { <nl> + IOHIDQueueUnscheduleFromRunLoop ( modifier_flags_queue_ , CFRunLoopGetMain ( ) , kCFRunLoopDefaultMode ) ; <nl> + } <nl> if ( queue_ ) { <nl> IOHIDQueueUnscheduleFromRunLoop ( queue_ , CFRunLoopGetMain ( ) , kCFRunLoopDefaultMode ) ; <nl> } <nl> class human_interface_device final { <nl> <nl> void queue_start ( void ) { <nl> gcd_utility : : dispatch_sync_in_main_queue ( ^ { <nl> + if ( modifier_flags_queue_ ) { <nl> + IOHIDQueueStart ( modifier_flags_queue_ ) ; <nl> + } <nl> if ( queue_ ) { <nl> IOHIDQueueStart ( queue_ ) ; <nl> } <nl> class human_interface_device final { <nl> <nl> void queue_stop ( void ) { <nl> gcd_utility : : dispatch_sync_in_main_queue ( ^ { <nl> + if ( modifier_flags_queue_ ) { <nl> + IOHIDQueueStop ( modifier_flags_queue_ ) ; <nl> + } <nl> if ( queue_ ) { <nl> IOHIDQueueStop ( queue_ ) ; <nl> } <nl> class human_interface_device final { <nl> return ; <nl> } <nl> <nl> - auto queue = static_cast < IOHIDQueueRef > ( sender ) ; <nl> - if ( ! queue ) { <nl> - return ; <nl> - } <nl> - <nl> - self - > queue_value_available_callback ( queue ) ; <nl> + / / We have to separate modifier flags queue and generic queue . <nl> + / / <nl> + / / Some devices are send modifier flag and key at the same report . <nl> + / / For example , a key sends control + up - arrow by this reports . <nl> + / / <nl> + / / modifiers : 0x0 <nl> + / / keys : 0x0 0x0 0x0 0x0 0x0 0x0 <nl> + / / <nl> + / / modifiers : 0x1 <nl> + / / keys : 0x52 0x0 0x0 0x0 0x0 0x0 <nl> + / / <nl> + / / In this case , macOS does not guarantee the value event order to be modifier first . <nl> + / / At least macOS 10 . 12 or prior sends the up - arrow event first . <nl> + / / <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> + / / Example of hid value events in a single queue at control + up - arrow <nl> + / / <nl> + / / 1 . up - arrow keydown <nl> + / / usage_page : 0x7 <nl> + / / usage : 0x4f <nl> + / / integer_value : 1 <nl> + / / <nl> + / / 2 . control keydown <nl> + / / usage_page : 0x7 <nl> + / / usage : 0xe1 <nl> + / / integer_value : 1 <nl> + / / <nl> + / / 3 . up - arrow keyup <nl> + / / usage_page : 0x7 <nl> + / / usage : 0x4f <nl> + / / integer_value : 0 <nl> + / / <nl> + / / 4 . control keyup <nl> + / / usage_page : 0x7 <nl> + / / usage : 0xe1 <nl> + / / integer_value : 0 <nl> + / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - <nl> + / / <nl> + / / These events will not be interpreted as intended in this order . <nl> + / / Thus , we have to reorder the events using two separate queues . <nl> + <nl> + self - > queue_value_available_callback ( self - > modifier_flags_queue_ ) ; <nl> + self - > queue_value_available_callback ( self - > queue_ ) ; <nl> } <nl> <nl> void queue_value_available_callback ( IOHIDQueueRef _Nonnull queue ) { <nl> class human_interface_device final { <nl> <nl> IOHIDDeviceRef _Nonnull device_ ; <nl> uint64_t registry_entry_id_ ; <nl> + IOHIDQueueRef _Nullable modifier_flags_queue_ ; <nl> IOHIDQueueRef _Nullable queue_ ; <nl> std : : unordered_map < uint64_t , IOHIDElementRef > elements_ ; <nl> <nl> | add modifier_flags_queue_ into human_interface_device | pqrs-org/Karabiner-Elements | 7d7c43d1977facdf1337cc1804dbd6bdc7beaf25 | 2017-01-03T05:05:24Z |
mmm a / jstests / slowNightly / sharding_passthrough . js <nl> ppp b / jstests / slowNightly / sharding_passthrough . js <nl> files . forEach ( <nl> * clean ( apitest_dbcollection ) <nl> * logout and getnonce <nl> * / <nl> - if ( / [ \ / \ \ ] ( error3 | capped . * | splitvector | apitest_db | cursor6 | copydb - auth | profile \ d * | dbhash | median | apitest_dbcollection | evalb | evald | eval_nolock | auth1 | auth2 | dropdb_race | unix_socket \ d * ) \ . js $ / . test ( x . name ) ) { <nl> + if ( / [ \ / \ \ ] ( error3 | capped . * | apitest_db | cursor6 | copydb - auth | profile \ d * | dbhash | median | apitest_dbcollection | evalb | evald | eval_nolock | auth1 | auth2 | dropdb_race | unix_socket \ d * ) \ . js $ / . test ( x . name ) ) { <nl> print ( " ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! skipping test that has failed under sharding but might not anymore " + x . name ) <nl> return ; <nl> } <nl> files . forEach ( <nl> return ; <nl> } <nl> / / These aren ' t supposed to get run under sharding : <nl> - if ( / [ \ / \ \ ] ( dbadmin | error1 | fsync | fsync2 | geo . * | indexh | remove5 | update4 | loglong | notablescan | compact . * | check_shard_index | bench_test . * | mr_replaceIntoDB | mr_auth ) \ . js $ / . test ( x . name ) ) { <nl> + if ( / [ \ / \ \ ] ( dbadmin | error1 | fsync | fsync2 | geo . * | indexh | remove5 | update4 | loglong | bnotablescan | compact . * | check_shard_index | bench_test . * | mr_replaceIntoDB | mr_auth ) \ . js $ / . test ( x . name ) ) { <nl> print ( " > > > > > > > > > > > > > > > skipping test that would correctly fail under sharding " + x . name ) <nl> return ; <nl> } <nl> mmm a / src / mongo / s / commands_public . cpp <nl> ppp b / src / mongo / s / commands_public . cpp <nl> namespace mongo { <nl> <nl> } groupCmd ; <nl> <nl> + class SplitVectorCmd : public NotAllowedOnShardedCollectionCmd { <nl> + public : <nl> + SplitVectorCmd ( ) : NotAllowedOnShardedCollectionCmd ( " splitVector " ) { } <nl> + virtual bool passOptions ( ) const { return true ; } <nl> + virtual string getFullNS ( const string & dbName , const BSONObj & cmdObj ) { <nl> + return cmdObj . firstElement ( ) . valuestrsafe ( ) ; <nl> + } <nl> + <nl> + } splitVectorCmd ; <nl> + <nl> + <nl> class DistinctCmd : public PublicGridCommand { <nl> public : <nl> DistinctCmd ( ) : PublicGridCommand ( " distinct " ) { } <nl> | SERVER - 4841 allow splitVector via mongos for non - sharded collections | mongodb/mongo | f5e212e1b2a71f22b5a48bc8ef79632d2bc81220 | 2012-03-02T17:00:46Z |
mmm a / core / os / midi_driver . cpp <nl> ppp b / core / os / midi_driver . cpp <nl> void MIDIDriver : : receive_input_packet ( uint64_t timestamp , uint8_t * data , uint32_ <nl> if ( length > = 3 ) { <nl> event - > set_pitch ( data [ 1 ] ) ; <nl> event - > set_velocity ( data [ 2 ] ) ; <nl> + <nl> + if ( event - > get_message ( ) = = MIDI_MESSAGE_NOTE_ON & & event - > get_velocity ( ) = = 0 ) { <nl> + / / https : / / www . midi . org / forum / 228 - writing - midi - software - send - note - off , - or - zero - velocity - note - on <nl> + event - > set_message ( MIDI_MESSAGE_NOTE_OFF ) ; <nl> + } <nl> } <nl> break ; <nl> <nl> | Fix MIDI Note Off missing on some devices | godotengine/godot | ea0c398a196358a34e40dc7b93426913f11c160a | 2019-03-18T18:54:32Z |
mmm a / db / dbcommands . cpp <nl> ppp b / db / dbcommands . cpp <nl> namespace mongo { <nl> uassert ( 13330 , " upsert mode requires query field " , ! origQuery . isEmpty ( ) ) ; <nl> db . update ( ns , origQuery , update . embeddedObjectUserCheck ( ) , true ) ; <nl> <nl> - if ( cmdObj [ " new " ] . trueValue ( ) ) { <nl> - BSONObj gle = db . getLastErrorDetailed ( ) ; <nl> + BSONObj gle = db . getLastErrorDetailed ( ) ; <nl> + if ( gle [ " err " ] . type ( ) = = String ) { <nl> + errmsg = gle [ " err " ] . String ( ) ; <nl> + return false ; <nl> + } <nl> <nl> + if ( cmdObj [ " new " ] . trueValue ( ) ) { <nl> BSONElement _id = gle [ " upserted " ] ; <nl> if ( _id . eoo ( ) ) <nl> _id = origQuery [ " _id " ] ; <nl> namespace mongo { <nl> uassert ( 12516 , " must specify remove or update " , ! update . eoo ( ) ) ; <nl> db . update ( ns , q , update . embeddedObjectUserCheck ( ) ) ; <nl> <nl> + BSONObj gle = db . getLastErrorDetailed ( ) ; <nl> + if ( gle [ " err " ] . type ( ) = = String ) { <nl> + errmsg = gle [ " err " ] . String ( ) ; <nl> + return false ; <nl> + } <nl> + <nl> if ( cmdObj [ " new " ] . trueValue ( ) ) <nl> out = db . findOne ( ns , idQuery , fields ) ; <nl> } <nl> | Pass through update error messages in findAndModify SERVER - 1777 | mongodb/mongo | 5c2e25e81c161c8f3b0f5b0df585fb62ac197a5b | 2010-09-23T23:38:07Z |
mmm a / include / rapidjson / document . h <nl> ppp b / include / rapidjson / document . h <nl> <nl> <nl> # include " reader . h " <nl> # include " internal / strfunc . h " <nl> + # include < new > / / placement new <nl> <nl> # ifdef _MSC_VER <nl> # pragma warning ( push ) <nl> | Added # include < new > for placement new operator . | Tencent/rapidjson | 23056abad12c5bddf73e00b728d1d53c712627a5 | 2012-11-16T14:33:03Z |
mmm a / . circleci / config . yml <nl> ppp b / . circleci / config . yml <nl> <nl> # Build machines configs . <nl> docker - image : & docker - image <nl> docker : <nl> - - image : electronbuilds / electron : 0 . 0 . 9 <nl> + - image : electronbuilds / electron : 0 . 0 . 10 <nl> <nl> machine - linux - medium : & machine - linux - medium <nl> < < : * docker - image <nl> mmm a / BUILD . gn <nl> ppp b / BUILD . gn <nl> <nl> import ( " / / build / config / locales . gni " ) <nl> import ( " / / build / config / ui . gni " ) <nl> import ( " / / build / config / win / manifest . gni " ) <nl> + import ( " / / content / public / app / mac_helpers . gni " ) <nl> import ( " / / pdf / features . gni " ) <nl> import ( " / / printing / buildflags / buildflags . gni " ) <nl> import ( " / / third_party / ffmpeg / ffmpeg_options . gni " ) <nl> static_library ( " electron_lib " ) { <nl> if ( is_mac ) { <nl> deps + = [ <nl> " / / components / remote_cocoa / app_shim " , <nl> + " / / content / common : mac_helpers " , <nl> " / / ui / accelerated_widget_mac " , <nl> ] <nl> sources + = [ <nl> static_library ( " electron_lib " ) { <nl> ] <nl> configs + = [ " : gio_unix " ] <nl> include_dirs + = [ " / / third_party / breakpad " ] <nl> + configs + = [ " / / build / config / linux : x11 " ] <nl> defines + = [ <nl> # Disable warnings for g_settings_list_schemas . <nl> " GLIB_DISABLE_DEPRECATION_WARNINGS " , <nl> if ( is_mac ) { <nl> } <nl> } <nl> <nl> - mac_app_bundle ( " electron_helper_app " ) { <nl> - output_name = electron_helper_name <nl> - deps = [ <nl> - " : electron_framework + link " , <nl> - ] <nl> - if ( ! is_mas_build ) { <nl> - deps + = [ " / / sandbox / mac : seatbelt " ] <nl> - } <nl> - defines = [ " HELPER_EXECUTABLE " ] <nl> - sources = filenames . app_sources <nl> - sources + = [ " shell / common / atom_constants . cc " ] <nl> - include_dirs = [ " . " ] <nl> - info_plist = " shell / renderer / resources / mac / Info . plist " <nl> - extra_substitutions = <nl> - [ " ELECTRON_BUNDLE_ID = $ electron_mac_bundle_id . helper " ] <nl> - ldflags = [ <nl> - " - rpath " , <nl> - " @ executable_path / . . / . . / . . " , <nl> - ] <nl> - if ( is_component_build ) { <nl> - ldflags + = [ <nl> + template ( " electron_helper_app " ) { <nl> + mac_app_bundle ( target_name ) { <nl> + assert ( defined ( invoker . helper_name_suffix ) ) <nl> + <nl> + output_name = electron_helper_name + invoker . helper_name_suffix <nl> + deps = [ <nl> + " : electron_framework + link " , <nl> + ] <nl> + if ( ! is_mas_build ) { <nl> + deps + = [ " / / sandbox / mac : seatbelt " ] <nl> + } <nl> + defines = [ " HELPER_EXECUTABLE " ] <nl> + sources = filenames . app_sources <nl> + sources + = [ " shell / common / atom_constants . cc " ] <nl> + include_dirs = [ " . " ] <nl> + info_plist = " shell / renderer / resources / mac / Info . plist " <nl> + extra_substitutions = <nl> + [ " ELECTRON_BUNDLE_ID = $ electron_mac_bundle_id . helper " ] <nl> + ldflags = [ <nl> " - rpath " , <nl> - " @ executable_path / . . / . . / . . / . . / . . / . . " , <nl> + " @ executable_path / . . / . . / . . " , <nl> ] <nl> + if ( is_component_build ) { <nl> + ldflags + = [ <nl> + " - rpath " , <nl> + " @ executable_path / . . / . . / . . / . . / . . / . . " , <nl> + ] <nl> + } <nl> + } <nl> + } <nl> + <nl> + foreach ( helper_params , content_mac_helpers ) { <nl> + _helper_target = helper_params [ 0 ] <nl> + _helper_bundle_id = helper_params [ 1 ] <nl> + _helper_suffix = helper_params [ 2 ] <nl> + electron_helper_app ( " electron_helper_app_ $ { _helper_target } " ) { <nl> + helper_name_suffix = _helper_suffix <nl> } <nl> } <nl> <nl> bundle_data ( " electron_app_framework_bundle_data " ) { <nl> sources = [ <nl> " $ root_out_dir / $ electron_framework_name . framework " , <nl> - " $ root_out_dir / $ electron_helper_name . app " , <nl> ] <nl> if ( ! is_mas_build ) { <nl> sources + = [ <nl> if ( is_mac ) { <nl> ] <nl> public_deps = [ <nl> " : electron_framework + link " , <nl> - " : electron_helper_app " , <nl> ] <nl> + <nl> + foreach ( helper_params , content_mac_helpers ) { <nl> + sources + = <nl> + [ " $ root_out_dir / $ { electron_helper_name } $ { helper_params [ 2 ] } . app " ] <nl> + public_deps + = [ " : electron_helper_app_ $ { helper_params [ 0 ] } " ] <nl> + } <nl> } <nl> <nl> mac_app_bundle ( " electron_login_helper " ) { <nl> if ( is_mac ) { <nl> if ( is_win ) { <nl> sources + = [ <nl> # TODO : we should be generating our . rc files more like how chrome does <nl> - " shell / browser / resources / win / atom . ico " , <nl> " shell / browser / resources / win / atom . rc " , <nl> " shell / browser / resources / win / resource . h " , <nl> ] <nl> if ( is_mac ) { <nl> # See https : / / github . com / nodejs / node - gyp / commit / 52ceec3a6d15de3a8f385f43dbe5ecf5456ad07a <nl> ldflags + = [ " / DEF : " + rebase_path ( " build / electron . def " , root_build_dir ) ] <nl> inputs = [ <nl> + " shell / browser / resources / win / atom . ico " , <nl> " build / electron . def " , <nl> ] <nl> } <nl> mmm a / DEPS <nl> ppp b / DEPS <nl> gclient_gn_args = [ <nl> <nl> vars = { <nl> ' chromium_version ' : <nl> - ' f200986dfaabd6aad6a4b37dad7aae42fec349e9 ' , <nl> + ' 3062b7cf090f1d9522c04ca8fa0a906f88ababe9 ' , <nl> ' node_version ' : <nl> - ' 0a300f60bce0c8f0cb3d846fcb0e1f55f26013ee ' , <nl> + ' f4a3ef181f7e52663034aff129d6b91230a318bd ' , <nl> ' nan_version ' : <nl> ' 2ee313aaca52e2b478965ac50eb5082520380d1b ' , <nl> <nl> mmm a / Dockerfile <nl> ppp b / Dockerfile <nl> RUN chmod a + rwx / tmp <nl> # Install Linux packages <nl> ADD build / install - build - deps . sh / setup / install - build - deps . sh <nl> RUN echo ttf - mscorefonts - installer msttcorefonts / accepted - mscorefonts - eula select true | debconf - set - selections <nl> + RUN dpkg - - add - architecture i386 <nl> RUN apt - get update & & DEBIAN_FRONTEND = noninteractive apt - get install - y \ <nl> curl \ <nl> libnotify - bin \ <nl> RUN apt - get update & & DEBIAN_FRONTEND = noninteractive apt - get install - y \ <nl> sudo \ <nl> vim - nox \ <nl> wget \ <nl> + g + + - multilib \ <nl> + libgl1 : i386 \ <nl> & & / setup / install - build - deps . sh - - syms - - no - prompt - - no - chromeos - fonts - - lib32 - - arm \ <nl> & & rm - rf / var / lib / apt / lists / * <nl> <nl> mmm a / appveyor . yml <nl> ppp b / appveyor . yml <nl> <nl> <nl> version : 1 . 0 . { build } <nl> build_cloud : libcc - 20 <nl> - image : libcc - 20 - vs2017 - 15 . 9 <nl> + image : vs2017 - 15 . 9 - 10 . 0 . 18362 <nl> environment : <nl> GIT_CACHE_PATH : C : \ Users \ electron \ libcc_cache <nl> ELECTRON_OUT_DIR : Default <nl> build_script : <nl> - echo " Building $ env : GN_CONFIG build " <nl> - git config - - global core . longpaths true <nl> - cd . . <nl> - - ps : if ( Test - Path src \ electron ) { Remove - Item src \ electron - Recurse } <nl> + - mkdir src <nl> - ps : Move - Item $ env : APPVEYOR_BUILD_FOLDER - Destination src \ electron <nl> - ps : $ env : CHROMIUM_BUILDTOOLS_PATH = " $ pwd \ src \ buildtools " <nl> - ps : $ env : SCCACHE_PATH = " $ pwd \ src \ electron \ external_binaries \ sccache . exe " <nl> mmm a / chromium_src / BUILD . gn <nl> ppp b / chromium_src / BUILD . gn <nl> static_library ( " chrome " ) { <nl> " / / chrome / browser / ui / cocoa / color_chooser_mac . h " , <nl> " / / chrome / browser / ui / cocoa / color_chooser_mac . mm " , <nl> ] <nl> + deps + = [ <nl> + " / / components / remote_cocoa / app_shim " , <nl> + " / / components / remote_cocoa / browser " , <nl> + ] <nl> } <nl> <nl> if ( is_win ) { <nl> mmm a / docs / api / breaking - changes . md <nl> ppp b / docs / api / breaking - changes . md <nl> webFrame . setIsolatedWorldInfo ( <nl> } ) <nl> ` ` ` <nl> <nl> + # # # Removal of deprecated ` marked ` property on getBlinkMemoryInfo <nl> + <nl> + This property was removed in Chromium 77 , and as such is no longer available . <nl> + <nl> # # Planned Breaking API Changes ( 6 . 0 ) <nl> <nl> # # # ` win . setMenu ( null ) ` <nl> mmm a / lib / browser / chrome - extension . js <nl> ppp b / lib / browser / chrome - extension . js <nl> const loadDevToolsExtensions = function ( win , manifests ) { <nl> extensionInfoArray . forEach ( ( extension ) = > { <nl> win . devToolsWebContents . _grantOriginAccess ( extension . startPage ) <nl> } ) <nl> - win . devToolsWebContents . executeJavaScript ( ` InspectorFrontendAPI . addExtensions ( $ { JSON . stringify ( extensionInfoArray ) } ) ` ) <nl> + <nl> + extensionInfoArray . forEach ( ( extensionInfo ) = > { <nl> + win . devToolsWebContents . executeJavaScript ( ` Extensions . extensionServer . _addExtension ( $ { JSON . stringify ( extensionInfo ) } ) ` ) <nl> + } ) <nl> } <nl> <nl> app . on ( ' web - contents - created ' , function ( event , webContents ) { <nl> mmm a / patches / chromium / . patches <nl> ppp b / patches / chromium / . patches <nl> command - ismediakey . patch <nl> tts . patch <nl> printing . patch <nl> verbose_generate_breakpad_symbols . patch <nl> - content_allow_embedder_to_prevent_locking_scheme_registry . patch <nl> support_mixed_sandbox_with_zygote . patch <nl> disable_color_correct_rendering . patch <nl> autofill_size_calculation . patch <nl> - revert_build_swiftshader_for_arm32 . patch <nl> fix_disable_usage_of_abort_report_np_in_mas_builds . patch <nl> fix_disable_usage_of_pthread_fchdir_np_and_pthread_chdir_np_in_mas . patch <nl> fix_disable_usage_of_setapplicationisdaemon_and . patch <nl> worker_context_will_destroy . patch <nl> fix_breakpad_symbol_generation_on_linux_arm . patch <nl> frame_host_manager . patch <nl> cross_site_document_resource_handler . patch <nl> - woa_compiler_workaround . patch <nl> crashpad_pid_check . patch <nl> chore_add_debounce_on_the_updatewebcontentsvisibility_method_to . patch <nl> network_service_allow_remote_certificate_verification_logic . patch <nl> + put_back_deleted_colors_for_autofill . patch <nl> + fix_re - add_endauxattributes_to_fix_gpu_info_enumeration . patch <nl> mmm a / patches / chromium / accelerator . patch <nl> ppp b / patches / chromium / accelerator . patch <nl> This patch makes three changes to Accelerator : : GetShortcutText to improve shortc <nl> 3 . Ctrl - Shift - = should show as Ctrl - + <nl> <nl> - + mmm a / ui / base / accelerators / accelerator . cc <nl> ppp b / ui / base / accelerators / accelerator . cc <nl> <nl> index dadc140e9429c166ecd4c653c9ef5d0d4c4db2a4 . . bc93a9ecb28ff6973fc4d15f67a17d54 <nl> namespace ui { <nl> <nl> base : : string16 Accelerator : : GetShortcutText ( ) const { <nl> - shortcut = KeyCodeToName ( key_code_ ) ; <nl> + shortcut = KeyCodeToName ( ) ; <nl> # endif <nl> <nl> + unsigned int flags = 0 ; <nl> index dadc140e9429c166ecd4c653c9ef5d0d4c4db2a4 . . bc93a9ecb28ff6973fc4d15f67a17d54 <nl> } <nl> <nl> / / Checking whether the character used for the accelerator is alphanumeric . <nl> - base : : string16 Accelerator : : ApplyLongFormModifiers ( <nl> + base : : string16 Accelerator : : ApplyLongFormModifiers ( <nl> / / more information . <nl> if ( IsCtrlDown ( ) ) <nl> shortcut = ApplyModifierToAcceleratorString ( shortcut , IDS_APP_CTRL_KEY ) ; <nl> mmm a / patches / chromium / add_contentgpuclient_precreatemessageloop_callback . patch <nl> ppp b / patches / chromium / add_contentgpuclient_precreatemessageloop_callback . patch <nl> Allows Electron to restore WER when ELECTRON_DEFAULT_ERROR_MODE is set . <nl> This should be upstreamed <nl> <nl> - + mmm a / content / gpu / gpu_main . cc <nl> ppp b / content / gpu / gpu_main . cc <nl> - int GpuMain ( const MainFunctionParams & parameters ) { <nl> + int GpuMain ( const MainFunctionParams & parameters ) { <nl> <nl> logging : : SetLogMessageHandler ( GpuProcessLogMessageHandler ) ; <nl> <nl> index 82f0c4f62be2f210db2c3ed1169c2a816c59cf1f . . 20dcb7dd1ee1172cfbf263f14724dd47 <nl> + client - > PreCreateMessageLoop ( ) ; <nl> + <nl> / / We are experiencing what appear to be memory - stomp issues in the GPU <nl> - / / process . These issues seem to be impacting the message loop and listeners <nl> - / / registered to it . Create the message loop on the heap to guard against <nl> - int GpuMain ( const MainFunctionParams & parameters ) { <nl> - <nl> + / / process . These issues seem to be impacting the task executor and listeners <nl> + / / registered to it . Create the task executor on the heap to guard against <nl> + int GpuMain ( const MainFunctionParams & parameters ) { <nl> + : base : : ThreadPriority : : NORMAL ; <nl> GpuProcess gpu_process ( io_thread_priority ) ; <nl> <nl> - auto * client = GetContentClient ( ) - > gpu ( ) ; <nl> mmm a / patches / chromium / add_realloc . patch <nl> ppp b / patches / chromium / add_realloc . patch <nl> index 2aef366ac8194aa261cbca6abc051f7da8a988d3 . . 3c7d66c81032636abcca4f1538ce9b7f <nl> <nl> GIN_EXPORT static ArrayBufferAllocator * SharedInstance ( ) ; <nl> - + mmm a / third_party / blink / renderer / bindings / core / v8 / v8_initializer . cc <nl> ppp b / third_party / blink / renderer / bindings / core / v8 / v8_initializer . cc <nl> - class ArrayBufferAllocator : public v8 : : ArrayBuffer : : Allocator { <nl> + class ArrayBufferAllocator : public v8 : : ArrayBuffer : : Allocator { <nl> size , WTF : : ArrayBufferContents : : kDontInitialize ) ; <nl> } <nl> <nl> index 0031242152ce5190b0dfc77b53af2d984e5fad82 . . a6370ec793ce6c38eb7dab189583ea11 <nl> Partitions : : ArrayBufferPartition ( ) - > Free ( data ) ; <nl> } <nl> - + mmm a / third_party / blink / renderer / platform / wtf / typed_arrays / array_buffer_contents . h <nl> ppp b / third_party / blink / renderer / platform / wtf / typed_arrays / array_buffer_contents . h <nl> class WTF_EXPORT ArrayBufferContents { <nl> mmm a / patches / chromium / allow_webview_file_url . patch <nl> ppp b / patches / chromium / allow_webview_file_url . patch <nl> Subject : allow_webview_file_url . patch <nl> Allow webview to load non - web URLs . <nl> <nl> - + mmm a / content / browser / loader / resource_dispatcher_host_impl . cc <nl> ppp b / content / browser / loader / resource_dispatcher_host_impl . cc <nl> void ResourceDispatcherHostImpl : : BeginNavigationRequest ( <nl> mmm a / patches / chromium / blink - worker - enable - csp - in - file - scheme . patch <nl> ppp b / patches / chromium / blink - worker - enable - csp - in - file - scheme . patch <nl> Subject : blink - worker - enable - csp - in - file - scheme . patch <nl> <nl> <nl> - + mmm a / third_party / blink / renderer / core / workers / worker_classic_script_loader . cc <nl> ppp b / third_party / blink / renderer / core / workers / worker_classic_script_loader . cc <nl> void WorkerClassicScriptLoader : : ProcessContentSecurityPolicy ( <nl> mmm a / patches / chromium / blink_local_frame . patch <nl> ppp b / patches / chromium / blink_local_frame . patch <nl> when there is code doing that . <nl> This patch reverts the change to fix the crash in Electron . <nl> <nl> - + mmm a / third_party / blink / renderer / core / frame / local_frame . cc <nl> ppp b / third_party / blink / renderer / core / frame / local_frame . cc <nl> - void LocalFrame : : DetachImpl ( FrameDetachType type ) { <nl> + void LocalFrame : : DetachImpl ( FrameDetachType type ) { <nl> } <nl> CHECK ( ! view_ | | ! view_ - > IsAttached ( ) ) ; <nl> <nl> index d1922a486fb0143d688a26f954462e3a915af2b5 . . b1e800f51e44a7a5d3fabd66563d5bdb <nl> if ( ! Client ( ) ) <nl> return ; <nl> <nl> - void LocalFrame : : DetachImpl ( FrameDetachType type ) { <nl> + void LocalFrame : : DetachImpl ( FrameDetachType type ) { <nl> / / Notify ScriptController that the frame is closing , since its cleanup ends <nl> / / up calling back to LocalFrameClient via WindowProxy . <nl> GetScriptController ( ) . ClearForClose ( ) ; <nl> mmm a / patches / chromium / blink_world_context . patch <nl> ppp b / patches / chromium / blink_world_context . patch <nl> Subject : blink_world_context . patch <nl> <nl> <nl> - + mmm a / third_party / blink / public / web / web_local_frame . h <nl> ppp b / third_party / blink / public / web / web_local_frame . h <nl> - class WebLocalFrame : public WebFrame { <nl> + class WebLocalFrame : public WebFrame { <nl> / / be calling this API . <nl> virtual v8 : : Local < v8 : : Context > MainWorldScriptContext ( ) const = 0 ; <nl> <nl> index 82fb3fdfe6bfa8c8d885ee133270b6f2564325a8 . . f3bad71eab608d3b9ac0e08446c9e520 <nl> / / that the script evaluated to with callback . Script execution can be <nl> / / suspend . <nl> - + mmm a / third_party / blink / renderer / core / frame / web_local_frame_impl . cc <nl> ppp b / third_party / blink / renderer / core / frame / web_local_frame_impl . cc <nl> - v8 : : Local < v8 : : Object > WebLocalFrameImpl : : GlobalProxy ( ) const { <nl> + v8 : : Local < v8 : : Object > WebLocalFrameImpl : : GlobalProxy ( ) const { <nl> return MainWorldScriptContext ( ) - > Global ( ) ; <nl> } <nl> <nl> index e12642b4703474840a490f426b90c61141f9881e . . 2610245d88af53e116faa825df264fd9 <nl> return BindingSecurity : : ShouldAllowAccessToFrame ( <nl> CurrentDOMWindow ( V8PerIsolateData : : MainThreadIsolate ( ) ) , <nl> - + mmm a / third_party / blink / renderer / core / frame / web_local_frame_impl . h <nl> ppp b / third_party / blink / renderer / core / frame / web_local_frame_impl . h <nl> - class CORE_EXPORT WebLocalFrameImpl final <nl> + class CORE_EXPORT WebLocalFrameImpl final <nl> int argc , <nl> v8 : : Local < v8 : : Value > argv [ ] ) override ; <nl> v8 : : Local < v8 : : Context > MainWorldScriptContext ( ) const override ; <nl> mmm a / patches / chromium / can_create_window . patch <nl> ppp b / patches / chromium / can_create_window . patch <nl> Subject : can_create_window . patch <nl> <nl> <nl> - + mmm a / content / browser / frame_host / render_frame_host_impl . cc <nl> ppp b / content / browser / frame_host / render_frame_host_impl . cc <nl> - void RenderFrameHostImpl : : CreateNewWindow ( <nl> + void RenderFrameHostImpl : : CreateNewWindow ( <nl> last_committed_origin_ , params - > window_container_type , <nl> params - > target_url , params - > referrer . To < Referrer > ( ) , <nl> params - > frame_name , params - > disposition , * params - > features , <nl> index 0334ac0cfb75a9d99f841aea388c9a3fc960141b . . c341ea17c13ec6f63936c1b4d4faba9b <nl> & no_javascript_access ) ; <nl> <nl> - + mmm a / content / common / frame . mojom <nl> ppp b / content / common / frame . mojom <nl> - struct CreateNewWindowParams { <nl> + struct CreateNewWindowParams { <nl> <nl> / / The window features to use for the new window . <nl> blink . mojom . WindowFeatures features ; <nl> index 82882159b0bac6d47d678c485de0aacc7db06c2d . . dd2299094b79d82da7ec1cd8f559050b <nl> <nl> / / Operation result when the renderer asks the browser to create a new window . <nl> - + mmm a / content / public / browser / content_browser_client . cc <nl> ppp b / content / public / browser / content_browser_client . cc <nl> - bool ContentBrowserClient : : CanCreateWindow ( <nl> + bool ContentBrowserClient : : CanCreateWindow ( <nl> const std : : string & frame_name , <nl> WindowOpenDisposition disposition , <nl> const blink : : mojom : : WindowFeatures & features , <nl> index 53e67715469ce47147b66393ecc6a20d0d657977 . . 2dd31166cc52ccb528b338b63fde7d2f <nl> bool opener_suppressed , <nl> bool * no_javascript_access ) { <nl> - + mmm a / content / public / browser / content_browser_client . h <nl> ppp b / content / public / browser / content_browser_client . h <nl> class RenderFrameHost ; <nl> index 2b4c2c1004fb98da76eb244db4c35dba84085f45 . . 04bfc1a4a804d1f5aa28f894e2feb816 <nl> class SerialDelegate ; <nl> class SiteInstance ; <nl> class SpeechRecognitionManagerDelegate ; <nl> - class CONTENT_EXPORT ContentBrowserClient { <nl> + class CONTENT_EXPORT ContentBrowserClient { <nl> const std : : string & frame_name , <nl> WindowOpenDisposition disposition , <nl> const blink : : mojom : : WindowFeatures & features , <nl> index 2b4c2c1004fb98da76eb244db4c35dba84085f45 . . 04bfc1a4a804d1f5aa28f894e2feb816 <nl> bool opener_suppressed , <nl> bool * no_javascript_access ) ; <nl> - + mmm a / content / renderer / render_view_impl . cc <nl> ppp b / content / renderer / render_view_impl . cc <nl> <nl> index 1aa52af90279e16f667cb07677c11141d2efce01 . . 3cb0f9b3e24fb79e43b724d7ad5e6ad9 <nl> # include " content / renderer / media / audio / audio_device_factory . h " <nl> # include " content / renderer / media / stream / media_stream_device_observer . h " <nl> # include " content / renderer / media / video_capture / video_capture_impl_manager . h " <nl> - WebView * RenderViewImpl : : CreateView ( <nl> + WebView * RenderViewImpl : : CreateView ( <nl> } <nl> params - > features = ConvertWebWindowFeaturesToMojoWindowFeatures ( features ) ; <nl> <nl> index 1aa52af90279e16f667cb07677c11141d2efce01 . . 3cb0f9b3e24fb79e43b724d7ad5e6ad9 <nl> / / moved on send . <nl> bool is_background_tab = <nl> - + mmm a / content / shell / browser / web_test / web_test_content_browser_client . cc <nl> ppp b / content / shell / browser / web_test / web_test_content_browser_client . cc <nl> - bool WebTestContentBrowserClient : : CanCreateWindow ( <nl> + bool WebTestContentBrowserClient : : CanCreateWindow ( <nl> const std : : string & frame_name , <nl> WindowOpenDisposition disposition , <nl> const blink : : mojom : : WindowFeatures & features , <nl> mmm a / patches / chromium / chrome_key_systems . patch <nl> ppp b / patches / chromium / chrome_key_systems . patch <nl> Disable persiste licence support check for widevine cdm , <nl> as its not supported in the current version of chrome . <nl> <nl> - + mmm a / chrome / renderer / media / chrome_key_systems . cc <nl> ppp b / chrome / renderer / media / chrome_key_systems . cc <nl> <nl> mmm a / patches / chromium / command - ismediakey . patch <nl> ppp b / patches / chromium / command - ismediakey . patch <nl> index 392cf3d58c64c088596e8d321a2ce37b0ec60b6e . . 43e30f47240dc10a3a9b950255d4e487 <nl> ui : : Accelerator accelerator ( <nl> ui : : KeyboardCodeFromXKeyEvent ( x_event ) , modifiers ) ; <nl> - + mmm a / ui / base / accelerators / media_keys_listener_mac . mm <nl> ppp b / ui / base / accelerators / media_keys_listener_mac . mm <nl> KeyboardCode MediaKeyCodeToKeyboardCode ( int key_code ) { <nl> index 71b417ee8b64aa2ff7f1b2390851668ec1dcd7cf . . 1768af408d4cc3075e5bae046649e495 <nl> } <nl> return VKEY_UNKNOWN ; <nl> } <nl> - static CGEventRef EventTapCallback ( CGEventTapProxy proxy , <nl> + static CGEventRef EventTapCallback ( CGEventTapProxy proxy , <nl> int key_code = ( data1 & 0xFFFF0000 ) > > 16 ; <nl> if ( key_code ! = NX_KEYTYPE_PLAY & & key_code ! = NX_KEYTYPE_NEXT & & <nl> key_code ! = NX_KEYTYPE_PREVIOUS & & key_code ! = NX_KEYTYPE_FAST & & <nl> deleted file mode 100644 <nl> index 975875283f61 . . 000000000000 <nl> mmm a / patches / chromium / content_allow_embedder_to_prevent_locking_scheme_registry . patch <nl> ppp / dev / null <nl> <nl> - From 0000000000000000000000000000000000000000 Mon Sep 17 00 : 00 : 00 2001 <nl> - From : Jeremy Apthorp < nornagon @ nornagon . net > <nl> - Date : Wed , 21 Nov 2018 14 : 31 : 34 - 0800 <nl> - Subject : content : allow embedder to prevent locking scheme registry <nl> - <nl> - The / / content layer requires all schemes to be registered during startup , <nl> - because Add * Scheme aren ' t threadsafe . However , Electron exposes the option to <nl> - register additional schemes via JavaScript in the main process before the app <nl> - is ready , but after the / / content layer has already locked the registry . <nl> - <nl> - Without this patch , calling ` registerStandardSchemes ` during initialization <nl> - when in debug mode will cause a DCHECK to fire . <nl> - <nl> mmmmmm a / content / app / content_main_runner_impl . cc <nl> - ppp b / content / app / content_main_runner_impl . cc <nl> - int ContentMainRunnerImpl : : Initialize ( const ContentMainParams & params ) { <nl> - # endif <nl> - <nl> - RegisterPathProvider ( ) ; <nl> - - RegisterContentSchemes ( true ) ; <nl> - + RegisterContentSchemes ( delegate_ - > ShouldLockSchemeRegistry ( ) ) ; <nl> - <nl> - # if defined ( OS_ANDROID ) & & ( ICU_UTIL_DATA_IMPL = = ICU_UTIL_DATA_FILE ) <nl> - int icudata_fd = g_fds - > MaybeGet ( kAndroidICUDataDescriptor ) ; <nl> mmmmmm a / content / public / app / content_main_delegate . cc <nl> - ppp b / content / public / app / content_main_delegate . cc <nl> - int ContentMainDelegate : : TerminateForFatalInitializationError ( ) { <nl> - return 0 ; <nl> - } <nl> - <nl> - + bool ContentMainDelegate : : ShouldLockSchemeRegistry ( ) { <nl> - + return true ; <nl> - + } <nl> - + <nl> - service_manager : : ProcessType ContentMainDelegate : : OverrideProcessType ( ) { <nl> - return service_manager : : ProcessType : : kDefault ; <nl> - } <nl> mmmmmm a / content / public / app / content_main_delegate . h <nl> - ppp b / content / public / app / content_main_delegate . h <nl> - class CONTENT_EXPORT ContentMainDelegate { <nl> - virtual void ZygoteForked ( ) { } <nl> - # endif / / defined ( OS_LINUX ) <nl> - <nl> - + / / Allows the embedder to prevent locking the scheme registry . <nl> - + virtual bool ShouldLockSchemeRegistry ( ) ; <nl> - + <nl> - / / Fatal errors during initialization are reported by this function , so that <nl> - / / the embedder can implement graceful exit by displaying some message and <nl> - / / returning initialization error code . Default behavior is CHECK ( false ) . <nl> mmm a / patches / chromium / content_browser_main_loop . patch <nl> ppp b / patches / chromium / content_browser_main_loop . patch <nl> run before shutdown . This is required to cleanup WebContents asynchronously <nl> in atom : : CommonWebContentsDelegate : : ResetManageWebContents . <nl> <nl> - + mmm a / content / browser / browser_main_loop . cc <nl> ppp b / content / browser / browser_main_loop . cc <nl> - void BrowserMainLoop : : MainMessageLoopRun ( ) { <nl> - } <nl> - <nl> + void BrowserMainLoop : : MainMessageLoopRun ( ) { <nl> + NOTREACHED ( ) ; <nl> + # else <nl> base : : RunLoop run_loop ; <nl> - parts_ - > PreDefaultMainMessageLoopRun ( run_loop . QuitClosure ( ) ) ; <nl> + parts_ - > PreDefaultMainMessageLoopRun ( run_loop . QuitWhenIdleClosure ( ) ) ; <nl> mmm a / patches / chromium / cross_site_document_resource_handler . patch <nl> ppp b / patches / chromium / cross_site_document_resource_handler . patch <nl> this patch can be removed once we switch to network service , <nl> where the embedders have a chance to design their URLLoaders . <nl> <nl> - + mmm a / content / browser / loader / cross_site_document_resource_handler . cc <nl> ppp b / content / browser / loader / cross_site_document_resource_handler . cc <nl> - bool CrossSiteDocumentResourceHandler : : ShouldBlockBasedOnHeaders ( <nl> + bool CrossSiteDocumentResourceHandler : : ShouldBlockBasedOnHeaders ( <nl> return false ; <nl> } <nl> <nl> index d514c10160dd12f225c42e927977660cacbc9c43 . . 49345f1d4d75c8b96efe485202d89774 <nl> } <nl> <nl> - + mmm a / content / public / browser / content_browser_client . cc <nl> ppp b / content / public / browser / content_browser_client . cc <nl> std : : unique_ptr < BrowserMainParts > ContentBrowserClient : : CreateBrowserMainParts ( <nl> index ce64276225d5b0acf684e9e70c600a64a56fe96e . . 2a9661d877fbc09904eb469191523b5c <nl> const base : : Location & from_here , <nl> const scoped_refptr < base : : TaskRunner > & task_runner , <nl> - + mmm a / content / public / browser / content_browser_client . h <nl> ppp b / content / public / browser / content_browser_client . h <nl> class CONTENT_EXPORT ContentBrowserClient { <nl> mmm a / patches / chromium / dcheck . patch <nl> ppp b / patches / chromium / dcheck . patch <nl> only one or two specific checks fail . Then it ' s better to simply comment out the <nl> failing checks and allow the rest of the target to have them enabled . <nl> <nl> - + mmm a / content / browser / frame_host / navigation_controller_impl . cc <nl> ppp b / content / browser / frame_host / navigation_controller_impl . cc <nl> - NavigationType NavigationControllerImpl : : ClassifyNavigation ( <nl> + NavigationType NavigationControllerImpl : : ClassifyNavigation ( <nl> return NAVIGATION_TYPE_NEW_SUBFRAME ; <nl> } <nl> <nl> index f50c1283c195a9fdffbf737a0368cf4ffe3940d5 . . c57cda2907fa68d1d8c6095d1bbd7ffb <nl> <nl> if ( rfh - > GetParent ( ) ) { <nl> / / All manual subframes would be did_create_new_entry and handled above , so <nl> - void NavigationControllerImpl : : RendererDidNavigateToNewPage ( <nl> + void NavigationControllerImpl : : RendererDidNavigateToNewPage ( <nl> new_entry - > GetFavicon ( ) = GetLastCommittedEntry ( ) - > GetFavicon ( ) ; <nl> } <nl> <nl> index f50c1283c195a9fdffbf737a0368cf4ffe3940d5 . . c57cda2907fa68d1d8c6095d1bbd7ffb <nl> / / navigation . Now we know that the renderer has updated its state accordingly <nl> / / and it is safe to also clear the browser side history . <nl> - + mmm a / ui / base / clipboard / clipboard_win . cc <nl> ppp b / ui / base / clipboard / clipboard_win . cc <nl> void ClipboardWin : : WriteBitmapFromHandle ( HBITMAP source_hbitmap , <nl> mmm a / patches / chromium / disable - redraw - lock . patch <nl> ppp b / patches / chromium / disable - redraw - lock . patch <nl> the redraw locking mechanism , which fixes these issues . The electron issue <nl> can be found at https : / / github . com / electron / electron / issues / 1821 <nl> <nl> - + mmm a / ui / views / win / hwnd_message_handler . cc <nl> ppp b / ui / views / win / hwnd_message_handler . cc <nl> - constexpr int kSynthesizedMouseMessagesTimeDifference = 500 ; <nl> + constexpr int kSynthesizedMouseMessagesTimeDifference = 500 ; <nl> <nl> } / / namespace <nl> <nl> index de88c769b5be6b7f568d999d8bb92792e0e0ae19 . . ba47d52fd467e01c3d36db48d3b546bf <nl> / / A scoping class that prevents a window from being able to redraw in response <nl> / / to invalidations that may occur within it for the lifetime of the object . <nl> / / <nl> - class HWNDMessageHandler : : ScopedRedrawLock { <nl> + class HWNDMessageHandler : : ScopedRedrawLock { <nl> cancel_unlock_ ( false ) , <nl> should_lock_ ( owner_ - > IsVisible ( ) & & ! owner - > HasChildRenderingWindow ( ) & & <nl> : : IsWindow ( hwnd_ ) & & <nl> index de88c769b5be6b7f568d999d8bb92792e0e0ae19 . . ba47d52fd467e01c3d36db48d3b546bf <nl> ( ! ( GetWindowLong ( hwnd_ , GWL_STYLE ) & WS_CAPTION ) | | <nl> ! ui : : win : : IsAeroGlassEnabled ( ) ) ) { <nl> if ( should_lock_ ) <nl> - bool HWNDMessageHandler : : HasChildRenderingWindow ( ) { <nl> + bool HWNDMessageHandler : : HasChildRenderingWindow ( ) { <nl> hwnd ( ) ) ; <nl> } <nl> <nl> mmm a / patches / chromium / disable_color_correct_rendering . patch <nl> ppp b / patches / chromium / disable_color_correct_rendering . patch <nl> to deal with color spaces . That is being tracked at <nl> https : / / crbug . com / 634542 and https : / / crbug . com / 711107 . <nl> <nl> - + mmm a / cc / trees / layer_tree_settings . h <nl> ppp b / cc / trees / layer_tree_settings . h <nl> - class CC_EXPORT LayerTreeSettings { <nl> - <nl> - bool enable_mask_tiling = true ; <nl> + class CC_EXPORT LayerTreeSettings { <nl> + bool use_rgba_4444 = false ; <nl> + bool unpremultiply_and_dither_low_bit_depth_tiles = false ; <nl> <nl> + bool enable_color_correct_rendering = true ; <nl> + <nl> index 092fb1b7ea3626b7649472c35ec20bf1a6aaf4cd . . fed8dd322faba387ebd0508228f84776 <nl> / / Image Decode Service and raster tiles without images until the decode is <nl> / / ready . <nl> - + mmm a / components / viz / common / display / renderer_settings . h <nl> ppp b / components / viz / common / display / renderer_settings . h <nl> class VIZ_COMMON_EXPORT RendererSettings { <nl> index 78041fcb9647f740c6a142ec65f2418712c6286c . . 04e75ac40c38a38bdec634d1aa645854 <nl> bool force_antialiasing = false ; <nl> bool force_blending_with_shaders = false ; <nl> - + mmm a / components / viz / host / renderer_settings_creation . cc <nl> ppp b / components / viz / host / renderer_settings_creation . cc <nl> <nl> index 78a6b5739caed8c3925f303c52ed107be8e4ccfe . . ddbf660e594c1a991d4e758fa11b1b2e <nl> + ! command_line - > HasSwitch ( switches : : kDisableColorCorrectRendering ) ; <nl> renderer_settings . partial_swap_enabled = <nl> ! command_line - > HasSwitch ( switches : : kUIDisablePartialSwap ) ; <nl> - # if defined ( OS_WIN ) <nl> + # if defined ( OS_MACOSX ) <nl> - + mmm a / components / viz / service / display / gl_renderer . cc <nl> ppp b / components / viz / service / display / gl_renderer . cc <nl> <nl> index b7a65f6dae8f2fcba0ba127cb50f0f338a26b9d0 . . bc1d0d3dd92d1adc6c94803755a23c28 <nl> namespace viz { <nl> namespace { <nl> <nl> - void GLRenderer : : DoDrawQuad ( const DrawQuad * quad , <nl> + void GLRenderer : : DoDrawQuad ( const DrawQuad * quad , <nl> void GLRenderer : : DrawDebugBorderQuad ( const DebugBorderDrawQuad * quad ) { <nl> SetBlendEnabled ( quad - > ShouldDrawWithBlending ( ) ) ; <nl> <nl> index b7a65f6dae8f2fcba0ba127cb50f0f338a26b9d0 . . bc1d0d3dd92d1adc6c94803755a23c28 <nl> <nl> / / Use the full quad_rect for debug quads to not move the edges based on <nl> / / partial swaps . <nl> - void GLRenderer : : ChooseRPDQProgram ( DrawRenderPassDrawQuadParams * params , <nl> + void GLRenderer : : ChooseRPDQProgram ( DrawRenderPassDrawQuadParams * params , <nl> params - > use_aa ? USE_AA : NO_AA , mask_mode , mask_for_background , <nl> params - > use_color_matrix , tint_gl_composited_content_ , <nl> ShouldApplyRoundedCorner ( params - > quad ) ) , <nl> index b7a65f6dae8f2fcba0ba127cb50f0f338a26b9d0 . . bc1d0d3dd92d1adc6c94803755a23c28 <nl> } <nl> <nl> void GLRenderer : : UpdateRPDQUniforms ( DrawRenderPassDrawQuadParams * params ) { <nl> - void GLRenderer : : DrawSolidColorQuad ( const SolidColorDrawQuad * quad , <nl> + void GLRenderer : : DrawSolidColorQuad ( const SolidColorDrawQuad * quad , <nl> SetUseProgram ( ProgramKey : : SolidColor ( use_aa ? USE_AA : NO_AA , <nl> tint_gl_composited_content_ , <nl> ShouldApplyRoundedCorner ( quad ) ) , <nl> index b7a65f6dae8f2fcba0ba127cb50f0f338a26b9d0 . . bc1d0d3dd92d1adc6c94803755a23c28 <nl> SetShaderColor ( color , opacity ) ; <nl> if ( current_program_ - > rounded_corner_rect_location ( ) ! = - 1 ) { <nl> SetShaderRoundedCorner ( <nl> - void GLRenderer : : DrawContentQuadAA ( const ContentDrawQuadBase * quad , <nl> + void GLRenderer : : DrawContentQuadAA ( const ContentDrawQuadBase * quad , <nl> : NON_PREMULTIPLIED_ALPHA , <nl> false , false , tint_gl_composited_content_ , <nl> ShouldApplyRoundedCorner ( quad ) ) , <nl> index b7a65f6dae8f2fcba0ba127cb50f0f338a26b9d0 . . bc1d0d3dd92d1adc6c94803755a23c28 <nl> <nl> if ( current_program_ - > tint_color_matrix_location ( ) ! = - 1 ) { <nl> auto matrix = cc : : DebugColors : : TintCompositedContentColorTransformMatrix ( ) ; <nl> - void GLRenderer : : DrawContentQuadNoAA ( const ContentDrawQuadBase * quad , <nl> + void GLRenderer : : DrawContentQuadNoAA ( const ContentDrawQuadBase * quad , <nl> ! quad - > ShouldDrawWithBlending ( ) , has_tex_clamp_rect , <nl> tint_gl_composited_content_ , <nl> ShouldApplyRoundedCorner ( quad ) ) , <nl> index b7a65f6dae8f2fcba0ba127cb50f0f338a26b9d0 . . bc1d0d3dd92d1adc6c94803755a23c28 <nl> <nl> if ( current_program_ - > tint_color_matrix_location ( ) ! = - 1 ) { <nl> auto matrix = cc : : DebugColors : : TintCompositedContentColorTransformMatrix ( ) ; <nl> - void GLRenderer : : DrawYUVVideoQuad ( const YUVVideoDrawQuad * quad , <nl> + void GLRenderer : : DrawYUVVideoQuad ( const YUVVideoDrawQuad * quad , <nl> DCHECK_NE ( src_color_space , src_color_space . GetAsFullRangeRGB ( ) ) ; <nl> <nl> gfx : : ColorSpace dst_color_space = <nl> index b7a65f6dae8f2fcba0ba127cb50f0f338a26b9d0 . . bc1d0d3dd92d1adc6c94803755a23c28 <nl> / / Force sRGB output on Windows for overlay candidate video quads to match <nl> / / DirectComposition behavior in case these switch between overlays and <nl> / / compositing . See https : / / crbug . com / 811118 for details . <nl> - void GLRenderer : : DrawStreamVideoQuad ( const StreamVideoDrawQuad * quad , <nl> + void GLRenderer : : DrawStreamVideoQuad ( const StreamVideoDrawQuad * quad , <nl> <nl> SetUseProgram ( ProgramKey : : VideoStream ( tex_coord_precision , <nl> ShouldApplyRoundedCorner ( quad ) ) , <nl> index b7a65f6dae8f2fcba0ba127cb50f0f338a26b9d0 . . bc1d0d3dd92d1adc6c94803755a23c28 <nl> <nl> DCHECK_EQ ( GL_TEXTURE0 , GetActiveTextureUnit ( gl_ ) ) ; <nl> gl_ - > BindTexture ( GL_TEXTURE_EXTERNAL_OES , lock . texture_id ( ) ) ; <nl> - void GLRenderer : : FlushTextureQuadCache ( BoundGeometry flush_binding ) { <nl> + void GLRenderer : : FlushTextureQuadCache ( BoundGeometry flush_binding ) { <nl> draw_cache_ . nearest_neighbor ? GL_NEAREST : GL_LINEAR ) ; <nl> <nl> / / Bind the program to the GL state . <nl> index b7a65f6dae8f2fcba0ba127cb50f0f338a26b9d0 . . bc1d0d3dd92d1adc6c94803755a23c28 <nl> <nl> if ( current_program_ - > rounded_corner_rect_location ( ) ! = - 1 ) { <nl> SetShaderRoundedCorner ( <nl> - void GLRenderer : : PrepareGeometry ( BoundGeometry binding ) { <nl> + void GLRenderer : : PrepareGeometry ( BoundGeometry binding ) { <nl> void GLRenderer : : SetUseProgram ( const ProgramKey & program_key_no_color , <nl> const gfx : : ColorSpace & src_color_space , <nl> const gfx : : ColorSpace & dst_color_space ) { <nl> index b7a65f6dae8f2fcba0ba127cb50f0f338a26b9d0 . . bc1d0d3dd92d1adc6c94803755a23c28 <nl> <nl> ProgramKey program_key = program_key_no_color ; <nl> const gfx : : ColorTransform * color_transform = <nl> - void GLRenderer : : CopyRenderPassDrawQuadToOverlayResource ( <nl> + void GLRenderer : : CopyRenderPassDrawQuadToOverlayResource ( <nl> <nl> * overlay_texture = FindOrCreateOverlayTexture ( <nl> params . quad - > render_pass_id , iosurface_width , iosurface_height , <nl> index b7a65f6dae8f2fcba0ba127cb50f0f338a26b9d0 . . bc1d0d3dd92d1adc6c94803755a23c28 <nl> * new_bounds = gfx : : RectF ( updated_dst_rect . origin ( ) , <nl> gfx : : SizeF ( ( * overlay_texture ) - > texture . size ( ) ) ) ; <nl> <nl> - void GLRenderer : : FlushOverdrawFeedback ( const gfx : : Rect & output_rect ) { <nl> + void GLRenderer : : FlushOverdrawFeedback ( const gfx : : Rect & output_rect ) { <nl> <nl> PrepareGeometry ( SHARED_BINDING ) ; <nl> <nl> index b7a65f6dae8f2fcba0ba127cb50f0f338a26b9d0 . . bc1d0d3dd92d1adc6c94803755a23c28 <nl> <nl> gfx : : Transform render_matrix ; <nl> render_matrix . Translate ( 0 . 5 * output_rect . width ( ) + output_rect . x ( ) , <nl> - gfx : : Size GLRenderer : : GetRenderPassBackingPixelSize ( <nl> + gfx : : Size GLRenderer : : GetRenderPassBackingPixelSize ( <nl> } <nl> <nl> } / / namespace viz <nl> + <nl> + # undef PATCH_CS <nl> - + mmm a / content / browser / gpu / gpu_process_host . cc <nl> ppp b / content / browser / gpu / gpu_process_host . cc <nl> GpuTerminationStatus ConvertToGpuTerminationStatus ( <nl> index f34cfb51693648a7b342d21a61c601090209355a . . b488efc71edf5d79e16c25d3d7be2d8e <nl> service_manager : : switches : : kGpuSandboxAllowSysVShm , <nl> service_manager : : switches : : kGpuSandboxFailuresFatal , <nl> - + mmm a / content / browser / renderer_host / render_process_host_impl . cc <nl> ppp b / content / browser / renderer_host / render_process_host_impl . cc <nl> <nl> index 4b8c6d7b1a2676df8ef63117785c1aed8341d12e . . 6930799c5fc0def1248b46884a3da182 <nl> # include " ui / gl / gl_switches . h " <nl> # include " ui / native_theme / native_theme_features . h " <nl> <nl> - void RenderProcessHostImpl : : PropagateBrowserCommandLineToRenderer ( <nl> + void RenderProcessHostImpl : : PropagateBrowserCommandLineToRenderer ( <nl> / / Propagate the following switches to the renderer command line ( along <nl> / / with any associated values ) if present in the browser command line . <nl> static const char * const kSwitchNames [ ] = { <nl> index 4b8c6d7b1a2676df8ef63117785c1aed8341d12e . . 6930799c5fc0def1248b46884a3da182 <nl> network : : switches : : kExplicitlyAllowedPorts , <nl> service_manager : : switches : : kDisableInProcessStackTraces , <nl> - + mmm a / content / renderer / render_widget . cc <nl> ppp b / content / renderer / render_widget . cc <nl> - cc : : LayerTreeSettings RenderWidget : : GenerateLayerTreeSettings ( <nl> + cc : : LayerTreeSettings RenderWidget : : GenerateLayerTreeSettings ( <nl> settings . main_frame_before_activation_enabled = <nl> cmd . HasSwitch ( cc : : switches : : kEnableMainFrameBeforeActivation ) ; <nl> <nl> index 33817ba20ae6cbfec8a28313092df9c10b1bf966 . . ea1a574c1f6d2a0f880391b21397c2cb <nl> / / is what the renderer uses if its not threaded . <nl> settings . enable_checker_imaging = <nl> - + mmm a / ui / gfx / mac / io_surface . cc <nl> ppp b / ui / gfx / mac / io_surface . cc <nl> <nl> index 88ec94963569588ed2882193a28197879dcb1090 . . eae37577bc9b1872c0162f55de218553 <nl> <nl> namespace gfx { <nl> <nl> - IOSurfaceRef CreateIOSurface ( const gfx : : Size & size , <nl> + IOSurfaceRef CreateIOSurface ( const gfx : : Size & size , <nl> <nl> / / Ensure that all IOSurfaces start as sRGB . <nl> CGColorSpaceRef color_space = base : : mac : : GetSRGBColorSpace ( ) ; <nl> index 88ec94963569588ed2882193a28197879dcb1090 . . eae37577bc9b1872c0162f55de218553 <nl> base : : ScopedCFTypeRef < CFDataRef > color_space_icc ( <nl> CGColorSpaceCopyICCProfile ( color_space ) ) ; <nl> IOSurfaceSetValue ( surface , CFSTR ( " IOSurfaceColorSpace " ) , color_space_icc ) ; <nl> - IOSurfaceRef CreateIOSurface ( const gfx : : Size & size , <nl> + IOSurfaceRef CreateIOSurface ( const gfx : : Size & size , <nl> <nl> void IOSurfaceSetColorSpace ( IOSurfaceRef io_surface , <nl> const ColorSpace & color_space ) { <nl> index 88ec94963569588ed2882193a28197879dcb1090 . . eae37577bc9b1872c0162f55de218553 <nl> if ( color_space = = ColorSpace : : CreateSRGB ( ) ) { <nl> base : : ScopedCFTypeRef < CFDataRef > srgb_icc ( <nl> - + mmm a / ui / gfx / switches . cc <nl> ppp b / ui / gfx / switches . cc <nl> <nl> index 189e147e908fdab38972f4f9b0ce212347a4ec2e . . 2a0a480d8513abc609b82f3d1eb24695 <nl> / / sharpness , kerning , hinting and layout . <nl> const char kDisableFontSubpixelPositioning [ ] = <nl> - + mmm a / ui / gfx / switches . h <nl> ppp b / ui / gfx / switches . h <nl> <nl> index c95989ae7da12585fc417a680aef6c55e4b7a8d7 . . 9e180a6decd72e510cecfec1f43fd1ac <nl> + <nl> GFX_SWITCHES_EXPORT extern const char kDisableFontSubpixelPositioning [ ] ; <nl> <nl> - GFX_SWITCHES_EXPORT extern const char kHeadless [ ] ; <nl> + GFX_SWITCHES_EXPORT extern const char kForcePrefersReducedMotion [ ] ; <nl> mmm a / patches / chromium / disable_detach_webview_frame . patch <nl> ppp b / patches / chromium / disable_detach_webview_frame . patch <nl> this patch was introduced in Chrome 66 . <nl> Update ( zcbenz ) : The bug is still in Chrome 72 . <nl> <nl> - + mmm a / content / browser / frame_host / render_frame_proxy_host . cc <nl> ppp b / content / browser / frame_host / render_frame_proxy_host . cc <nl> void RenderFrameProxyHost : : BubbleLogicalScroll ( <nl> mmm a / patches / chromium / disable_hidden . patch <nl> ppp b / patches / chromium / disable_hidden . patch <nl> Subject : disable_hidden . patch <nl> <nl> <nl> - + mmm a / content / browser / renderer_host / render_widget_host_impl . cc <nl> ppp b / content / browser / renderer_host / render_widget_host_impl . cc <nl> - void RenderWidgetHostImpl : : WasHidden ( ) { <nl> + void RenderWidgetHostImpl : : WasHidden ( ) { <nl> if ( is_hidden_ ) <nl> return ; <nl> <nl> index d1cf894d19b1cfa5e11dd44844ff15ed6a42dd58 . . 553167fa07a3acee25434cfd71a968a1 <nl> <nl> TRACE_EVENT0 ( " renderer_host " , " RenderWidgetHostImpl : : WasHidden " ) ; <nl> - + mmm a / content / browser / renderer_host / render_widget_host_impl . h <nl> ppp b / content / browser / renderer_host / render_widget_host_impl . h <nl> class CONTENT_EXPORT RenderWidgetHostImpl <nl> mmm a / patches / chromium / disable_network_services_by_default . patch <nl> ppp b / patches / chromium / disable_network_services_by_default . patch <nl> We should remove this patch after all Electron ' s code has been migrated to the <nl> NetworkService . <nl> <nl> - + mmm a / services / network / public / cpp / features . cc <nl> ppp b / services / network / public / cpp / features . cc <nl> - const base : : Feature kNetworkErrorLogging { " NetworkErrorLogging " , <nl> - base : : FEATURE_ENABLED_BY_DEFAULT } ; <nl> - / / Enables the network service . <nl> - const base : : Feature kNetworkService { " NetworkService " , <nl> - - base : : FEATURE_ENABLED_BY_DEFAULT } ; <nl> - + base : : FEATURE_DISABLED_BY_DEFAULT } ; <nl> + const base : : Feature kNetworkService { <nl> + # else <nl> + " NetworkServiceNotSupported " , <nl> + # endif <nl> + - base : : FEATURE_ENABLED_BY_DEFAULT <nl> + + base : : FEATURE_DISABLED_BY_DEFAULT <nl> + } ; <nl> <nl> / / Out of Blink CORS <nl> - const base : : Feature kOutOfBlinkCors { " OutOfBlinkCors " , <nl> mmm a / patches / chromium / disable_user_gesture_requirement_for_beforeunload_dialogs . patch <nl> ppp b / patches / chromium / disable_user_gesture_requirement_for_beforeunload_dialogs . patch <nl> Subject : disable_user_gesture_requirement_for_beforeunload_dialogs . patch <nl> See https : / / github . com / electron / electron / issues / 10754 <nl> <nl> - + mmm a / third_party / blink / renderer / core / dom / document . cc <nl> ppp b / third_party / blink / renderer / core / dom / document . cc <nl> - bool Document : : DispatchBeforeUnloadEvent ( ChromeClient * chrome_client , <nl> + bool Document : : DispatchBeforeUnloadEvent ( ChromeClient * chrome_client , <nl> " frame that never had a user gesture since its load . " <nl> " https : / / www . chromestatus . com / feature / 5082396709879808 " ; <nl> Intervention : : GenerateReport ( frame_ , " BeforeUnloadNoGesture " , message ) ; <nl> mmm a / patches / chromium / dom_storage_limits . patch <nl> ppp b / patches / chromium / dom_storage_limits . patch <nl> index e87afe5b8ee07f7038a7cc9c40832b6cd27884da . . 61c9a0dfff60f79c7b36ff5c7d741c06 <nl> <nl> / / In the browser process we allow some overage to <nl> - + mmm a / third_party / blink / renderer / modules / storage / cached_storage_area . cc <nl> ppp b / third_party / blink / renderer / modules / storage / cached_storage_area . cc <nl> - bool CachedStorageArea : : SetItem ( const String & key , <nl> + bool CachedStorageArea : : SetItem ( const String & key , <nl> Source * source ) { <nl> DCHECK ( areas_ - > Contains ( source ) ) ; <nl> <nl> mmm a / patches / chromium / exclude - a - few - test - files - from - build . patch <nl> ppp b / patches / chromium / exclude - a - few - test - files - from - build . patch <nl> Compilation of those files fails with the Chromium 68 . <nl> Remove the patch during the Chromium 69 upgrade . <nl> <nl> - + mmm a / third_party / blink / renderer / platform / BUILD . gn <nl> ppp b / third_party / blink / renderer / platform / BUILD . gn <nl> - jumbo_source_set ( " blink_platform_unittests_sources " ) { <nl> + jumbo_source_set ( " blink_platform_unittests_sources " ) { <nl> " graphics / paint / drawing_display_item_test . cc " , <nl> " graphics / paint / drawing_recorder_test . cc " , <nl> " graphics / paint / float_clip_rect_test . cc " , <nl> mmm a / patches / chromium / feat_offscreen_rendering_with_viz_compositor . patch <nl> ppp b / patches / chromium / feat_offscreen_rendering_with_viz_compositor . patch <nl> index 5e5c5da4a3cfc927df3fb120fcab647e927271c1 . . 8c6ec95f309660fb83012a13c7b9bb64 <nl> # if defined ( USE_X11 ) <nl> void DidCompleteSwapWithNewSize ( const gfx : : Size & size ) override ; <nl> - + mmm a / components / viz / host / layered_window_updater_impl . cc <nl> ppp b / components / viz / host / layered_window_updater_impl . cc <nl> - void LayeredWindowUpdaterImpl : : OnAllocatedSharedMemory ( <nl> - shm_handle . Close ( ) ; <nl> + void LayeredWindowUpdaterImpl : : OnAllocatedSharedMemory ( <nl> + / / | region | ' s handle will close when it goes out of scope . <nl> } <nl> <nl> - void LayeredWindowUpdaterImpl : : Draw ( DrawCallback draw_callback ) { <nl> index d3a49ed8be8dc11b86af67cdd600b05ddc0fc486 . . 88bf86f3938b8267d731b52c8c3baa35 <nl> <nl> if ( ! canvas_ ) { <nl> - + mmm a / components / viz / host / layered_window_updater_impl . h <nl> ppp b / components / viz / host / layered_window_updater_impl . h <nl> class VIZ_HOST_EXPORT LayeredWindowUpdaterImpl <nl> - void OnAllocatedSharedMemory ( <nl> - const gfx : : Size & pixel_size , <nl> - mojo : : ScopedSharedBufferHandle scoped_buffer_handle ) override ; <nl> + / / mojom : : LayeredWindowUpdater implementation . <nl> + void OnAllocatedSharedMemory ( const gfx : : Size & pixel_size , <nl> + base : : UnsafeSharedMemoryRegion region ) override ; <nl> - void Draw ( DrawCallback draw_callback ) override ; <nl> + void Draw ( const gfx : : Rect & damage_rect , DrawCallback draw_callback ) override ; <nl> <nl> private : <nl> const HWND hwnd_ ; <nl> - + mmm a / components / viz / service / BUILD . gn <nl> ppp b / components / viz / service / BUILD . gn <nl> viz_component ( " service " ) { <nl> index f17983a5cc70f8ab1e5c531de8e26fdec04a079b . . 16aefe38f0c674d97a89d3e511dc104a <nl> " display_embedder / software_output_surface . h " , <nl> " display_embedder / viz_process_context_provider . cc " , <nl> - + mmm a / components / viz / service / display_embedder / output_surface_provider_impl . cc <nl> ppp b / components / viz / service / display_embedder / output_surface_provider_impl . cc <nl> - <nl> - # include " components / viz / service / display_embedder / server_shared_bitmap_manager . h " <nl> + <nl> + # include " components / viz / service / display_embedder / skia_output_surface_dependency_impl . h " <nl> # include " components / viz / service / display_embedder / skia_output_surface_impl . h " <nl> # include " components / viz / service / display_embedder / skia_output_surface_impl_non_ddl . h " <nl> + # include " components / viz / service / display_embedder / software_output_device_proxy . h " <nl> # include " components / viz / service / display_embedder / software_output_surface . h " <nl> # include " components / viz / service / display_embedder / viz_process_context_provider . h " <nl> # include " components / viz / service / gl / gpu_service_impl . h " <nl> - OutputSurfaceProviderImpl : : CreateSoftwareOutputDeviceForPlatform ( <nl> + OutputSurfaceProviderImpl : : CreateSoftwareOutputDeviceForPlatform ( <nl> if ( headless_ ) <nl> return std : : make_unique < SoftwareOutputDevice > ( ) ; <nl> <nl> index f3867356e3d641416e00e6d115ae9ae2a0be90ab . . b1d192d2b20ccb63fba07093101d745e <nl> <nl> new file mode 100644 <nl> - index 0000000000000000000000000000000000000000 . . bbca3a43b5ba8bcf1e3a4dab4509b903b7117f36 <nl> + index 0000000000000000000000000000000000000000 . . f5fc4f37c10bdc8aca8c1618985d46d10c830437 <nl> mmm / dev / null <nl> ppp b / components / viz / service / display_embedder / software_output_device_proxy . cc <nl> - <nl> + <nl> + / / Copyright 2014 The Chromium Authors . All rights reserved . <nl> + / / Use of this source code is governed by a BSD - style license that can be <nl> + / / found in the LICENSE file . <nl> + <nl> + # include " components / viz / service / display_embedder / software_output_device_proxy . h " <nl> + <nl> - + # include " base / memory / shared_memory . h " <nl> + + # include " base / memory / unsafe_shared_memory_region . h " <nl> + # include " base / threading / thread_checker . h " <nl> + # include " components / viz / common / resources / resource_sizes . h " <nl> + # include " components / viz / service / display_embedder / output_device_backing . h " <nl> index 0000000000000000000000000000000000000000 . . bbca3a43b5ba8bcf1e3a4dab4509b903 <nl> + return ; <nl> + } <nl> + <nl> + + base : : UnsafeSharedMemoryRegion region = <nl> + + base : : UnsafeSharedMemoryRegion : : Create ( required_bytes ) ; <nl> + + if ( ! region . IsValid ( ) ) { <nl> + + DLOG ( ERROR ) < < " Failed to allocate " < < required_bytes < < " bytes " ; <nl> + + return ; <nl> + + } <nl> + + <nl> + # if defined ( WIN32 ) <nl> - + base : : SharedMemory shm ; <nl> - + if ( ! shm . CreateAnonymous ( required_bytes ) ) { <nl> - + DLOG ( ERROR ) < < " Failed to allocate " < < required_bytes < < " bytes " ; <nl> - + return ; <nl> - + } <nl> - + <nl> - + canvas_ = skia : : CreatePlatformCanvasWithSharedSection ( <nl> - + viewport_pixel_size_ . width ( ) , viewport_pixel_size_ . height ( ) , false , <nl> - + shm . handle ( ) . GetHandle ( ) , skia : : CRASH_ON_FAILURE ) ; <nl> - + <nl> - + / / Transfer handle ownership to the browser process . <nl> - + mojo : : ScopedSharedBufferHandle scoped_handle = mojo : : WrapSharedMemoryHandle ( <nl> - + shm . TakeHandle ( ) , required_bytes , <nl> - + mojo : : UnwrappedSharedMemoryHandleProtection : : kReadWrite ) ; <nl> + + canvas_ = skia : : CreatePlatformCanvasWithSharedSection ( <nl> + + viewport_pixel_size_ . width ( ) , viewport_pixel_size_ . height ( ) , false , <nl> + + region . GetPlatformHandle ( ) , skia : : CRASH_ON_FAILURE ) ; <nl> + # else <nl> - + auto shm = mojo : : CreateWritableSharedMemoryRegion ( required_bytes ) ; <nl> - + if ( ! shm . IsValid ( ) ) { <nl> - + DLOG ( ERROR ) < < " Failed to allocate " < < required_bytes < < " bytes " ; <nl> - + return ; <nl> - + } <nl> - + <nl> - + shm_mapping_ = shm . Map ( ) ; <nl> - + if ( ! shm_mapping_ . IsValid ( ) ) { <nl> - + DLOG ( ERROR ) < < " Failed to map " < < required_bytes < < " bytes " ; <nl> - + return ; <nl> - + } <nl> - + <nl> - + canvas_ = skia : : CreatePlatformCanvasWithPixels ( <nl> - + viewport_pixel_size_ . width ( ) , viewport_pixel_size_ . height ( ) , false , <nl> - + static_cast < uint8_t * > ( shm_mapping_ . memory ( ) ) , skia : : CRASH_ON_FAILURE ) ; <nl> - + <nl> - + mojo : : ScopedSharedBufferHandle scoped_handle = <nl> - + mojo : : WrapWritableSharedMemoryRegion ( std : : move ( shm ) ) ; <nl> + + shm_mapping_ = region . Map ( ) ; <nl> + + if ( ! shm_mapping_ . IsValid ( ) ) { <nl> + + DLOG ( ERROR ) < < " Failed to map " < < required_bytes < < " bytes " ; <nl> + + return ; <nl> + + } <nl> + + <nl> + + canvas_ = skia : : CreatePlatformCanvasWithPixels ( <nl> + + viewport_pixel_size_ . width ( ) , viewport_pixel_size_ . height ( ) , false , <nl> + + static_cast < uint8_t * > ( shm_mapping_ . memory ( ) ) , skia : : CRASH_ON_FAILURE ) ; <nl> + # endif <nl> + <nl> + + / / Transfer region ownership to the browser process . <nl> + layered_window_updater_ - > OnAllocatedSharedMemory ( viewport_pixel_size_ , <nl> - + std : : move ( scoped_handle ) ) ; <nl> + + std : : move ( region ) ) ; <nl> + } <nl> + <nl> + SkCanvas * SoftwareOutputDeviceProxy : : BeginPaintDelegated ( ) { <nl> index 0000000000000000000000000000000000000000 . . ff3c0217812a8370a20aa528f117e928 <nl> + <nl> + # endif / / COMPONENTS_VIZ_SERVICE_DISPLAY_EMBEDDER_SOFTWARE_OUTPUT_DEVICE_PROXY_H_ <nl> - + mmm a / components / viz / service / display_embedder / software_output_device_win . cc <nl> ppp b / components / viz / service / display_embedder / software_output_device_win . cc <nl> <nl> index 4e3f0255d5fe4991004a50768932c36c42d999ff . . bf352091cef00482e3cec74cd523e469 <nl> # include " mojo / public / cpp / system / platform_handle . h " <nl> # include " services / viz / privileged / interfaces / compositing / layered_window_updater . mojom . h " <nl> # include " skia / ext / platform_canvas . h " <nl> - void SoftwareOutputDeviceWinProxy : : EndPaintDelegated ( <nl> + void SoftwareOutputDeviceWinProxy : : EndPaintDelegated ( <nl> if ( ! canvas_ ) <nl> return ; <nl> <nl> index 4e3f0255d5fe4991004a50768932c36c42d999ff . . bf352091cef00482e3cec74cd523e469 <nl> & SoftwareOutputDeviceWinProxy : : DrawAck , base : : Unretained ( this ) ) ) ; <nl> waiting_on_draw_ack_ = true ; <nl> <nl> - std : : unique_ptr < SoftwareOutputDevice > CreateSoftwareOutputDeviceWin ( <nl> + std : : unique_ptr < SoftwareOutputDevice > CreateSoftwareOutputDeviceWin ( <nl> display_client - > CreateLayeredWindowUpdater ( <nl> mojo : : MakeRequest ( & layered_window_updater ) ) ; <nl> <nl> index 4e3f0255d5fe4991004a50768932c36c42d999ff . . bf352091cef00482e3cec74cd523e469 <nl> return std : : make_unique < SoftwareOutputDeviceWinDirect > ( hwnd , backing ) ; <nl> } <nl> - + mmm a / services / viz / privileged / interfaces / compositing / display_private . mojom <nl> ppp b / services / viz / privileged / interfaces / compositing / display_private . mojom <nl> interface DisplayPrivate { <nl> index deb327b7705462d2cc07edb9d37528035377af8b . . bc6958aa7e4dc14d3e0cf04029964282 <nl> <nl> / / Notifies that a swap has occurred and provides information about the pixel <nl> - + mmm a / services / viz / privileged / interfaces / compositing / layered_window_updater . mojom <nl> ppp b / services / viz / privileged / interfaces / compositing / layered_window_updater . mojom <nl> - interface LayeredWindowUpdater { <nl> + interface LayeredWindowUpdater { <nl> / / Draws to the HWND by copying pixels from shared memory . Callback must be <nl> / / called after draw operation is complete to signal shared memory can be <nl> / / modified . <nl> index 360cab3eee4c5189a55269d76daa1d78a98ed3d3 . . 6834242f23d27fd6d428c2cd6040206a <nl> + Draw ( gfx . mojom . Rect damage_rect ) = > ( ) ; <nl> } ; <nl> - + mmm a / ui / compositor / compositor . h <nl> ppp b / ui / compositor / compositor . h <nl> <nl> index 494241c374b7ffac0fa89549dc1b8a30359eb17f . . 5ac7c707374ebcb5510c76017edfccee <nl> / / Sets the root of the layer tree drawn by this Compositor . The root layer <nl> / / must have no parent . The compositor ' s root layer is reset if the root layer <nl> / / is destroyed . NULL can be passed to reset the root layer , in which case the <nl> - class COMPOSITOR_EXPORT Compositor : public cc : : LayerTreeHostClient , <nl> + class COMPOSITOR_EXPORT Compositor : public cc : : LayerTreeHostClient , <nl> ui : : ContextFactory * context_factory_ ; <nl> ui : : ContextFactoryPrivate * context_factory_private_ ; <nl> <nl> mmm a / patches / chromium / fix_disable_usage_of_setapplicationisdaemon_and . patch <nl> ppp b / patches / chromium / fix_disable_usage_of_setapplicationisdaemon_and . patch <nl> Subject : fix : disable usage of SetApplicationIsDaemon and <nl> _LSSetApplicationLaunchServicesServerConnectionStatus in MAS builds <nl> <nl> - + mmm a / content / utility / utility_service_factory . cc <nl> ppp b / content / utility / utility_service_factory . cc <nl> void UtilityServiceFactory : : RunService ( <nl> new file mode 100644 <nl> index 000000000000 . . b1cdb9bfd800 <nl> mmm / dev / null <nl> ppp b / patches / chromium / fix_re - add_endauxattributes_to_fix_gpu_info_enumeration . patch <nl> <nl> + From 0000000000000000000000000000000000000000 Mon Sep 17 00 : 00 : 00 2001 <nl> + From : Samuel Attard < sattard @ slack - corp . com > <nl> + Date : Tue , 2 Jul 2019 14 : 53 : 57 - 0700 <nl> + Subject : fix : re - add EndAuxAttributes to fix gpu info enumeration <nl> + <nl> + <nl> pppmmm a / gpu / config / gpu_info . cc <nl> ppp + b / gpu / config / gpu_info . cc <nl> + void GPUInfo : : EnumerateFields ( Enumerator * enumerator ) const { <nl> + enumerator - > AddInt64 ( " rgbaVisual " , rgba_visual ) ; <nl> + # endif <nl> + enumerator - > AddBool ( " oopRasterizationSupported " , oop_rasterization_supported ) ; <nl> + + enumerator - > EndAuxAttributes ( ) ; <nl> + } <nl> + <nl> + } / / namespace gpu <nl> mmm a / patches / chromium / frame_host_manager . patch <nl> ppp b / patches / chromium / frame_host_manager . patch <nl> and respond with custom instance . Also allows for us to at - runtime <nl> enable or disable this patch . <nl> <nl> - + mmm a / content / browser / browsing_instance . cc <nl> ppp b / content / browser / browsing_instance . cc <nl> - scoped_refptr < SiteInstanceImpl > BrowsingInstance : : GetSiteInstanceForURL ( <nl> + scoped_refptr < SiteInstanceImpl > BrowsingInstance : : GetSiteInstanceForURL ( <nl> return instance ; <nl> } <nl> <nl> index 12e1c5cff95aa6d0a907a249208e23371cf29785 . . 3bc26b7870ff3bf6a69cb1e123fb372f <nl> bool allow_default_instance , <nl> GURL * site_url , <nl> - + mmm a / content / browser / browsing_instance . h <nl> ppp b / content / browser / browsing_instance . h <nl> class CONTENT_EXPORT BrowsingInstance final <nl> index 775b64a8d20f89845812852a2904a1e6875c2b4a . . 5235b57bbf44fc7b30ca6943c43a290f <nl> / / another SiteInstance for the same site . <nl> void RegisterSiteInstance ( SiteInstanceImpl * site_instance ) ; <nl> - + mmm a / content / browser / frame_host / render_frame_host_manager . cc <nl> ppp b / content / browser / frame_host / render_frame_host_manager . cc <nl> - bool RenderFrameHostManager : : InitRenderView ( <nl> + bool RenderFrameHostManager : : InitRenderView ( <nl> scoped_refptr < SiteInstance > <nl> RenderFrameHostManager : : GetSiteInstanceForNavigationRequest ( <nl> const NavigationRequest & request ) { <nl> + BrowserContext * browser_context = nullptr ; <nl> - + scoped_refptr < SiteInstance > candidate_site_instance ; <nl> + + scoped_refptr < SiteInstanceImpl > candidate_site_instance ; <nl> + if ( ! GetContentClient ( ) - > browser ( ) - > CanUseCustomSiteInstance ( ) ) { <nl> + browser_context = <nl> + delegate_ - > GetControllerForRenderManager ( ) . GetBrowserContext ( ) ; <nl> index 297b61198dd46114b3d8c89488a71ed01aa299c4 . . 40b848a8b448bed2d167bf5f6c0f2597 <nl> + ? speculative_render_frame_host_ - > GetSiteInstance ( ) <nl> + : nullptr ; <nl> + } <nl> - / / First , check if the navigation can switch SiteInstances . If not , the <nl> - / / navigation should use the current SiteInstance . <nl> + + <nl> SiteInstance * current_site_instance = render_frame_host_ - > GetSiteInstance ( ) ; <nl> - RenderFrameHostManager : : GetSiteInstanceForNavigationRequest ( <nl> + <nl> + / / All children of MHTML documents must be MHTML documents . They all live in <nl> + RenderFrameHostManager : : GetSiteInstanceForNavigationRequest ( <nl> request . common_params ( ) . url ) ; <nl> no_renderer_swap_allowed | = <nl> request . from_begin_navigation ( ) & & ! can_renderer_initiate_transfer ; <nl> index 297b61198dd46114b3d8c89488a71ed01aa299c4 . . 40b848a8b448bed2d167bf5f6c0f2597 <nl> } else { <nl> / / Subframe navigations will use the current renderer , unless specifically <nl> / / allowed to swap processes . <nl> - RenderFrameHostManager : : GetSiteInstanceForNavigationRequest ( <nl> + RenderFrameHostManager : : GetSiteInstanceForNavigationRequest ( <nl> if ( no_renderer_swap_allowed & & ! should_swap_for_error_isolation ) <nl> return scoped_refptr < SiteInstance > ( current_site_instance ) ; <nl> <nl> index 297b61198dd46114b3d8c89488a71ed01aa299c4 . . 40b848a8b448bed2d167bf5f6c0f2597 <nl> / / should use . <nl> / / TODO ( clamy ) : We should also consider as a candidate SiteInstance the <nl> / / speculative SiteInstance that was computed on redirects . <nl> - - SiteInstance * candidate_site_instance = <nl> + - SiteInstanceImpl * candidate_site_instance = <nl> + candidate_site_instance = <nl> speculative_render_frame_host_ <nl> ? speculative_render_frame_host_ - > GetSiteInstance ( ) <nl> index 297b61198dd46114b3d8c89488a71ed01aa299c4 . . 40b848a8b448bed2d167bf5f6c0f2597 <nl> } <nl> <nl> - + mmm a / content / browser / site_instance_impl . cc <nl> ppp b / content / browser / site_instance_impl . cc <nl> - bool SiteInstanceImpl : : HasRelatedSiteInstance ( const GURL & url ) { <nl> + bool SiteInstanceImpl : : HasRelatedSiteInstance ( const GURL & url ) { <nl> return browsing_instance_ - > HasSiteInstance ( url ) ; <nl> } <nl> <nl> index fd184108a7993094c29be3f7ebde658e259ede2c . . 75aa4a6b7d58a1bebe34efc923953c69 <nl> const GURL & url ) { <nl> return browsing_instance_ - > GetSiteInstanceForURL ( <nl> - + mmm a / content / browser / site_instance_impl . h <nl> ppp b / content / browser / site_instance_impl . h <nl> class CONTENT_EXPORT SiteInstanceImpl final : public SiteInstance , <nl> index a46901055bdf17b6b0dab14edf753b234dc04a12 . . 113660b6eeff81d56a0415b0fa16211e <nl> size_t GetRelatedActiveContentsCount ( ) override ; <nl> bool RequiresDedicatedProcess ( ) override ; <nl> - + mmm a / content / public / browser / content_browser_client . cc <nl> ppp b / content / public / browser / content_browser_client . cc <nl> void OverrideOnBindInterface ( const service_manager : : BindSourceInfo & remote_info , <nl> index 2dd31166cc52ccb528b338b63fde7d2fb4bbf63d . . ce64276225d5b0acf684e9e70c600a64 <nl> const MainFunctionParams & parameters ) { <nl> return nullptr ; <nl> - + mmm a / content / public / browser / content_browser_client . h <nl> ppp b / content / public / browser / content_browser_client . h <nl> CONTENT_EXPORT void OverrideOnBindInterface ( <nl> mmm a / patches / chromium / gin_enable_disable_v8_platform . patch <nl> ppp b / patches / chromium / gin_enable_disable_v8_platform . patch <nl> index 413e6c5bcc74cd01730c5d4dc66eb92aaf7df8de . . 6c5d101fef97e880bee20d2f76e4b339 <nl> v8 : : Isolate * isolate ( ) { return isolate_ ; } <nl> <nl> - + mmm a / gin / v8_initializer . cc <nl> ppp b / gin / v8_initializer . cc <nl> enum LoadV8FileResult { <nl> mmm a / patches / chromium / gritsettings_resource_ids . patch <nl> ppp b / patches / chromium / gritsettings_resource_ids . patch <nl> Subject : gritsettings_resource_ids . patch <nl> Add electron resources file to the list of resource ids generation . <nl> <nl> - + mmm a / tools / gritsettings / resource_ids <nl> ppp b / tools / gritsettings / resource_ids <nl> - <nl> + <nl> " includes " : [ 28880 ] , <nl> } , <nl> <nl> mmm a / patches / chromium / mas - audiodeviceduck . patch <nl> ppp b / patches / chromium / mas - audiodeviceduck . patch <nl> Subject : mas - audiodeviceduck . patch <nl> Removes usage of the AudioDeviceDuck private API . <nl> <nl> - + mmm a / media / audio / mac / audio_low_latency_input_mac . cc <nl> ppp b / media / audio / mac / audio_low_latency_input_mac . cc <nl> <nl> mmm a / patches / chromium / mas - cgdisplayusesforcetogray . patch <nl> ppp b / patches / chromium / mas - cgdisplayusesforcetogray . patch <nl> Subject : mas - cgdisplayusesforcetogray . patch <nl> Removes usage of the CGDisplayUsesForceToGray private API . <nl> <nl> - + mmm a / ui / display / mac / screen_mac . mm <nl> ppp b / ui / display / mac / screen_mac . mm <nl> - Display BuildDisplayForScreen ( NSScreen * screen ) { <nl> + Display BuildDisplayForScreen ( NSScreen * screen ) { <nl> <nl> display . set_color_depth ( NSBitsPerPixelFromDepth ( [ screen depth ] ) ) ; <nl> display . set_depth_per_component ( NSBitsPerSampleFromDepth ( [ screen depth ] ) ) ; <nl> index 4d5b83a1a4b0c1d03378ab1aae8ef43935c387d3 . . 463ff7105ac329cafed793fd87cfc842 <nl> display . set_is_monochrome ( CGDisplayUsesForceToGray ( ) ) ; <nl> + # endif <nl> <nl> - / / CGDisplayRotation returns a double . Display : : SetRotationAsDegree will <nl> - / / handle the unexpected situations were the angle is not a multiple of 90 . <nl> + if ( auto display_link = ui : : DisplayLinkMac : : GetForDisplay ( display_id ) ) <nl> + display . set_display_frequency ( display_link - > GetRefreshRate ( ) ) ; <nl> mmm a / patches / chromium / mas - lssetapplicationlaunchservicesserverconnectionstatus . patch <nl> ppp b / patches / chromium / mas - lssetapplicationlaunchservicesserverconnectionstatus . patch <nl> Removes usage of the _LSSetApplicationLaunchServicesServerConnectionStatus <nl> private API . <nl> <nl> - + mmm a / content / gpu / gpu_main . cc <nl> ppp b / content / gpu / gpu_main . cc <nl> - int GpuMain ( const MainFunctionParams & parameters ) { <nl> + int GpuMain ( const MainFunctionParams & parameters ) { <nl> std : : make_unique < base : : SingleThreadTaskExecutor > ( <nl> base : : MessagePump : : Type : : NS_RUNLOOP ) ; <nl> <nl> mmm a / patches / chromium / mas_no_private_api . patch <nl> ppp b / patches / chromium / mas_no_private_api . patch <nl> index 743d1364bcd13e24ecbe5ced730161d15b8c3e93 . . a7e81072194c00baa0aa3159a6bfe374 <nl> / / is concerned . <nl> @ property ( nonatomic , readonly ) NSString * subrole ; <nl> - + mmm a / content / browser / accessibility / browser_accessibility_cocoa . mm <nl> ppp b / content / browser / accessibility / browser_accessibility_cocoa . mm <nl> <nl> index 237b07caa5ed7626c3b5b538cbb77f582f884203 . . cc4cb1ce9308ba8aecd6cc138954a1b5 <nl> extern " C " { <nl> <nl> / / The following are private accessibility APIs required for cursor navigation <nl> - void AddMisspelledTextAttributes ( <nl> - AddMisspelledTextAttributes ( text_only_objects , attributed_text ) ; <nl> - return [ attributed_text attributedSubstringFromRange : range ] ; <nl> + void AddMisspelledTextAttributes ( <nl> + AddMisspelledTextAttributes ( anchor_ranges , attributed_text ) ; <nl> + return attributed_text ; <nl> } <nl> + # endif <nl> <nl> / / Returns an autoreleased copy of the AXNodeData ' s attribute . <nl> NSString * NSStringForStringAttribute ( BrowserAccessibility * browserAccessibility , <nl> - + ( void ) initialize { <nl> + + ( void ) initialize { <nl> { NSAccessibilityEditableAncestorAttribute , @ " editableAncestor " } , <nl> { NSAccessibilityElementBusyAttribute , @ " elementBusy " } , <nl> { NSAccessibilityEnabledAttribute , @ " enabled " } , <nl> index 237b07caa5ed7626c3b5b538cbb77f582f884203 . . cc4cb1ce9308ba8aecd6cc138954a1b5 <nl> { NSAccessibilityExpandedAttribute , @ " expanded " } , <nl> { NSAccessibilityFocusableAncestorAttribute , @ " focusableAncestor " } , <nl> { NSAccessibilityFocusedAttribute , @ " focused " } , <nl> - + ( void ) initialize { <nl> + + ( void ) initialize { <nl> { NSAccessibilityRowsAttribute , @ " rows " } , <nl> / / TODO ( aboxhall ) : expose <nl> / / NSAccessibilityServesAsTitleForUIElementsAttribute <nl> index 237b07caa5ed7626c3b5b538cbb77f582f884203 . . cc4cb1ce9308ba8aecd6cc138954a1b5 <nl> { NSAccessibilitySizeAttribute , @ " size " } , <nl> { NSAccessibilitySortDirectionAttribute , @ " sortDirection " } , <nl> { NSAccessibilitySubroleAttribute , @ " subrole " } , <nl> - - ( NSNumber * ) enabled { <nl> + - ( NSNumber * ) enabled { <nl> ax : : mojom : : Restriction : : kDisabled ] ; <nl> } <nl> <nl> index 237b07caa5ed7626c3b5b538cbb77f582f884203 . . cc4cb1ce9308ba8aecd6cc138954a1b5 <nl> / / Returns a text marker that points to the last character in the document that <nl> / / can be selected with VoiceOver . <nl> - ( id ) endTextMarker { <nl> - - ( id ) endTextMarker { <nl> + - ( id ) endTextMarker { <nl> BrowserAccessibilityPositionInstance position = root - > CreatePositionAt ( 0 ) ; <nl> return CreateTextMarker ( position - > CreatePositionAtEndOfAnchor ( ) ) ; <nl> } <nl> index 237b07caa5ed7626c3b5b538cbb77f582f884203 . . cc4cb1ce9308ba8aecd6cc138954a1b5 <nl> <nl> - ( NSNumber * ) expanded { <nl> if ( ! [ self instanceActive ] ) <nl> - - ( NSValue * ) selectedTextRange { <nl> + - ( NSValue * ) selectedTextRange { <nl> return [ NSValue valueWithRange : NSMakeRange ( selStart , selLength ) ] ; <nl> } <nl> <nl> index 237b07caa5ed7626c3b5b538cbb77f582f884203 . . cc4cb1ce9308ba8aecd6cc138954a1b5 <nl> - ( id ) selectedTextMarkerRange { <nl> if ( ! [ self instanceActive ] ) <nl> return nil ; <nl> - - ( id ) selectedTextMarkerRange { <nl> + - ( id ) selectedTextMarkerRange { <nl> anchorAffinity , * focusObject , <nl> focusOffset , focusAffinity ) ) ; <nl> } <nl> index 237b07caa5ed7626c3b5b538cbb77f582f884203 . . cc4cb1ce9308ba8aecd6cc138954a1b5 <nl> <nl> - ( NSValue * ) size { <nl> if ( ! [ self instanceActive ] ) <nl> - - ( NSString * ) sortDirection { <nl> + - ( NSString * ) sortDirection { <nl> return nil ; <nl> } <nl> <nl> index 237b07caa5ed7626c3b5b538cbb77f582f884203 . . cc4cb1ce9308ba8aecd6cc138954a1b5 <nl> / / Returns a text marker that points to the first character in the document that <nl> / / can be selected with VoiceOver . <nl> - ( id ) startTextMarker { <nl> - - ( id ) startTextMarker { <nl> + - ( id ) startTextMarker { <nl> BrowserAccessibilityPositionInstance position = root - > CreatePositionAt ( 0 ) ; <nl> return CreateTextMarker ( position - > CreatePositionAtStartOfAnchor ( ) ) ; <nl> } <nl> index 237b07caa5ed7626c3b5b538cbb77f582f884203 . . cc4cb1ce9308ba8aecd6cc138954a1b5 <nl> <nl> / / Returns a subrole based upon the role . <nl> - ( NSString * ) subrole { <nl> - - ( NSAttributedString * ) attributedValueForRange : ( NSRange ) range { <nl> + - ( NSAttributedString * ) attributedValueForRange : ( NSRange ) range { <nl> NSMutableAttributedString * attributedValue = <nl> [ [ [ NSMutableAttributedString alloc ] initWithString : value ] autorelease ] ; <nl> <nl> + # ifndef MAS_BUILD <nl> if ( ! owner_ - > IsTextOnlyObject ( ) ) { <nl> - std : : vector < const BrowserAccessibility * > textOnlyObjects = <nl> - BrowserAccessibilityManager : : FindTextOnlyObjectsInRange ( * owner_ , <nl> - * owner_ ) ; <nl> - AddMisspelledTextAttributes ( textOnlyObjects , attributedValue ) ; <nl> + const std : : vector < AXPlatformRange > anchorRanges = <nl> + AXPlatformRange ( owner_ - > CreatePositionAt ( 0 ) , <nl> + - ( NSAttributedString * ) attributedValueForRange : ( NSRange ) range { <nl> + . GetAnchors ( ) ; <nl> + AddMisspelledTextAttributes ( anchorRanges , attributedValue ) ; <nl> } <nl> + # endif <nl> <nl> return [ attributedValue attributedSubstringFromRange : range ] ; <nl> } <nl> - - ( id ) accessibilityAttributeValue : ( NSString * ) attribute <nl> + - ( id ) accessibilityAttributeValue : ( NSString * ) attribute <nl> return ToBrowserAccessibilityCocoa ( cell ) ; <nl> } <nl> <nl> index 237b07caa5ed7626c3b5b538cbb77f582f884203 . . cc4cb1ce9308ba8aecd6cc138954a1b5 <nl> if ( [ attribute isEqualToString : @ " AXUIElementForTextMarker " ] ) { <nl> BrowserAccessibilityPositionInstance position = <nl> CreatePositionFromTextMarker ( parameter ) ; <nl> - - ( id ) accessibilityAttributeValue : ( NSString * ) attribute <nl> + - ( id ) accessibilityAttributeValue : ( NSString * ) attribute <nl> NSString * text = GetTextForTextMarkerRange ( parameter ) ; <nl> return [ NSNumber numberWithInt : [ text length ] ] ; <nl> } <nl> index 237b07caa5ed7626c3b5b538cbb77f582f884203 . . cc4cb1ce9308ba8aecd6cc138954a1b5 <nl> <nl> if ( [ attribute isEqualToString : <nl> NSAccessibilityBoundsForRangeParameterizedAttribute ] ) { <nl> - - ( id ) accessibilityAttributeValue : ( NSString * ) attribute <nl> + - ( id ) accessibilityAttributeValue : ( NSString * ) attribute <nl> return nil ; <nl> } <nl> <nl> index 237b07caa5ed7626c3b5b538cbb77f582f884203 . . cc4cb1ce9308ba8aecd6cc138954a1b5 <nl> if ( [ attribute <nl> isEqualToString : <nl> NSAccessibilityLineTextMarkerRangeForTextMarkerParameterizedAttribute ] ) { <nl> - AXPlatformRange range ( position - > CreatePreviousLineStartPosition ( <nl> + AXPlatformRange range ( position - > CreatePreviousLineStartPosition ( <nl> <nl> return @ ( child - > GetIndexInParent ( ) ) ; <nl> } <nl> index 237b07caa5ed7626c3b5b538cbb77f582f884203 . . cc4cb1ce9308ba8aecd6cc138954a1b5 <nl> return nil ; <nl> } <nl> - + mmm a / content / browser / accessibility / browser_accessibility_manager_mac . mm <nl> ppp b / content / browser / accessibility / browser_accessibility_manager_mac . mm <nl> - void PostAnnouncementNotification ( NSString * announcement ) { <nl> + void PostAnnouncementNotification ( NSString * announcement ) { <nl> [ user_info setObject : native_focus_object <nl> forKey : NSAccessibilityTextChangeElement ] ; <nl> <nl> index e02f5f922ea0eeca39fdf0acc265e1ef9dc254a6 . . 764cac3182c3611e2c1fc4a0aa73b13a <nl> id selected_text = [ native_focus_object selectedTextMarkerRange ] ; <nl> if ( selected_text ) { <nl> NSString * const NSAccessibilitySelectedTextMarkerRangeAttribute = <nl> - void PostAnnouncementNotification ( NSString * announcement ) { <nl> + void PostAnnouncementNotification ( NSString * announcement ) { <nl> [ user_info setObject : selected_text <nl> forKey : NSAccessibilitySelectedTextMarkerRangeAttribute ] ; <nl> } <nl> index e59ac93d0e1554a2df5d8c74db2beba25d090228 . . 6657c48664bdec4964b382f80309d1bf <nl> <nl> } / / namespace <nl> - + mmm a / device / bluetooth / bluetooth_adapter_mac . mm <nl> ppp b / device / bluetooth / bluetooth_adapter_mac . mm <nl> <nl> index fcf50dc3bd9a94536d7fc457c4e7b413a83dc672 . . 6252cb195ff77aa31295c4958fd6b80c <nl> should_update_name_ ( true ) , <nl> classic_discovery_manager_ ( <nl> BluetoothDiscoveryManagerMac : : CreateClassic ( this ) ) , <nl> - CBCentralManagerState GetCBManagerState ( CBCentralManager * manager ) { <nl> + CBCentralManagerState GetCBManagerState ( CBCentralManager * manager ) { <nl> } <nl> <nl> bool BluetoothAdapterMac : : SetPoweredImpl ( bool powered ) { <nl> index cb7a5305c2d6cbe7b3aa13efdfe6dcc6dfd857e9 . . e3f3ee7fee0a8f9cf7b3c1b6bed7c2a6 <nl> " AudioToolbox . framework " , <nl> " AudioUnit . framework " , <nl> - + mmm a / media / audio / mac / audio_manager_mac . cc <nl> ppp b / media / audio / mac / audio_manager_mac . cc <nl> AudioParameters AudioManagerMac : : GetPreferredOutputStreamParameters ( <nl> index a9d6babb03ca318ccd15b254d3785a9ad45698c0 . . 34ba3bfb738226ed8b53a9c24d15af5a <nl> } <nl> <nl> - + mmm a / net / dns / dns_config_service_posix . cc <nl> ppp b / net / dns / dns_config_service_posix . cc <nl> class DnsConfigServicePosix : : Watcher { <nl> mmm a / patches / chromium / network_service_allow_remote_certificate_verification_logic . patch <nl> ppp b / patches / chromium / network_service_allow_remote_certificate_verification_logic . patch <nl> Subject : network service : allow remote certificate verification logic <nl> <nl> <nl> - + mmm a / services / network / network_context . cc <nl> ppp b / services / network / network_context . cc <nl> - <nl> + <nl> # include " services / network / url_loader . h " <nl> # include " services / network / url_request_context_builder_mojo . h " <nl> <nl> index 5d871fc08218b71c93141963db66465f775b1bc2 . . 97128a6b6223e7fb977b5c9f20bf18da <nl> # if BUILDFLAG ( IS_CT_SUPPORTED ) <nl> # include " components / certificate_transparency / chrome_ct_policy_enforcer . h " <nl> # include " components / certificate_transparency / chrome_require_ct_delegate . h " <nl> - std : : string HashesToBase64String ( const net : : HashValueVector & hashes ) { <nl> + std : : string HashesToBase64String ( const net : : HashValueVector & hashes ) { <nl> <nl> } / / namespace <nl> <nl> index 5d871fc08218b71c93141963db66465f775b1bc2 . . 97128a6b6223e7fb977b5c9f20bf18da <nl> constexpr uint32_t NetworkContext : : kMaxOutstandingRequestsPerProcess ; <nl> constexpr bool NetworkContext : : enable_resource_scheduler_ ; <nl> <nl> - void NetworkContext : : SetClient ( mojom : : NetworkContextClientPtr client ) { <nl> + void NetworkContext : : SetClient ( mojom : : NetworkContextClientPtr client ) { <nl> client_ = std : : move ( client ) ; <nl> } <nl> <nl> index 5d871fc08218b71c93141963db66465f775b1bc2 . . 97128a6b6223e7fb977b5c9f20bf18da <nl> void NetworkContext : : CreateURLLoaderFactory ( <nl> mojom : : URLLoaderFactoryRequest request , <nl> mojom : : URLLoaderFactoryParamsPtr params ) { <nl> - URLRequestContextOwner NetworkContext : : MakeURLRequestContext ( ) { <nl> + URLRequestContextOwner NetworkContext : : MakeURLRequestContext ( ) { <nl> net : : CreateCertVerifyProcBuiltin ( cert_net_fetcher_ ) ) ) ; <nl> } <nl> # endif <nl> index 5d871fc08218b71c93141963db66465f775b1bc2 . . 97128a6b6223e7fb977b5c9f20bf18da <nl> std : : unique_ptr < net : : NetworkDelegate > network_delegate = <nl> std : : make_unique < NetworkServiceNetworkDelegate > ( this ) ; <nl> - + mmm a / services / network / network_context . h <nl> ppp b / services / network / network_context . h <nl> class DomainReliabilityMonitor ; <nl> index 0f9e0fe5922c228d96ba7d8668a88d5d31c516e9 . . 9552cfa88d2a45aa6bff24c3e89d080c <nl> void CreateURLLoaderFactory ( mojom : : URLLoaderFactoryRequest request , <nl> mojom : : URLLoaderFactoryParamsPtr params ) override ; <nl> void ResetURLLoaderFactories ( ) override ; <nl> - class COMPONENT_EXPORT ( NETWORK_SERVICE ) NetworkContext <nl> + class COMPONENT_EXPORT ( NETWORK_SERVICE ) NetworkContext <nl> std : : unique_ptr < network : : NSSTempCertsCacheChromeOS > nss_temp_certs_cache_ ; <nl> # endif <nl> <nl> index 0f9e0fe5922c228d96ba7d8668a88d5d31c516e9 . . 9552cfa88d2a45aa6bff24c3e89d080c <nl> / / CertNetFetcher is not used by the current platform . <nl> scoped_refptr < net : : CertNetFetcherImpl > cert_net_fetcher_ ; <nl> - + mmm a / services / network / public / mojom / network_context . mojom <nl> ppp b / services / network / public / mojom / network_context . mojom <nl> - interface TrustedURLLoaderHeaderClient { <nl> + interface TrustedURLLoaderHeaderClient { <nl> OnLoaderCreated ( int32 request_id , TrustedHeaderClient & header_client ) ; <nl> } ; <nl> <nl> index 69885a8bc0e2219ed6c10e684db0ad7d5cd6b87e . . bf0750e75e357275f5a569cc8e0680b6 <nl> / / Parameters for constructing a network context . <nl> struct NetworkContextParams { <nl> / / Name used by memory tools to identify the context . <nl> - interface NetworkContext { <nl> + interface NetworkContext { <nl> / / Sets a client for this network context . <nl> SetClient ( NetworkContextClient client ) ; <nl> <nl> mmm a / patches / chromium / no_cache_storage_check . patch <nl> ppp b / patches / chromium / no_cache_storage_check . patch <nl> Do not check for unique origin in CacheStorage , in Electron we may have <nl> scripts running without an origin . <nl> <nl> - + mmm a / content / browser / cache_storage / legacy / legacy_cache_storage . cc <nl> ppp b / content / browser / cache_storage / legacy / legacy_cache_storage . cc <nl> - class LegacyCacheStorage : : CacheLoader { <nl> + class LegacyCacheStorage : : CacheLoader { <nl> cache_storage_ ( cache_storage ) , <nl> origin_ ( origin ) , <nl> owner_ ( owner ) { <nl> mmm a / patches / chromium / notification_provenance . patch <nl> ppp b / patches / chromium / notification_provenance . patch <nl> index f1710b69a91931021ba56db544fce551fad52f46 . . b116b89114a431f8e67a68e7f7cc1c65 <nl> <nl> / / Removes | service | from the list of owned services , for example because the <nl> - + mmm a / content / browser / renderer_interface_binders . cc <nl> ppp b / content / browser / renderer_interface_binders . cc <nl> - void RendererInterfaceBinders : : InitializeParameterizedBinderRegistry ( ) { <nl> + void RendererInterfaceBinders : : InitializeParameterizedBinderRegistry ( ) { <nl> RenderProcessHost * host , const url : : Origin & origin ) { <nl> static_cast < StoragePartitionImpl * > ( host - > GetStoragePartition ( ) ) <nl> - > GetPlatformNotificationContext ( ) <nl> mmm a / patches / chromium / out_of_process_instance . patch <nl> ppp b / patches / chromium / out_of_process_instance . patch <nl> Subject : out_of_process_instance . patch <nl> <nl> <nl> - + mmm a / pdf / out_of_process_instance . cc <nl> ppp b / pdf / out_of_process_instance . cc <nl> - bool OutOfProcessInstance : : Init ( uint32_t argc , <nl> + bool OutOfProcessInstance : : Init ( uint32_t argc , <nl> std : : string document_url = document_url_var . AsString ( ) ; <nl> base : : StringPiece document_url_piece ( document_url ) ; <nl> is_print_preview_ = IsPrintPreviewUrl ( document_url_piece ) ; <nl> mmm a / patches / chromium / pepper_flash . patch <nl> ppp b / patches / chromium / pepper_flash . patch <nl> index 83cedb4c9e1323259afd041e571240cd971e1241 . . 3686ae2fab5f400cf119a54aea547a72 <nl> + return PP_OK ; <nl> } <nl> - + mmm a / chrome / browser / renderer_host / pepper / pepper_flash_browser_host . cc <nl> ppp b / chrome / browser / renderer_host / pepper / pepper_flash_browser_host . cc <nl> <nl> index 9d249be9345202f1022f550f73cb8bdd1b327c56 . . e63ca22a2ebe3f380f6d06ac4f1b1eb8 <nl> # include " content / public / browser / browser_context . h " <nl> # include " content / public / browser / browser_ppapi_host . h " <nl> # include " content / public / browser / browser_task_traits . h " <nl> - using content : : ServiceManagerConnection ; <nl> + using content : : RenderProcessHost ; <nl> <nl> namespace { <nl> <nl> index 9d249be9345202f1022f550f73cb8bdd1b327c56 . . e63ca22a2ebe3f380f6d06ac4f1b1eb8 <nl> / / Get the CookieSettings on the UI thread for the given render process ID . <nl> scoped_refptr < content_settings : : CookieSettings > GetCookieSettings ( <nl> int render_process_id ) { <nl> - scoped_refptr < content_settings : : CookieSettings > GetCookieSettings ( <nl> + scoped_refptr < content_settings : : CookieSettings > GetCookieSettings ( <nl> } <nl> return NULL ; <nl> } <nl> index 9d249be9345202f1022f550f73cb8bdd1b327c56 . . e63ca22a2ebe3f380f6d06ac4f1b1eb8 <nl> <nl> void PepperBindConnectorRequest ( <nl> service_manager : : mojom : : ConnectorRequest connector_request ) { <nl> - PepperFlashBrowserHost : : PepperFlashBrowserHost ( BrowserPpapiHost * host , <nl> + PepperFlashBrowserHost : : PepperFlashBrowserHost ( BrowserPpapiHost * host , <nl> PP_Instance instance , <nl> PP_Resource resource ) <nl> : ResourceHost ( host - > GetPpapiHost ( ) , instance , resource ) , <nl> index 9d249be9345202f1022f550f73cb8bdd1b327c56 . . e63ca22a2ebe3f380f6d06ac4f1b1eb8 <nl> delay_timer_ ( FROM_HERE , base : : TimeDelta : : FromSeconds ( 45 ) , this , <nl> & PepperFlashBrowserHost : : OnDelayTimerFired ) , <nl> weak_factory_ ( this ) { <nl> - int32_t PepperFlashBrowserHost : : OnGetLocalTimeZoneOffset ( <nl> + int32_t PepperFlashBrowserHost : : OnGetLocalTimeZoneOffset ( <nl> <nl> int32_t PepperFlashBrowserHost : : OnGetLocalDataRestrictions ( <nl> ppapi : : host : : HostMessageContext * context ) { <nl> index 9d249be9345202f1022f550f73cb8bdd1b327c56 . . e63ca22a2ebe3f380f6d06ac4f1b1eb8 <nl> / / Getting the Flash LSO settings requires using the CookieSettings which <nl> / / belong to the profile which lives on the UI thread . We lazily initialize <nl> / / | cookie_settings_ | by grabbing the reference from the UI thread and then <nl> - int32_t PepperFlashBrowserHost : : OnGetLocalDataRestrictions ( <nl> + int32_t PepperFlashBrowserHost : : OnGetLocalDataRestrictions ( <nl> context - > MakeReplyMessageContext ( ) , document_url , <nl> plugin_url ) ) ; <nl> } <nl> index 9d249be9345202f1022f550f73cb8bdd1b327c56 . . e63ca22a2ebe3f380f6d06ac4f1b1eb8 <nl> void PepperFlashBrowserHost : : GetLocalDataRestrictions ( <nl> ppapi : : host : : ReplyMessageContext reply_context , <nl> const GURL & document_url , <nl> - void PepperFlashBrowserHost : : GetLocalDataRestrictions ( <nl> + void PepperFlashBrowserHost : : GetLocalDataRestrictions ( <nl> PpapiPluginMsg_Flash_GetLocalDataRestrictionsReply ( <nl> static_cast < int32_t > ( restrictions ) ) ) ; <nl> } <nl> mmm a / patches / chromium / printing . patch <nl> ppp b / patches / chromium / printing . patch <nl> index 88a6142eea4c7a219c08fe3463c44711f5c9fada . . 81db315a0036a123658697aa677e2356 <nl> <nl> void PrintJobWorker : : GetSettingsWithUI ( int document_page_count , <nl> - + mmm a / chrome / browser / printing / print_view_manager_base . cc <nl> ppp b / chrome / browser / printing / print_view_manager_base . cc <nl> <nl> index 7ba43aada1ac44827cca264d6f37814e4a91f458 . . 1ca9fe408ec9a5129f6cec46daeeee46 <nl> # include " mojo / public / cpp / system / buffer . h " <nl> # include " printing / buildflags / buildflags . h " <nl> # include " printing / metafile_skia . h " <nl> - using PrintSettingsCallback = <nl> - base : : OnceCallback < void ( scoped_refptr < PrinterQuery > ) > ; <nl> + using PrintSettingsCallback = <nl> + base : : OnceCallback < void ( std : : unique_ptr < PrinterQuery > ) > ; <nl> <nl> void ShowWarningMessageBox ( const base : : string16 & message ) { <nl> + LOG ( ERROR ) < < " Invalid printer settings " < < message ; <nl> index 7ba43aada1ac44827cca264d6f37814e4a91f458 . . 1ca9fe408ec9a5129f6cec46daeeee46 <nl> / / Runs always on the UI thread . <nl> static bool is_dialog_shown = false ; <nl> if ( is_dialog_shown ) <nl> - void ShowWarningMessageBox ( const base : : string16 & message ) { <nl> + void ShowWarningMessageBox ( const base : : string16 & message ) { <nl> base : : AutoReset < bool > auto_reset ( & is_dialog_shown , true ) ; <nl> <nl> chrome : : ShowWarningMessageBox ( nullptr , base : : string16 ( ) , message ) ; <nl> - + # endif <nl> + + # endif <nl> } <nl> <nl> # if BUILDFLAG ( ENABLE_PRINT_PREVIEW ) <nl> - PrintViewManagerBase : : PrintViewManagerBase ( content : : WebContents * web_contents ) <nl> + PrintViewManagerBase : : PrintViewManagerBase ( content : : WebContents * web_contents ) <nl> queue_ ( g_browser_process - > print_job_manager ( ) - > queue ( ) ) , <nl> weak_ptr_factory_ ( this ) { <nl> DCHECK ( queue_ ) ; <nl> - + # if 0 <nl> + + # if 0 <nl> Profile * profile = <nl> Profile : : FromBrowserContext ( web_contents - > GetBrowserContext ( ) ) ; <nl> printing_enabled_ . Init ( <nl> prefs : : kPrintingEnabled , profile - > GetPrefs ( ) , <nl> - base : : Bind ( & PrintViewManagerBase : : UpdatePrintingEnabled , <nl> - weak_ptr_factory_ . GetWeakPtr ( ) ) ) ; <nl> - + # endif <nl> + base : : BindRepeating ( & PrintViewManagerBase : : UpdatePrintingEnabled , <nl> + weak_ptr_factory_ . GetWeakPtr ( ) ) ) ; <nl> + + # endif <nl> } <nl> <nl> PrintViewManagerBase : : ~ PrintViewManagerBase ( ) { <nl> - PrintViewManagerBase : : ~ PrintViewManagerBase ( ) { <nl> + PrintViewManagerBase : : ~ PrintViewManagerBase ( ) { <nl> DisconnectFromCurrentPrintJob ( ) ; <nl> } <nl> <nl> index 7ba43aada1ac44827cca264d6f37814e4a91f458 . . 1ca9fe408ec9a5129f6cec46daeeee46 <nl> } <nl> <nl> # if BUILDFLAG ( ENABLE_PRINT_PREVIEW ) <nl> - void PrintViewManagerBase : : StartLocalPrintJob ( <nl> + void PrintViewManagerBase : : StartLocalPrintJob ( <nl> void PrintViewManagerBase : : UpdatePrintingEnabled ( ) { <nl> DCHECK_CURRENTLY_ON ( content : : BrowserThread : : UI ) ; <nl> / / The Unretained ( ) is safe because ForEachFrame ( ) is synchronous . <nl> index 7ba43aada1ac44827cca264d6f37814e4a91f458 . . 1ca9fe408ec9a5129f6cec46daeeee46 <nl> } <nl> <nl> void PrintViewManagerBase : : NavigationStopped ( ) { <nl> - void PrintViewManagerBase : : OnPrintingFailed ( int cookie ) { <nl> + void PrintViewManagerBase : : OnPrintingFailed ( int cookie ) { <nl> PrintManager : : OnPrintingFailed ( cookie ) ; <nl> <nl> # if BUILDFLAG ( ENABLE_PRINT_PREVIEW ) <nl> index 7ba43aada1ac44827cca264d6f37814e4a91f458 . . 1ca9fe408ec9a5129f6cec46daeeee46 <nl> # endif <nl> <nl> ReleasePrinterQuery ( ) ; <nl> - void PrintViewManagerBase : : OnNotifyPrintJobEvent ( <nl> + void PrintViewManagerBase : : OnNotifyPrintJobEvent ( <nl> content : : NotificationService : : NoDetails ( ) ) ; <nl> break ; <nl> } <nl> index 7ba43aada1ac44827cca264d6f37814e4a91f458 . . 1ca9fe408ec9a5129f6cec46daeeee46 <nl> NOTREACHED ( ) ; <nl> break ; <nl> } <nl> - bool PrintViewManagerBase : : CreateNewPrintJob ( PrinterQuery * query ) { <nl> + bool PrintViewManagerBase : : CreateNewPrintJob ( <nl> DCHECK ( ! quit_inner_loop_ ) ; <nl> DCHECK ( query ) ; <nl> <nl> - / / Disconnect the current | print_job_ | . <nl> - DisconnectFromCurrentPrintJob ( ) ; <nl> - - <nl> + <nl> / / We can ' t print if there is no renderer . <nl> if ( ! web_contents ( ) - > GetRenderViewHost ( ) | | <nl> - ! web_contents ( ) - > GetRenderViewHost ( ) - > IsRenderViewLive ( ) ) { <nl> - bool PrintViewManagerBase : : CreateNewPrintJob ( PrinterQuery * query ) { <nl> + bool PrintViewManagerBase : : CreateNewPrintJob ( <nl> DCHECK ( ! print_job_ ) ; <nl> print_job_ = base : : MakeRefCounted < PrintJob > ( ) ; <nl> - print_job_ - > Initialize ( query , RenderSourceName ( ) , number_pages_ ) ; <nl> + print_job_ - > Initialize ( std : : move ( query ) , RenderSourceName ( ) , number_pages_ ) ; <nl> - registrar_ . Add ( this , chrome : : NOTIFICATION_PRINT_JOB_EVENT , <nl> - content : : Source < PrintJob > ( print_job_ . get ( ) ) ) ; <nl> printing_succeeded_ = false ; <nl> return true ; <nl> } <nl> - void PrintViewManagerBase : : ReleasePrintJob ( ) { <nl> + void PrintViewManagerBase : : ReleasePrintJob ( ) { <nl> content : : RenderFrameHost * rfh = printing_rfh_ ; <nl> printing_rfh_ = nullptr ; <nl> <nl> index 7ba43aada1ac44827cca264d6f37814e4a91f458 . . 1ca9fe408ec9a5129f6cec46daeeee46 <nl> if ( ! print_job_ ) <nl> return ; <nl> <nl> - void PrintViewManagerBase : : ReleasePrintJob ( ) { <nl> + void PrintViewManagerBase : : ReleasePrintJob ( ) { <nl> } <nl> <nl> registrar_ . Remove ( this , chrome : : NOTIFICATION_PRINT_JOB_EVENT , <nl> index 7ba43aada1ac44827cca264d6f37814e4a91f458 . . 1ca9fe408ec9a5129f6cec46daeeee46 <nl> / / Don ' t close the worker thread . <nl> print_job_ = nullptr ; <nl> } <nl> - bool PrintViewManagerBase : : PrintNowInternal ( <nl> + bool PrintViewManagerBase : : PrintNowInternal ( <nl> / / Don ' t print / print preview interstitials or crashed tabs . <nl> if ( web_contents ( ) - > ShowingInterstitialPage ( ) | | web_contents ( ) - > IsCrashed ( ) ) <nl> return false ; <nl> index 7ba43aada1ac44827cca264d6f37814e4a91f458 . . 1ca9fe408ec9a5129f6cec46daeeee46 <nl> } <nl> <nl> - + mmm a / chrome / browser / printing / print_view_manager_base . h <nl> ppp b / chrome / browser / printing / print_view_manager_base . h <nl> - class PrintJob ; <nl> + class PrintJob ; <nl> class PrintQueriesQueue ; <nl> class PrinterQuery ; <nl> <nl> index cf074791d0e2e17bbf8cf0b000b8d63e235b7deb . . 30b6e042b12f23299b3b7eaecb8a8e71 <nl> / / Base class for managing the print commands for a WebContents . <nl> class PrintViewManagerBase : public content : : NotificationObserver , <nl> public PrintManager { <nl> - class PrintViewManagerBase : public content : : NotificationObserver , <nl> + class PrintViewManagerBase : public content : : NotificationObserver , <nl> / / Prints the current document immediately . Since the rendering is <nl> / / asynchronous , the actual printing will not be completed on the return of <nl> / / this function . Returns false if printing is impossible at the moment . <nl> index cf074791d0e2e17bbf8cf0b000b8d63e235b7deb . . 30b6e042b12f23299b3b7eaecb8a8e71 <nl> <nl> # if BUILDFLAG ( ENABLE_PRINT_PREVIEW ) <nl> / / Prints the document in | print_data | with settings specified in <nl> - class PrintViewManagerBase : public content : : NotificationObserver , <nl> + class PrintViewManagerBase : public content : : NotificationObserver , <nl> / / The current RFH that is printing with a system printing dialog . <nl> content : : RenderFrameHost * printing_rfh_ ; <nl> <nl> index cf074791d0e2e17bbf8cf0b000b8d63e235b7deb . . 30b6e042b12f23299b3b7eaecb8a8e71 <nl> / / This means we are _blocking_ until all the necessary pages have been <nl> / / rendered or the print settings are being loaded . <nl> - + mmm a / chrome / browser / printing / printing_message_filter . cc <nl> ppp b / chrome / browser / printing / printing_message_filter . cc <nl> <nl> index 1f79e7b127f35e2eaef923af5c4a5f0a7e5250a5 . . 327b37dfbb84c60d7f0e339c3c4cb8ca <nl> base : : Unretained ( this ) ) ) ; <nl> + # if 0 <nl> is_printing_enabled_ . Init ( prefs : : kPrintingEnabled , profile - > GetPrefs ( ) ) ; <nl> - is_printing_enabled_ . MoveToThread ( <nl> + is_printing_enabled_ . MoveToSequence ( <nl> base : : CreateSingleThreadTaskRunnerWithTraits ( { BrowserThread : : IO } ) ) ; <nl> + # endif <nl> } <nl> <nl> PrintingMessageFilter : : ~ PrintingMessageFilter ( ) { <nl> - bool PrintingMessageFilter : : OnMessageReceived ( const IPC : : Message & message ) { <nl> + bool PrintingMessageFilter : : OnMessageReceived ( const IPC : : Message & message ) { <nl> + <nl> void PrintingMessageFilter : : OnGetDefaultPrintSettings ( IPC : : Message * reply_msg ) { <nl> DCHECK_CURRENTLY_ON ( BrowserThread : : IO ) ; <nl> - scoped_refptr < PrinterQuery > printer_query ; <nl> - + # if 0 <nl> + + # if 0 <nl> if ( ! is_printing_enabled_ . GetValue ( ) ) { <nl> / / Reply with NULL query . <nl> - OnGetDefaultPrintSettingsReply ( printer_query , reply_msg ) ; <nl> + OnGetDefaultPrintSettingsReply ( nullptr , reply_msg ) ; <nl> return ; <nl> } <nl> - + # endif <nl> - printer_query = queue_ - > PopPrinterQuery ( 0 ) ; <nl> - if ( ! printer_query . get ( ) ) { <nl> + + # endif <nl> + std : : unique_ptr < PrinterQuery > printer_query = queue_ - > PopPrinterQuery ( 0 ) ; <nl> + if ( ! printer_query ) { <nl> printer_query = <nl> - void PrintingMessageFilter : : OnUpdatePrintSettings ( int document_cookie , <nl> + void PrintingMessageFilter : : OnScriptedPrintReply ( <nl> + void PrintingMessageFilter : : OnUpdatePrintSettings ( int document_cookie , <nl> base : : Value job_settings , <nl> IPC : : Message * reply_msg ) { <nl> - scoped_refptr < PrinterQuery > printer_query ; <nl> - + # if 0 <nl> + + # if 0 <nl> if ( ! is_printing_enabled_ . GetValue ( ) ) { <nl> / / Reply with NULL query . <nl> - OnUpdatePrintSettingsReply ( printer_query , reply_msg ) ; <nl> + OnUpdatePrintSettingsReply ( nullptr , reply_msg ) ; <nl> return ; <nl> } <nl> - + # endif <nl> - printer_query = queue_ - > PopPrinterQuery ( document_cookie ) ; <nl> - if ( ! printer_query . get ( ) ) { <nl> - printer_query = queue_ - > CreatePrinterQuery ( <nl> + + # endif <nl> + std : : unique_ptr < PrinterQuery > printer_query = <nl> + queue_ - > PopPrinterQuery ( document_cookie ) ; <nl> + if ( ! printer_query ) { <nl> void PrintingMessageFilter : : OnUpdatePrintSettingsReply ( <nl> # if BUILDFLAG ( ENABLE_PRINT_PREVIEW ) <nl> void PrintingMessageFilter : : OnCheckForCancel ( const PrintHostMsg_PreviewIds & ids , <nl> index 1f79e7b127f35e2eaef923af5c4a5f0a7e5250a5 . . 327b37dfbb84c60d7f0e339c3c4cb8ca <nl> # endif <nl> <nl> - + mmm a / chrome / browser / printing / printing_message_filter . h <nl> ppp b / chrome / browser / printing / printing_message_filter . h <nl> struct PrintHostMsg_ScriptedPrint_Params ; <nl> index 1802034a6e15a6ad8b0d9591cfb79ba5873dc982 . . a827091facdb4f6b1d74ce826c3492ce <nl> / / Like PrintMsg_PrintPages , but using the print preview document ' s frame / node . <nl> IPC_MESSAGE_ROUTED0 ( PrintMsg_PrintForSystemDialog ) <nl> - + mmm a / components / printing / renderer / print_render_frame_helper . cc <nl> ppp b / components / printing / renderer / print_render_frame_helper . cc <nl> <nl> index 74f26daa76a22c749007f06a7f4eeeafb8bb297b . . d842180c0d69b993971b50d5a1dcf8ad <nl> # include " printing / units . h " <nl> # include " third_party / blink / public / common / frame / frame_owner_element_type . h " <nl> # include " third_party / blink / public / common / frame / sandbox_flags . h " <nl> - void PrintRenderFrameHelper : : ScriptedPrint ( bool user_initiated ) { <nl> + void PrintRenderFrameHelper : : ScriptedPrint ( bool user_initiated ) { <nl> web_frame - > DispatchBeforePrintEvent ( ) ; <nl> if ( ! weak_this ) <nl> return ; <nl> index 74f26daa76a22c749007f06a7f4eeeafb8bb297b . . d842180c0d69b993971b50d5a1dcf8ad <nl> if ( weak_this ) <nl> web_frame - > DispatchAfterPrintEvent ( ) ; <nl> } <nl> - void PrintRenderFrameHelper : : OnDestruct ( ) { <nl> + void PrintRenderFrameHelper : : OnDestruct ( ) { <nl> delete this ; <nl> } <nl> <nl> index 74f26daa76a22c749007f06a7f4eeeafb8bb297b . . d842180c0d69b993971b50d5a1dcf8ad <nl> if ( ipc_nesting_level_ > 1 ) <nl> return ; <nl> <nl> - void PrintRenderFrameHelper : : OnPrintPages ( ) { <nl> + void PrintRenderFrameHelper : : OnPrintPages ( ) { <nl> / / If we are printing a PDF extension frame , find the plugin node and print <nl> / / that instead . <nl> auto plugin = delegate_ - > GetPdfElement ( frame ) ; <nl> index 74f26daa76a22c749007f06a7f4eeeafb8bb297b . . d842180c0d69b993971b50d5a1dcf8ad <nl> if ( weak_this ) <nl> frame - > DispatchAfterPrintEvent ( ) ; <nl> / / WARNING : | this | may be gone at this point . Do not do any more work here and <nl> - void PrintRenderFrameHelper : : OnPrintForSystemDialog ( ) { <nl> + void PrintRenderFrameHelper : : OnPrintForSystemDialog ( ) { <nl> } <nl> auto weak_this = weak_ptr_factory_ . GetWeakPtr ( ) ; <nl> Print ( frame , print_preview_context_ . source_node ( ) , <nl> index 74f26daa76a22c749007f06a7f4eeeafb8bb297b . . d842180c0d69b993971b50d5a1dcf8ad <nl> if ( weak_this ) <nl> frame - > DispatchAfterPrintEvent ( ) ; <nl> / / WARNING : | this | may be gone at this point . Do not do any more work here and <nl> - void PrintRenderFrameHelper : : OnPrintPreview ( <nl> + void PrintRenderFrameHelper : : OnPrintPreview ( <nl> if ( ipc_nesting_level_ > 1 ) <nl> return ; <nl> <nl> index 74f26daa76a22c749007f06a7f4eeeafb8bb297b . . d842180c0d69b993971b50d5a1dcf8ad <nl> print_preview_context_ . OnPrintPreview ( ) ; <nl> <nl> UMA_HISTOGRAM_ENUMERATION ( " PrintPreview . PreviewEvent " , <nl> - void PrintRenderFrameHelper : : PrintNode ( const blink : : WebNode & node ) { <nl> + void PrintRenderFrameHelper : : PrintNode ( const blink : : WebNode & node ) { <nl> <nl> auto self = weak_ptr_factory_ . GetWeakPtr ( ) ; <nl> Print ( duplicate_node . GetDocument ( ) . GetFrame ( ) , duplicate_node , <nl> index 74f26daa76a22c749007f06a7f4eeeafb8bb297b . . d842180c0d69b993971b50d5a1dcf8ad <nl> / / Check if | this | is still valid . <nl> if ( ! self ) <nl> return ; <nl> - void PrintRenderFrameHelper : : PrintNode ( const blink : : WebNode & node ) { <nl> + void PrintRenderFrameHelper : : PrintNode ( const blink : : WebNode & node ) { <nl> <nl> void PrintRenderFrameHelper : : Print ( blink : : WebLocalFrame * frame , <nl> const blink : : WebNode & node , <nl> index 74f26daa76a22c749007f06a7f4eeeafb8bb297b . . d842180c0d69b993971b50d5a1dcf8ad <nl> / / If still not finished with earlier print request simply ignore . <nl> if ( prep_frame_view_ ) <nl> return ; <nl> - void PrintRenderFrameHelper : : Print ( blink : : WebLocalFrame * frame , <nl> + void PrintRenderFrameHelper : : Print ( blink : : WebLocalFrame * frame , <nl> FrameReference frame_ref ( frame ) ; <nl> <nl> int expected_page_count = 0 ; <nl> index 74f26daa76a22c749007f06a7f4eeeafb8bb297b . . d842180c0d69b993971b50d5a1dcf8ad <nl> DidFinishPrinting ( FAIL_PRINT_INIT ) ; <nl> return ; / / Failed to init print page settings . <nl> } <nl> - void PrintRenderFrameHelper : : Print ( blink : : WebLocalFrame * frame , <nl> + void PrintRenderFrameHelper : : Print ( blink : : WebLocalFrame * frame , <nl> <nl> PrintMsg_PrintPages_Params print_settings ; <nl> auto self = weak_ptr_factory_ . GetWeakPtr ( ) ; <nl> index 74f26daa76a22c749007f06a7f4eeeafb8bb297b . . d842180c0d69b993971b50d5a1dcf8ad <nl> / / Check if | this | is still valid . <nl> if ( ! self ) <nl> return ; <nl> - void PrintRenderFrameHelper : : Print ( blink : : WebLocalFrame * frame , <nl> + void PrintRenderFrameHelper : : Print ( blink : : WebLocalFrame * frame , <nl> ? blink : : kWebPrintScalingOptionSourceSize <nl> : scaling_option ; <nl> SetPrintPagesParams ( print_settings ) ; <nl> index 74f26daa76a22c749007f06a7f4eeeafb8bb297b . . d842180c0d69b993971b50d5a1dcf8ad <nl> if ( print_settings . params . dpi . IsEmpty ( ) | | <nl> ! print_settings . params . document_cookie ) { <nl> DidFinishPrinting ( OK ) ; / / Release resources and fail silently on failure . <nl> - std : : vector < int > PrintRenderFrameHelper : : GetPrintedPages ( <nl> + std : : vector < int > PrintRenderFrameHelper : : GetPrintedPages ( <nl> return printed_pages ; <nl> } <nl> <nl> index 74f26daa76a22c749007f06a7f4eeeafb8bb297b . . d842180c0d69b993971b50d5a1dcf8ad <nl> / / Check if the printer returned any settings , if the settings is empty , we <nl> / / can safely assume there are no printer drivers configured . So we safely <nl> / / terminate . <nl> - bool PrintRenderFrameHelper : : InitPrintSettings ( bool fit_to_paper_size ) { <nl> + bool PrintRenderFrameHelper : : InitPrintSettings ( bool fit_to_paper_size ) { <nl> return result ; <nl> } <nl> <nl> index 74f26daa76a22c749007f06a7f4eeeafb8bb297b . . d842180c0d69b993971b50d5a1dcf8ad <nl> Send ( new PrintHostMsg_ShowInvalidPrinterSettingsError ( routing_id ( ) ) ) ; <nl> return false ; <nl> - + mmm a / components / printing / renderer / print_render_frame_helper . h <nl> ppp b / components / printing / renderer / print_render_frame_helper . h <nl> class PrintRenderFrameHelper <nl> new file mode 100644 <nl> index 000000000000 . . 193f1a9b4aa5 <nl> mmm / dev / null <nl> ppp b / patches / chromium / put_back_deleted_colors_for_autofill . patch <nl> <nl> + From 0000000000000000000000000000000000000000 Mon Sep 17 00 : 00 : 00 2001 <nl> + From : John Kleinschmidt < jkleinsc @ github . com > <nl> + Date : Thu , 20 Jun 2019 16 : 49 : 25 - 0400 <nl> + Subject : put back deleted colors for autofill <nl> + <nl> + https : / / chromium - review . googlesource . com / c / chromium / src / + / 1652925 removed colors as they are no longer <nl> + needed in chromium but our autofill implementation uses them . This patch can be removed if we refactor <nl> + our autofill implementation to work like chromium . <nl> + <nl> pppmmm a / chrome / browser / ui / libgtkui / native_theme_gtk . cc <nl> ppp + b / chrome / browser / ui / libgtkui / native_theme_gtk . cc <nl> + SkColor SkColorFromColorId ( ui : : NativeTheme : : ColorId color_id ) { <nl> + case ui : : NativeTheme : : kColorId_TableHeaderSeparator : <nl> + return GetBorderColor ( " GtkTreeView # treeview . view GtkButton # button " ) ; <nl> + <nl> + + / / Results Table <nl> + + case ui : : NativeTheme : : kColorId_ResultsTableNormalBackground : <nl> + + return SkColorFromColorId ( <nl> + + ui : : NativeTheme : : kColorId_TextfieldDefaultBackground ) ; <nl> + + case ui : : NativeTheme : : kColorId_ResultsTableHoveredBackground : <nl> + + return color_utils : : AlphaBlend ( <nl> + + SkColorFromColorId ( <nl> + + ui : : NativeTheme : : kColorId_TextfieldDefaultBackground ) , <nl> + + SkColorFromColorId ( <nl> + + ui : : NativeTheme : : kColorId_TextfieldSelectionBackgroundFocused ) , <nl> + + 0 . 5f ) ; <nl> + + case ui : : NativeTheme : : kColorId_ResultsTableNormalText : <nl> + + return SkColorFromColorId ( <nl> + + ui : : NativeTheme : : kColorId_TextfieldDefaultColor ) ; <nl> + + case ui : : NativeTheme : : kColorId_ResultsTableDimmedText : <nl> + + return color_utils : : AlphaBlend ( <nl> + + SkColorFromColorId ( ui : : NativeTheme : : kColorId_TextfieldDefaultColor ) , <nl> + + SkColorFromColorId ( <nl> + + ui : : NativeTheme : : kColorId_TextfieldDefaultBackground ) , <nl> + + 0 . 5f ) ; <nl> + + <nl> + / / Throbber <nl> + / / TODO ( thomasanderson ) : Render GtkSpinner directly . <nl> + case ui : : NativeTheme : : kColorId_ThrobberSpinningColor : <nl> pppmmm a / ui / native_theme / common_theme . cc <nl> ppp + b / ui / native_theme / common_theme . cc <nl> + SkColor GetAuraColor ( NativeTheme : : ColorId color_id , <nl> + case NativeTheme : : kColorId_BubbleFooterBackground : <nl> + return SkColorSetRGB ( 0x32 , 0x36 , 0x39 ) ; <nl> + <nl> + + / / Results Tables <nl> + + case NativeTheme : : kColorId_ResultsTableNormalBackground : <nl> + + return SkColorSetRGB ( 0x28 , 0x28 , 0x28 ) ; <nl> + + case NativeTheme : : kColorId_ResultsTableNormalText : <nl> + + return SK_ColorWHITE ; <nl> + + case NativeTheme : : kColorId_ResultsTableDimmedText : <nl> + + return SkColorSetA ( base_theme - > GetSystemColor ( NativeTheme : : kColorId_ResultsTableNormalText ) , 0x80 ) ; <nl> + + <nl> + / / FocusableBorder <nl> + case NativeTheme : : kColorId_FocusedBorderColor : <nl> + return SkColorSetA ( gfx : : kGoogleBlue300 , 0x66 ) ; <nl> + SkColor GetAuraColor ( NativeTheme : : ColorId color_id , <nl> + case NativeTheme : : kColorId_UnfocusedBorderColor : <nl> + return SkColorSetA ( SK_ColorBLACK , 0x66 ) ; <nl> + <nl> + + / / Results Tables <nl> + + case NativeTheme : : kColorId_ResultsTableNormalBackground : <nl> + + return SK_ColorWHITE ; <nl> + + case NativeTheme : : kColorId_ResultsTableHoveredBackground : <nl> + + return SkColorSetA ( base_theme - > GetSystemColor ( <nl> + + NativeTheme : : kColorId_ResultsTableNormalText ) , <nl> + + 0x0D ) ; <nl> + + case NativeTheme : : kColorId_ResultsTableNormalText : <nl> + + return SK_ColorBLACK ; <nl> + + case NativeTheme : : kColorId_ResultsTableDimmedText : <nl> + + return SkColorSetRGB ( 0x64 , 0x64 , 0x64 ) ; <nl> + + <nl> + / / Material spinner / throbber <nl> + case NativeTheme : : kColorId_ThrobberSpinningColor : <nl> + return gfx : : kGoogleBlue600 ; <nl> pppmmm a / ui / native_theme / native_theme . h <nl> ppp + b / ui / native_theme / native_theme . h <nl> + class NATIVE_THEME_EXPORT NativeTheme { <nl> + kColorId_TableHeaderText , <nl> + kColorId_TableHeaderBackground , <nl> + kColorId_TableHeaderSeparator , <nl> + + / / Results Tables , such as the omnibox <nl> + + kColorId_ResultsTableNormalBackground , <nl> + + kColorId_ResultsTableHoveredBackground , <nl> + + kColorId_ResultsTableNormalText , <nl> + + kColorId_ResultsTableDimmedText , <nl> + / / Colors for the material spinner ( aka throbber ) . <nl> + kColorId_ThrobberSpinningColor , <nl> + kColorId_ThrobberWaitingColor , <nl> pppmmm a / ui / native_theme / native_theme_win . cc <nl> ppp + b / ui / native_theme / native_theme_win . cc <nl> + SkColor NativeThemeWin : : GetSystemColor ( ColorId color_id ) const { <nl> + case kColorId_TableGroupingIndicatorColor : <nl> + return system_colors_ [ COLOR_GRAYTEXT ] ; <nl> + <nl> + + / / Results Tables <nl> + + case kColorId_ResultsTableNormalBackground : <nl> + + return system_colors_ [ COLOR_WINDOW ] ; <nl> + + case kColorId_ResultsTableHoveredBackground : <nl> + + return color_utils : : AlphaBlend ( system_colors_ [ COLOR_HIGHLIGHT ] , <nl> + + system_colors_ [ COLOR_WINDOW ] , 0 . 25f ) ; <nl> + + case kColorId_ResultsTableNormalText : <nl> + + return system_colors_ [ COLOR_WINDOWTEXT ] ; <nl> + + case kColorId_ResultsTableDimmedText : <nl> + + return color_utils : : AlphaBlend ( system_colors_ [ COLOR_WINDOWTEXT ] , <nl> + + system_colors_ [ COLOR_WINDOW ] , 0 . 5f ) ; <nl> + default : <nl> + break ; <nl> + } <nl> mmm a / patches / chromium / render_widget_host_view_base . patch <nl> ppp b / patches / chromium / render_widget_host_view_base . patch <nl> index a2902adc59b6b4083334130f3a8e29fca0c440d2 . . 34673d9ab62311c458a581f98865014f <nl> const blink : : WebMouseEvent & event , <nl> const ui : : LatencyInfo & latency ) { <nl> - + mmm a / content / browser / renderer_host / render_widget_host_view_base . h <nl> ppp b / content / browser / renderer_host / render_widget_host_view_base . h <nl> <nl> index 903131f45d4fa82af9a6315227505b54ee0f1560 . . 6450a05a4829731d3dc2338fd51ef6d0 <nl> # include " content / public / browser / render_widget_host_view . h " <nl> # include " content / public / common / input_event_ack_state . h " <nl> # include " content / public / common / screen_info . h " <nl> - class CursorManager ; <nl> + class CursorManager ; <nl> class MouseWheelPhaseHandler ; <nl> class RenderWidgetHostImpl ; <nl> class RenderWidgetHostViewBaseObserver ; <nl> index 903131f45d4fa82af9a6315227505b54ee0f1560 . . 6450a05a4829731d3dc2338fd51ef6d0 <nl> class SyntheticGestureTarget ; <nl> class TextInputManager ; <nl> class TouchSelectionControllerClientManager ; <nl> - class WebContentsAccessibility ; <nl> + class WebContentsView ; <nl> class WebCursor ; <nl> class DelegatedFrameHost ; <nl> struct TextInputState ; <nl> - class CONTENT_EXPORT RenderWidgetHostViewBase <nl> + class CONTENT_EXPORT RenderWidgetHostViewBase <nl> bool destination_is_loaded , <nl> bool destination_is_frozen ) final ; <nl> <nl> index 903131f45d4fa82af9a6315227505b54ee0f1560 . . 6450a05a4829731d3dc2338fd51ef6d0 <nl> / / This only needs to be overridden by RenderWidgetHostViewBase subclasses <nl> / / that handle content embedded within other RenderWidgetHostViews . <nl> gfx : : PointF TransformPointToRootCoordSpaceF ( <nl> - class CONTENT_EXPORT RenderWidgetHostViewBase <nl> + class CONTENT_EXPORT RenderWidgetHostViewBase <nl> virtual void ProcessGestureEvent ( const blink : : WebGestureEvent & event , <nl> const ui : : LatencyInfo & latency ) ; <nl> <nl> mmm a / patches / chromium / render_widget_host_view_mac . patch <nl> ppp b / patches / chromium / render_widget_host_view_mac . patch <nl> Subject : render_widget_host_view_mac . patch <nl> <nl> <nl> - + mmm a / content / app_shim_remote_cocoa / render_widget_host_view_cocoa . mm <nl> ppp b / content / app_shim_remote_cocoa / render_widget_host_view_cocoa . mm <nl> - void ExtractUnderlines ( NSAttributedString * string , <nl> + void ExtractUnderlines ( NSAttributedString * string , <nl> <nl> } / / namespace <nl> <nl> index 188fe917cb4e60458ca0aff4a467d18b2be915ea . . 62f8697c4a11a0df3be84ef8efe0ff90 <nl> / / These are not documented , so use only after checking - respondsToSelector : . <nl> @ interface NSApplication ( UndocumentedSpeechMethods ) <nl> - ( void ) speakString : ( NSString * ) string ; <nl> - - ( BOOL ) acceptsMouseEventsWhenInactive { <nl> + - ( BOOL ) acceptsMouseEventsWhenInactive { <nl> } <nl> <nl> - ( BOOL ) acceptsFirstMouse : ( NSEvent * ) theEvent { <nl> index 188fe917cb4e60458ca0aff4a467d18b2be915ea . . 62f8697c4a11a0df3be84ef8efe0ff90 <nl> return [ self acceptsMouseEventsWhenInactive ] ; <nl> } <nl> <nl> - - ( void ) keyEvent : ( NSEvent * ) theEvent wasKeyEquivalent : ( BOOL ) equiv { <nl> + - ( void ) keyEvent : ( NSEvent * ) theEvent wasKeyEquivalent : ( BOOL ) equiv { <nl> eventType = = NSKeyDown & & <nl> ! ( modifierFlags & NSCommandKeyMask ) ; <nl> <nl> index 188fe917cb4e60458ca0aff4a467d18b2be915ea . . 62f8697c4a11a0df3be84ef8efe0ff90 <nl> / / We only handle key down events and just simply forward other events . <nl> if ( eventType ! = NSKeyDown ) { <nl> hostHelper_ - > ForwardKeyboardEvent ( event , latency_info ) ; <nl> - - ( NSAccessibilityRole ) accessibilityRole { <nl> + - ( NSAccessibilityRole ) accessibilityRole { <nl> / / Since this implementation doesn ' t have to wait any IPC calls , this doesn ' t <nl> / / make any key - typing jank . - - hbono 7 / 23 / 09 <nl> / / <nl> index 188fe917cb4e60458ca0aff4a467d18b2be915ea . . 62f8697c4a11a0df3be84ef8efe0ff90 <nl> <nl> - ( NSArray * ) validAttributesForMarkedText { <nl> / / This code is just copied from WebKit except renaming variables . <nl> - - ( NSArray * ) validAttributesForMarkedText { <nl> + - ( NSArray * ) validAttributesForMarkedText { <nl> initWithObjects : NSUnderlineStyleAttributeName , <nl> NSUnderlineColorAttributeName , <nl> NSMarkedClauseSegmentAttributeName , <nl> index 188fe917cb4e60458ca0aff4a467d18b2be915ea . . 62f8697c4a11a0df3be84ef8efe0ff90 <nl> return validAttributesForMarkedText_ . get ( ) ; <nl> } <nl> - + mmm a / content / browser / renderer_host / render_widget_host_view_mac . mm <nl> ppp b / content / browser / renderer_host / render_widget_host_view_mac . mm <nl> - <nl> + <nl> # include " ui / events / keycodes / dom / dom_keyboard_layout_map . h " <nl> # include " ui / gfx / geometry / dip_util . h " <nl> # include " ui / gfx / mac / coordinate_conversion . h " <nl> mmm a / patches / chromium / resource_file_conflict . patch <nl> ppp b / patches / chromium / resource_file_conflict . patch <nl> Some alternatives to this patch : <nl> None of these options seems like a substantial maintainability win over this patch to me ( @ nornagon ) . <nl> <nl> - + mmm a / chrome / BUILD . gn <nl> ppp b / chrome / BUILD . gn <nl> - if ( is_chrome_branded & & ! is_android ) { <nl> + if ( is_chrome_branded & & ! is_android ) { <nl> } <nl> } <nl> <nl> index 7b277dc44034b556594bf47736d3ea95e85d2ac2 . . 3d642578ed329b970e23785c09106b4c <nl> chrome_paks ( " packed_resources " ) { <nl> if ( is_mac ) { <nl> output_dir = " $ root_gen_dir / repack " <nl> - if ( ! is_android ) { <nl> + if ( ! is_android ) { <nl> } <nl> } <nl> <nl> deleted file mode 100644 <nl> index d88984d57b75 . . 000000000000 <nl> mmm a / patches / chromium / revert_build_swiftshader_for_arm32 . patch <nl> ppp / dev / null <nl> <nl> - From 0000000000000000000000000000000000000000 Mon Sep 17 00 : 00 : 00 2001 <nl> - From : deepak1556 < hop2deep @ gmail . com > <nl> - Date : Wed , 6 Feb 2019 06 : 36 : 32 + 0530 <nl> - Subject : Revert " Build swiftshader for ARM32 . " <nl> - <nl> - This reverts commit e7caa7ca82fc015675aea8cecf178c83a94ab3a7 . <nl> - <nl> mmmmmm a / ui / gl / BUILD . gn <nl> - ppp b / ui / gl / BUILD . gn <nl> - declare_args ( ) { <nl> - enable_swiftshader = ( is_win | | is_linux | | ( is_mac & & use_egl ) | | <nl> - is_chromeos | | is_fuchsia ) & & <nl> - ( target_cpu = = " x86 " | | target_cpu = = " x64 " | | <nl> - - target_cpu = = " arm " | | target_cpu = = " arm64 " | | <nl> - - target_cpu = = " mipsel " | | target_cpu = = " mips64el " ) <nl> - + target_cpu = = " arm64 " | | target_cpu = = " mipsel " | | <nl> - + target_cpu = = " mips64el " ) <nl> - <nl> - # Whether service side logging ( actual calls into the GL driver ) is enabled <nl> - # or not . <nl> mmm a / patches / chromium / scroll_bounce_flag . patch <nl> ppp b / patches / chromium / scroll_bounce_flag . patch <nl> Subject : scroll_bounce_flag . patch <nl> Patch to make scrollBounce option work . <nl> <nl> - + mmm a / content / renderer / render_thread_impl . cc <nl> ppp b / content / renderer / render_thread_impl . cc <nl> - bool RenderThreadImpl : : IsGpuMemoryBufferCompositorResourcesEnabled ( ) { <nl> + bool RenderThreadImpl : : IsGpuMemoryBufferCompositorResourcesEnabled ( ) { <nl> } <nl> <nl> bool RenderThreadImpl : : IsElasticOverscrollEnabled ( ) { <nl> mmm a / patches / chromium / ssl_security_state_tab_helper . patch <nl> ppp b / patches / chromium / ssl_security_state_tab_helper . patch <nl> Subject : ssl_security_state_tab_helper . patch <nl> Allows populating security tab info for devtools in Electron . <nl> <nl> - + mmm a / chrome / browser / ssl / security_state_tab_helper . cc <nl> ppp b / chrome / browser / ssl / security_state_tab_helper . cc <nl> - <nl> + <nl> # include " base / strings / pattern . h " <nl> # include " base / strings / string_util . h " <nl> # include " build / build_config . h " <nl> index 6ef33c5357cf08c1f17e9f20bd8d659bf4807d1c . . a199f0ee15427b4ea45018702048800a <nl> + # if 0 <nl> # include " components / omnibox / browser / omnibox_field_trial . h " <nl> # include " components / omnibox / common / omnibox_features . h " <nl> + # include " components / password_manager / core / browser / password_manager_metrics_util . h " <nl> + # endif <nl> # include " components / security_state / content / content_utils . h " <nl> # include " content / public / browser / browser_context . h " <nl> # include " content / public / browser / navigation_entry . h " <nl> - <nl> + <nl> # endif / / defined ( OS_CHROMEOS ) <nl> <nl> # if defined ( FULL_SAFE_BROWSING ) <nl> index 6ef33c5357cf08c1f17e9f20bd8d659bf4807d1c . . a199f0ee15427b4ea45018702048800a <nl> <nl> namespace { <nl> <nl> - void RecordSecurityLevel ( <nl> + void RecordSecurityLevel ( <nl> <nl> } / / namespace <nl> <nl> + # if 0 <nl> - using safe_browsing : : SafeBrowsingUIManager ; <nl> + using password_manager : : metrics_util : : PasswordType ; <nl> + - using safe_browsing : : SafeBrowsingUIManager ; <nl> + # endif <nl> <nl> SecurityStateTabHelper : : SecurityStateTabHelper ( <nl> content : : WebContents * web_contents ) <nl> - void SecurityStateTabHelper : : DidFinishNavigation ( <nl> - UMA_HISTOGRAM_BOOLEAN ( " interstitial . ssl . visited_site_after_warning " , true ) ; <nl> - } <nl> - <nl> - + # if 0 <nl> - / / Security indicator UI study ( https : / / crbug . com / 803501 ) : Show a message in <nl> - / / the console to reduce developer confusion about the experimental UI <nl> - / / treatments for HTTPS pages with EV certificates . <nl> - void SecurityStateTabHelper : : DidFinishNavigation ( <nl> - " Validation is still valid . " ) ; <nl> - } <nl> - } <nl> - + # endif <nl> - } <nl> - <nl> - void SecurityStateTabHelper : : DidChangeVisibleSecurityState ( ) { <nl> - SecurityStateTabHelper : : GetMaliciousContentStatus ( ) const { <nl> + SecurityStateTabHelper : : GetMaliciousContentStatus ( ) const { <nl> web_contents ( ) - > GetController ( ) . GetVisibleEntry ( ) ; <nl> if ( ! entry ) <nl> return security_state : : MALICIOUS_CONTENT_STATUS_NONE ; <nl> index 6ef33c5357cf08c1f17e9f20bd8d659bf4807d1c . . a199f0ee15427b4ea45018702048800a <nl> safe_browsing : : SafeBrowsingService * sb_service = <nl> g_browser_process - > safe_browsing_service ( ) ; <nl> if ( ! sb_service ) <nl> - SecurityStateTabHelper : : GetMaliciousContentStatus ( ) const { <nl> + SecurityStateTabHelper : : GetMaliciousContentStatus ( ) const { <nl> break ; <nl> } <nl> } <nl> mmm a / patches / chromium / support_mixed_sandbox_with_zygote . patch <nl> ppp b / patches / chromium / support_mixed_sandbox_with_zygote . patch <nl> However , the patch would need to be reviewed by the security team , as it <nl> does touch a security - sensitive class . <nl> <nl> - + mmm a / content / browser / renderer_host / render_process_host_impl . cc <nl> ppp b / content / browser / renderer_host / render_process_host_impl . cc <nl> - class RendererSandboxedProcessLauncherDelegate <nl> + class RendererSandboxedProcessLauncherDelegate <nl> : public SandboxedProcessLauncherDelegate { <nl> public : <nl> RendererSandboxedProcessLauncherDelegate ( ) { } <nl> index 515e148c26584b7fc9c3fcd9c266e6a7714ca75d . . 4b8c6d7b1a2676df8ef63117785c1aed <nl> <nl> ~ RendererSandboxedProcessLauncherDelegate ( ) override { } <nl> <nl> - class RendererSandboxedProcessLauncherDelegate <nl> + class RendererSandboxedProcessLauncherDelegate <nl> <nl> # if BUILDFLAG ( USE_ZYGOTE_HANDLE ) <nl> service_manager : : ZygoteHandle GetZygote ( ) override { <nl> index 515e148c26584b7fc9c3fcd9c266e6a7714ca75d . . 4b8c6d7b1a2676df8ef63117785c1aed <nl> const base : : CommandLine & browser_command_line = <nl> * base : : CommandLine : : ForCurrentProcess ( ) ; <nl> base : : CommandLine : : StringType renderer_prefix = <nl> - class RendererSandboxedProcessLauncherDelegate <nl> + class RendererSandboxedProcessLauncherDelegate <nl> service_manager : : SandboxType GetSandboxType ( ) override { <nl> return service_manager : : SANDBOX_TYPE_RENDERER ; <nl> } <nl> index 515e148c26584b7fc9c3fcd9c266e6a7714ca75d . . 4b8c6d7b1a2676df8ef63117785c1aed <nl> } ; <nl> <nl> const char kSessionStorageHolderKey [ ] = " kSessionStorageHolderKey " ; <nl> - bool RenderProcessHostImpl : : Init ( ) { <nl> + bool RenderProcessHostImpl : : Init ( ) { <nl> cmd_line - > PrependWrapper ( renderer_prefix ) ; <nl> AppendRendererCommandLine ( cmd_line . get ( ) ) ; <nl> <nl> mmm a / patches / chromium / unsandboxed_ppapi_processes_skip_zygote . patch <nl> ppp b / patches / chromium / unsandboxed_ppapi_processes_skip_zygote . patch <nl> Subject : unsandboxed ppapi processes skip zygote <nl> <nl> <nl> - + mmm a / content / browser / ppapi_plugin_process_host . cc <nl> ppp b / content / browser / ppapi_plugin_process_host . cc <nl> class PpapiPluginSandboxedProcessLauncherDelegate <nl> mmm a / patches / chromium / web_contents . patch <nl> ppp b / patches / chromium / web_contents . patch <nl> Subject : web_contents . patch <nl> <nl> <nl> - + mmm a / content / browser / web_contents / web_contents_impl . cc <nl> ppp b / content / browser / web_contents / web_contents_impl . cc <nl> - void WebContentsImpl : : Init ( const WebContents : : CreateParams & params ) { <nl> + void WebContentsImpl : : Init ( const WebContents : : CreateParams & params ) { <nl> std : : string unique_name ; <nl> frame_tree_ . root ( ) - > SetFrameName ( params . main_frame_name , unique_name ) ; <nl> <nl> index 9f68ff38beffa5840fc3f037df2d4a71f0cbc36a . . f38b9d34f8c29658af6120d5422acb63 <nl> WebContentsViewDelegate * delegate = <nl> GetContentClient ( ) - > browser ( ) - > GetWebContentsViewDelegate ( this ) ; <nl> <nl> - void WebContentsImpl : : Init ( const WebContents : : CreateParams & params ) { <nl> + void WebContentsImpl : : Init ( const WebContents : : CreateParams & params ) { <nl> & render_view_host_delegate_view_ ) ; <nl> } <nl> } <nl> index ecaf30bcb7b916a92a69641dd7b96a3633d407c0 . . 0af625928ca6227a21cd4263a14a42b7 <nl> <nl> RenderWidgetHostViewBase * WebContentsViewGuest : : CreateViewForChildWidget ( <nl> - + mmm a / content / public / browser / web_contents . h <nl> ppp b / content / public / browser / web_contents . h <nl> class BrowserPluginGuestDelegate ; <nl> deleted file mode 100644 <nl> index ff4cbebc46e1 . . 000000000000 <nl> mmm a / patches / chromium / woa_compiler_workaround . patch <nl> ppp / dev / null <nl> <nl> - From 0000000000000000000000000000000000000000 Mon Sep 17 00 : 00 : 00 2001 <nl> - From : Richard Townsend < richard . townsend @ arm . com > <nl> - Date : Mon , 3 Jun 2019 09 : 52 : 49 + 0100 <nl> - Subject : build : pull in a fixed compiler for Windows on Arm <nl> - <nl> - Due to a code - generation defect in the version of Clang used for the M76 <nl> - branch related to virtual method thunks , it ' s necessary to build M76 <nl> - with a later version of Clang . This change pulls in a corrected version <nl> - by setting ELECTRON_BUILDING_WOA = 1 or similar in the environment . <nl> - <nl> - This PR is only intended to be a temporary workaround and will be <nl> - removed when Electron ' s Chromium updates to a compiler unaffected by <nl> - this issue . <nl> - <nl> mmmmmm a / tools / clang / scripts / update . py <nl> - ppp b / tools / clang / scripts / update . py <nl> - CLANG_REVISION = ' 67510fac36d27b2e22c7cd955fc167136b737b93 ' <nl> - CLANG_SVN_REVISION = ' 361212 ' <nl> - CLANG_SUB_REVISION = 3 <nl> - <nl> - + if os . getenv ( ' ELECTRON_BUILDING_WOA ' ) : <nl> - + CLANG_REVISION = ' 56bee1a90a71876cb5067b108bf5715fa1c4e843 ' <nl> - + CLANG_SVN_REVISION = ' 361657 ' <nl> - + CLANG_SUB_REVISION = 1 <nl> - + <nl> - PACKAGE_VERSION = ' % s - % s - % s ' % ( CLANG_SVN_REVISION , CLANG_REVISION [ : 8 ] , <nl> - CLANG_SUB_REVISION ) <nl> - RELEASE_VERSION = ' 9 . 0 . 0 ' <nl> mmm a / patches / chromium / worker_context_will_destroy . patch <nl> ppp b / patches / chromium / worker_context_will_destroy . patch <nl> Subject : worker_context_will_destroy . patch <nl> <nl> <nl> - + mmm a / content / public / renderer / content_renderer_client . h <nl> ppp b / content / public / renderer / content_renderer_client . h <nl> - class CONTENT_EXPORT ContentRendererClient { <nl> + class CONTENT_EXPORT ContentRendererClient { <nl> virtual void DidInitializeWorkerContextOnWorkerThread ( <nl> v8 : : Local < v8 : : Context > context ) { } <nl> <nl> index 31fcd7d89bf8f23d32ad385351d272e81aad36a1 . . 373a76a576e2ccdf604036daadf012c2 <nl> / / An empty URL is returned if the URL is not overriden . <nl> virtual GURL OverrideFlashEmbedWithHTML ( const GURL & url ) ; <nl> - + mmm a / content / renderer / renderer_blink_platform_impl . cc <nl> ppp b / content / renderer / renderer_blink_platform_impl . cc <nl> - void RendererBlinkPlatformImpl : : WillStopWorkerThread ( ) { <nl> + void RendererBlinkPlatformImpl : : WillStopWorkerThread ( ) { <nl> WorkerThreadRegistry : : Instance ( ) - > WillStopCurrentWorkerThread ( ) ; <nl> } <nl> <nl> index 8bdf34b7a2fae5941f986434d2ff39d1f6ab332a . . c89bcd9d4ed37c68ec19f0d4976fe64f <nl> const v8 : : Local < v8 : : Context > & worker ) { <nl> GetContentClient ( ) - > renderer ( ) - > DidInitializeWorkerContextOnWorkerThread ( <nl> - + mmm a / content / renderer / renderer_blink_platform_impl . h <nl> ppp b / content / renderer / renderer_blink_platform_impl . h <nl> - class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { <nl> + class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { <nl> void DidStartWorkerThread ( ) override ; <nl> void WillStopWorkerThread ( ) override ; <nl> void WorkerContextCreated ( const v8 : : Local < v8 : : Context > & worker ) override ; <nl> index a7cc63d04922b00cd2c65283343a9315e86a6bae . . 5f315876dce8fc0b695c0aa44da9cc54 <nl> const blink : : WebString & header_name ) override ; <nl> <nl> - + mmm a / third_party / blink / public / platform / platform . h <nl> ppp b / third_party / blink / public / platform / platform . h <nl> - class BLINK_PLATFORM_EXPORT Platform { <nl> + class BLINK_PLATFORM_EXPORT Platform { <nl> virtual void DidStartWorkerThread ( ) { } <nl> virtual void WillStopWorkerThread ( ) { } <nl> virtual void WorkerContextCreated ( const v8 : : Local < v8 : : Context > & worker ) { } <nl> index 19b78466e66fcaf9a1cc44346e2e47f79381bf36 . . c2c24e3950d647ecd14585e0ed0277c1 <nl> const WebSecurityOrigin & script_origin ) { <nl> return false ; <nl> - + mmm a / third_party / blink / renderer / core / workers / worker_thread . cc <nl> ppp b / third_party / blink / renderer / core / workers / worker_thread . cc <nl> void WorkerThread : : PrepareForShutdownOnWorkerThread ( ) { <nl> mmm a / patches / config . json <nl> ppp b / patches / config . json <nl> <nl> <nl> " src / electron / patches / boringssl " : " src / third_party / boringssl / src " , <nl> <nl> + " src / electron / patches / swiftshader " : " src / third_party / swiftshader " , <nl> + <nl> " src / electron / patches / v8 " : " src / v8 " <nl> } <nl> new file mode 100644 <nl> index 000000000000 . . e69de29bb2d1 <nl> mmm a / patches / v8 / add_realloc . patch <nl> ppp b / patches / v8 / add_realloc . patch <nl> when we override ReallocateBufferMemory , so we therefore need to implement <nl> Realloc on the v8 side . <nl> <nl> - + mmm a / include / v8 . h <nl> ppp b / include / v8 . h <nl> - class V8_EXPORT ArrayBuffer : public Object { <nl> + class V8_EXPORT ArrayBuffer : public Object { <nl> * / <nl> virtual void * AllocateUninitialized ( size_t length ) = 0 ; <nl> <nl> index c54b088404229dccf015e20b6a5bab19d3d94e69 . . cc603dc4aae69de4b09f06ed0bca48cd <nl> * Free the memory block of size | length | , pointed to by | data | . <nl> * That memory is guaranteed to be previously allocated by | Allocate | . <nl> - + mmm a / src / api / api . cc <nl> ppp b / src / api / api . cc <nl> - void V8 : : SetSnapshotDataBlob ( StartupData * snapshot_blob ) { <nl> + void V8 : : SetSnapshotDataBlob ( StartupData * snapshot_blob ) { <nl> i : : V8 : : SetSnapshotBlob ( snapshot_blob ) ; <nl> } <nl> <nl> mmm a / patches / v8 / build_gn . patch <nl> ppp b / patches / v8 / build_gn . patch <nl> Subject : build_gn . patch <nl> <nl> <nl> - + mmm a / BUILD . gn <nl> ppp b / BUILD . gn <nl> - config ( " internal_config " ) { <nl> + config ( " internal_config " ) { <nl> " : v8_header_features " , <nl> ] <nl> <nl> index cf089979d1446b7628ce3a7e634e4e4d2267024e . . fc4571440d5e7b8af281b01d9a66cd56 <nl> <nl> deps = [ <nl> " : v8_libbase " , <nl> - if ( v8_use_snapshot & & current_toolchain = = v8_snapshot_toolchain ) { <nl> + if ( v8_use_snapshot & & current_toolchain = = v8_snapshot_toolchain ) { <nl> <nl> configs = [ " : internal_config " ] <nl> <nl> mmm a / patches / v8 / dcheck . patch <nl> ppp b / patches / v8 / dcheck . patch <nl> Subject : dcheck . patch <nl> <nl> <nl> - + mmm a / src / api / api . cc <nl> ppp b / src / api / api . cc <nl> - void Isolate : : SetPromiseRejectCallback ( PromiseRejectCallback callback ) { <nl> + void Isolate : : SetPromiseRejectCallback ( PromiseRejectCallback callback ) { <nl> } <nl> <nl> void Isolate : : RunMicrotasks ( ) { <nl> index 1b39655a1221b3df0012f5cc26697841d2c100d6 . . a6ea06b358f4ff21b3f4313c82b4ec52 <nl> isolate - > default_microtask_queue ( ) - > RunMicrotasks ( isolate ) ; <nl> } <nl> - + mmm a / src / heap / heap . cc <nl> ppp b / src / heap / heap . cc <nl> - void Heap : : TearDown ( ) { <nl> + void Heap : : TearDown ( ) { <nl> void Heap : : AddGCPrologueCallback ( v8 : : Isolate : : GCCallbackWithData callback , <nl> GCType gc_type , void * data ) { <nl> DCHECK_NOT_NULL ( callback ) ; <nl> mmm a / patches / v8 / deps_provide_more_v8_backwards_compatibility . patch <nl> ppp b / patches / v8 / deps_provide_more_v8_backwards_compatibility . patch <nl> Reviewed - By : Yang Guo < yangguo @ chromium . org > <nl> Reviewed - By : Michaël Zasso < targos @ protonmail . com > <nl> <nl> - + mmm a / include / v8 . h <nl> ppp b / include / v8 . h <nl> class V8_EXPORT PrimitiveArray { <nl> index cc603dc4aae69de4b09f06ed0bca48cdae8eebd3 . . c59b0fa69880c237e3b60f190160d8b9 <nl> Value ( Isolate * isolate , Local < v8 : : Value > obj ) ; <nl> ~ Value ( ) ; <nl> uint16_t * operator * ( ) { return str_ ; } <nl> - class V8_EXPORT BooleanObject : public Object { <nl> + class V8_EXPORT BooleanObject : public Object { <nl> class V8_EXPORT StringObject : public Object { <nl> public : <nl> static Local < Value > New ( Isolate * isolate , Local < String > value ) ; <nl> index cc603dc4aae69de4b09f06ed0bca48cdae8eebd3 . . c59b0fa69880c237e3b60f190160d8b9 <nl> <nl> Local < String > ValueOf ( ) const ; <nl> <nl> - template < class T > Value * Value : : Cast ( T * value ) { <nl> + template < class T > Value * Value : : Cast ( T * value ) { <nl> } <nl> <nl> <nl> index cc603dc4aae69de4b09f06ed0bca48cdae8eebd3 . . c59b0fa69880c237e3b60f190160d8b9 <nl> # ifdef V8_ENABLE_CHECKS <nl> CheckCast ( value ) ; <nl> - + mmm a / src / api / api . cc <nl> ppp b / src / api / api . cc <nl> - int PrimitiveArray : : Length ( ) const { <nl> + int PrimitiveArray : : Length ( ) const { <nl> return array - > length ( ) ; <nl> } <nl> <nl> index 6a501f67ebf900ee30d55bd05ccc58845d71f418 . . 1b39655a1221b3df0012f5cc26697841 <nl> void PrimitiveArray : : Set ( Isolate * v8_isolate , int index , <nl> Local < Primitive > item ) { <nl> i : : Isolate * isolate = reinterpret_cast < i : : Isolate * > ( v8_isolate ) ; <nl> - void PrimitiveArray : : Set ( Isolate * v8_isolate , int index , <nl> + void PrimitiveArray : : Set ( Isolate * v8_isolate , int index , <nl> array - > set ( index , * i_item ) ; <nl> } <nl> <nl> index 6a501f67ebf900ee30d55bd05ccc58845d71f418 . . 1b39655a1221b3df0012f5cc26697841 <nl> Local < Primitive > PrimitiveArray : : Get ( Isolate * v8_isolate , int index ) { <nl> i : : Isolate * isolate = reinterpret_cast < i : : Isolate * > ( v8_isolate ) ; <nl> i : : Handle < i : : FixedArray > array = Utils : : OpenHandle ( this ) ; <nl> - void Message : : PrintCurrentStackTrace ( Isolate * isolate , FILE * out ) { <nl> + void Message : : PrintCurrentStackTrace ( Isolate * isolate , FILE * out ) { <nl> <nl> / / mmm S t a c k T r a c e mmm <nl> <nl> index 6a501f67ebf900ee30d55bd05ccc58845d71f418 . . 1b39655a1221b3df0012f5cc26697841 <nl> Local < StackFrame > StackTrace : : GetFrame ( Isolate * v8_isolate , <nl> uint32_t index ) const { <nl> i : : Isolate * isolate = reinterpret_cast < i : : Isolate * > ( v8_isolate ) ; <nl> - MaybeLocal < BigInt > Value : : ToBigInt ( Local < Context > context ) const { <nl> + MaybeLocal < BigInt > Value : : ToBigInt ( Local < Context > context ) const { <nl> RETURN_ESCAPED ( result ) ; <nl> } <nl> <nl> index 6a501f67ebf900ee30d55bd05ccc58845d71f418 . . 1b39655a1221b3df0012f5cc26697841 <nl> bool Value : : BooleanValue ( Isolate * v8_isolate ) const { <nl> return Utils : : OpenHandle ( this ) - > BooleanValue ( <nl> reinterpret_cast < i : : Isolate * > ( v8_isolate ) ) ; <nl> - MaybeLocal < Uint32 > Value : : ToArrayIndex ( Local < Context > context ) const { <nl> + MaybeLocal < Uint32 > Value : : ToArrayIndex ( Local < Context > context ) const { <nl> return Local < Uint32 > ( ) ; <nl> } <nl> <nl> index 6a501f67ebf900ee30d55bd05ccc58845d71f418 . . 1b39655a1221b3df0012f5cc26697841 <nl> Maybe < bool > Value : : Equals ( Local < Context > context , Local < Value > that ) const { <nl> i : : Isolate * isolate = Utils : : OpenHandle ( * context ) - > GetIsolate ( ) ; <nl> auto self = Utils : : OpenHandle ( this ) ; <nl> - bool String : : ContainsOnlyOneByte ( ) const { <nl> + bool String : : ContainsOnlyOneByte ( ) const { <nl> return helper . Check ( * str ) ; <nl> } <nl> <nl> index 6a501f67ebf900ee30d55bd05ccc58845d71f418 . . 1b39655a1221b3df0012f5cc26697841 <nl> int String : : Utf8Length ( Isolate * isolate ) const { <nl> i : : Handle < i : : String > str = Utils : : OpenHandle ( this ) ; <nl> str = i : : String : : Flatten ( reinterpret_cast < i : : Isolate * > ( isolate ) , str ) ; <nl> - static int WriteUtf8Impl ( i : : Vector < const Char > string , char * write_start , <nl> + static int WriteUtf8Impl ( i : : Vector < const Char > string , char * write_start , <nl> } <nl> } / / anonymous namespace <nl> <nl> index 6a501f67ebf900ee30d55bd05ccc58845d71f418 . . 1b39655a1221b3df0012f5cc26697841 <nl> int String : : WriteUtf8 ( Isolate * v8_isolate , char * buffer , int capacity , <nl> int * nchars_ref , int options ) const { <nl> i : : Handle < i : : String > str = Utils : : OpenHandle ( this ) ; <nl> - static inline int WriteHelper ( i : : Isolate * isolate , const String * string , <nl> + static inline int WriteHelper ( i : : Isolate * isolate , const String * string , <nl> return end - start ; <nl> } <nl> <nl> index 6a501f67ebf900ee30d55bd05ccc58845d71f418 . . 1b39655a1221b3df0012f5cc26697841 <nl> int String : : WriteOneByte ( Isolate * isolate , uint8_t * buffer , int start , <nl> int length , int options ) const { <nl> return WriteHelper ( reinterpret_cast < i : : Isolate * > ( isolate ) , this , buffer , <nl> - MaybeLocal < String > String : : NewFromTwoByte ( Isolate * isolate , <nl> + MaybeLocal < String > String : : NewFromTwoByte ( Isolate * isolate , <nl> return result ; <nl> } <nl> <nl> index 6a501f67ebf900ee30d55bd05ccc58845d71f418 . . 1b39655a1221b3df0012f5cc26697841 <nl> Local < String > v8 : : String : : Concat ( Isolate * v8_isolate , Local < String > left , <nl> Local < String > right ) { <nl> i : : Isolate * isolate = reinterpret_cast < i : : Isolate * > ( v8_isolate ) ; <nl> - bool v8 : : BooleanObject : : ValueOf ( ) const { <nl> - return jsvalue - > value ( ) . IsTrue ( isolate ) ; <nl> + bool v8 : : BooleanObject : : ValueOf ( ) const { <nl> + return js_primitive_wrapper - > value ( ) . IsTrue ( isolate ) ; <nl> } <nl> <nl> + Local < v8 : : Value > v8 : : StringObject : : New ( Local < String > value ) { <nl> index 6a501f67ebf900ee30d55bd05ccc58845d71f418 . . 1b39655a1221b3df0012f5cc26697841 <nl> Local < v8 : : Value > v8 : : StringObject : : New ( Isolate * v8_isolate , <nl> Local < String > value ) { <nl> i : : Handle < i : : String > string = Utils : : OpenHandle ( * value ) ; <nl> - bool MicrotasksScope : : IsRunningMicrotasks ( Isolate * v8_isolate ) { <nl> + bool MicrotasksScope : : IsRunningMicrotasks ( Isolate * v8_isolate ) { <nl> return microtask_queue - > IsRunningMicrotasks ( ) ; <nl> } <nl> <nl> index 6a501f67ebf900ee30d55bd05ccc58845d71f418 . . 1b39655a1221b3df0012f5cc26697841 <nl> String : : Utf8Value : : Utf8Value ( v8 : : Isolate * isolate , v8 : : Local < v8 : : Value > obj ) <nl> : str_ ( nullptr ) , length_ ( 0 ) { <nl> if ( obj . IsEmpty ( ) ) return ; <nl> - String : : Utf8Value : : Utf8Value ( v8 : : Isolate * isolate , v8 : : Local < v8 : : Value > obj ) <nl> + String : : Utf8Value : : Utf8Value ( v8 : : Isolate * isolate , v8 : : Local < v8 : : Value > obj ) <nl> <nl> String : : Utf8Value : : ~ Utf8Value ( ) { i : : DeleteArray ( str_ ) ; } <nl> <nl> mmm a / patches / v8 / do_not_export_private_v8_symbols_on_windows . patch <nl> ppp b / patches / v8 / do_not_export_private_v8_symbols_on_windows . patch <nl> This patch can be safely removed if , when it is removed , ` node . lib ` does not <nl> contain any standard C + + library exports ( e . g . ` std : : ostringstream ` ) . <nl> <nl> - + mmm a / BUILD . gn <nl> ppp b / BUILD . gn <nl> - config ( " internal_config " ) { <nl> + config ( " internal_config " ) { <nl> " : v8_header_features " , <nl> ] <nl> - <nl> + <nl> + if ( ! is_component_build & & is_electron_build ) { <nl> + defines + = [ " HIDE_PRIVATE_SYMBOLS " ] <nl> + } <nl> index ad70e9820ddb4a63639ca7738c1836cb87766db5 . . d40be9b57294583f74594d88d9b7d7b9 <nl> ppp b / src / base / macros . h <nl> bool is_inbounds ( float_t v ) { <nl> # ifdef V8_OS_WIN <nl> - <nl> + <nl> / / Setup for Windows shared library export . <nl> + # if defined ( HIDE_PRIVATE_SYMBOLS ) <nl> + # define V8_EXPORT_PRIVATE <nl> index ad70e9820ddb4a63639ca7738c1836cb87766db5 . . d40be9b57294583f74594d88d9b7d7b9 <nl> - # endif / / BUILDING_V8_SHARED <nl> + # endif <nl> + # endif <nl> - <nl> + <nl> # else / / V8_OS_WIN <nl> - <nl> + <nl> mmm a / patches / v8 / export_symbols_needed_for_windows_build . patch <nl> ppp b / patches / v8 / export_symbols_needed_for_windows_build . patch <nl> Subject : Export symbols needed for Windows build <nl> These symbols are required to build v8 with BUILD_V8_SHARED on Windows . <nl> <nl> - + mmm a / src / objects / objects . h <nl> ppp b / src / objects / objects . h <nl> - enum class KeyCollectionMode { <nl> + enum class KeyCollectionMode { <nl> / / Utility superclass for stack - allocated objects that must be updated <nl> / / on gc . It provides two ways for the gc to update instances , either <nl> / / iterating or updating after gc . <nl> mmm a / patches / v8 / expose_mksnapshot . patch <nl> ppp b / patches / v8 / expose_mksnapshot . patch <nl> Subject : expose_mksnapshot . patch <nl> Needed in order to target mksnapshot for mksnapshot zip . <nl> <nl> - + mmm a / BUILD . gn <nl> ppp b / BUILD . gn <nl> - if ( current_toolchain = = v8_generator_toolchain ) { <nl> + if ( current_toolchain = = v8_generator_toolchain ) { <nl> <nl> if ( v8_use_snapshot & & current_toolchain = = v8_snapshot_toolchain ) { <nl> v8_executable ( " mksnapshot " ) { <nl> - visibility = [ " : * " ] # Only targets in this file can depend on this . <nl> - - <nl> + <nl> sources = [ <nl> - " src / snapshot / embedded / embedded - file - writer . cc " , <nl> - " src / snapshot / embedded / embedded - file - writer . h " , <nl> + " src / diagnostics / crash - key - noop . cc " , <nl> mmm a / patches / v8 / workaround_an_undefined_symbol_error . patch <nl> ppp b / patches / v8 / workaround_an_undefined_symbol_error . patch <nl> By moving some functions out of the the arm64 - assembler header file , <nl> this error no longer seems to happen . <nl> <nl> - + mmm a / src / codegen / arm64 / assembler - arm64 . cc <nl> ppp b / src / codegen / arm64 / assembler - arm64 . cc <nl> - void Assembler : : MoveWide ( const Register & rd , uint64_t imm , int shift , <nl> + void Assembler : : MoveWide ( const Register & rd , uint64_t imm , int shift , <nl> ImmMoveWide ( static_cast < int > ( imm ) ) | ShiftMoveWide ( shift ) ) ; <nl> } <nl> <nl> index 1806f82b461a5f7368281bcd3741fd8195a20f11 . . 53da75760ba31bed3e3cf19397474b35 <nl> const Operand & operand , FlagsUpdate S , AddSubOp op ) { <nl> DCHECK_EQ ( rd . SizeInBits ( ) , rn . SizeInBits ( ) ) ; <nl> - + mmm a / src / codegen / arm64 / assembler - arm64 . h <nl> ppp b / src / codegen / arm64 / assembler - arm64 . h <nl> - class V8_EXPORT_PRIVATE Assembler : public AssemblerBase { <nl> + class V8_EXPORT_PRIVATE Assembler : public AssemblerBase { <nl> return rm . code ( ) < < Rm_offset ; <nl> } <nl> <nl> index 04cd4222417f5ac88f3c5f3278c45f1d128c7c8c . . fb5feb23074ac888e85a3676c1cbbb63 <nl> <nl> static Instr Ra ( CPURegister ra ) { <nl> DCHECK_NE ( ra . code ( ) , kSPRegInternalCode ) ; <nl> - class V8_EXPORT_PRIVATE Assembler : public AssemblerBase { <nl> + class V8_EXPORT_PRIVATE Assembler : public AssemblerBase { <nl> <nl> / / These encoding functions allow the stack pointer to be encoded , and <nl> / / disallow the zero register . <nl> mmm a / script / zip_manifests / dist_zip . linux . arm . manifest <nl> ppp b / script / zip_manifests / dist_zip . linux . arm . manifest <nl> natives_blob . bin <nl> resources . pak <nl> resources / default_app . asar <nl> snapshot_blob . bin <nl> + swiftshader / libEGL . so <nl> + swiftshader / libGLESv2 . so <nl> + swiftshader / libvulkan . so <nl> v8_context_snapshot . bin <nl> version <nl> mmm a / script / zip_manifests / dist_zip . linux . arm64 . manifest <nl> ppp b / script / zip_manifests / dist_zip . linux . arm64 . manifest <nl> resources / default_app . asar <nl> snapshot_blob . bin <nl> swiftshader / libEGL . so <nl> swiftshader / libGLESv2 . so <nl> + swiftshader / libvulkan . so <nl> v8_context_snapshot . bin <nl> version <nl> mmm a / script / zip_manifests / dist_zip . linux . x64 . manifest <nl> ppp b / script / zip_manifests / dist_zip . linux . x64 . manifest <nl> resources / default_app . asar <nl> snapshot_blob . bin <nl> swiftshader / libEGL . so <nl> swiftshader / libGLESv2 . so <nl> + swiftshader / libvulkan . so <nl> v8_context_snapshot . bin <nl> version <nl> mmm a / script / zip_manifests / dist_zip . linux . x86 . manifest <nl> ppp b / script / zip_manifests / dist_zip . linux . x86 . manifest <nl> resources / default_app . asar <nl> snapshot_blob . bin <nl> swiftshader / libEGL . so <nl> swiftshader / libGLESv2 . so <nl> + swiftshader / libvulkan . so <nl> v8_context_snapshot . bin <nl> version <nl> mmm a / script / zip_manifests / dist_zip . mac . x64 . manifest <nl> ppp b / script / zip_manifests / dist_zip . mac . x64 . manifest <nl> Electron . app / Contents / Frameworks / Electron Helper . app / Contents / Info . plist <nl> Electron . app / Contents / Frameworks / Electron Helper . app / Contents / MacOS / <nl> Electron . app / Contents / Frameworks / Electron Helper . app / Contents / MacOS / Electron Helper <nl> Electron . app / Contents / Frameworks / Electron Helper . app / Contents / PkgInfo <nl> + Electron . app / Contents / Frameworks / Electron Helper ( Plugin ) . app / <nl> + Electron . app / Contents / Frameworks / Electron Helper ( Plugin ) . app / Contents / <nl> + Electron . app / Contents / Frameworks / Electron Helper ( Plugin ) . app / Contents / Info . plist <nl> + Electron . app / Contents / Frameworks / Electron Helper ( Plugin ) . app / Contents / MacOS / <nl> + Electron . app / Contents / Frameworks / Electron Helper ( Plugin ) . app / Contents / MacOS / Electron Helper ( Plugin ) <nl> + Electron . app / Contents / Frameworks / Electron Helper ( Plugin ) . app / Contents / PkgInfo <nl> + Electron . app / Contents / Frameworks / Electron Helper ( Renderer ) . app / <nl> + Electron . app / Contents / Frameworks / Electron Helper ( Renderer ) . app / Contents / <nl> + Electron . app / Contents / Frameworks / Electron Helper ( Renderer ) . app / Contents / Info . plist <nl> + Electron . app / Contents / Frameworks / Electron Helper ( Renderer ) . app / Contents / MacOS / <nl> + Electron . app / Contents / Frameworks / Electron Helper ( Renderer ) . app / Contents / MacOS / Electron Helper ( Renderer ) <nl> + Electron . app / Contents / Frameworks / Electron Helper ( Renderer ) . app / Contents / PkgInfo <nl> Electron . app / Contents / Frameworks / Mantle . framework / <nl> Electron . app / Contents / Frameworks / Mantle . framework / Headers <nl> Electron . app / Contents / Frameworks / Mantle . framework / Mantle <nl> mmm a / script / zip_manifests / dist_zip . mac_mas . x64 . manifest <nl> ppp b / script / zip_manifests / dist_zip . mac_mas . x64 . manifest <nl> Electron . app / Contents / Frameworks / Electron Helper . app / Contents / Info . plist <nl> Electron . app / Contents / Frameworks / Electron Helper . app / Contents / MacOS / <nl> Electron . app / Contents / Frameworks / Electron Helper . app / Contents / MacOS / Electron Helper <nl> Electron . app / Contents / Frameworks / Electron Helper . app / Contents / PkgInfo <nl> + Electron . app / Contents / Frameworks / Electron Helper ( Plugin ) . app / <nl> + Electron . app / Contents / Frameworks / Electron Helper ( Plugin ) . app / Contents / <nl> + Electron . app / Contents / Frameworks / Electron Helper ( Plugin ) . app / Contents / Info . plist <nl> + Electron . app / Contents / Frameworks / Electron Helper ( Plugin ) . app / Contents / MacOS / <nl> + Electron . app / Contents / Frameworks / Electron Helper ( Plugin ) . app / Contents / MacOS / Electron Helper ( Plugin ) <nl> + Electron . app / Contents / Frameworks / Electron Helper ( Plugin ) . app / Contents / PkgInfo <nl> + Electron . app / Contents / Frameworks / Electron Helper ( Renderer ) . app / <nl> + Electron . app / Contents / Frameworks / Electron Helper ( Renderer ) . app / Contents / <nl> + Electron . app / Contents / Frameworks / Electron Helper ( Renderer ) . app / Contents / Info . plist <nl> + Electron . app / Contents / Frameworks / Electron Helper ( Renderer ) . app / Contents / MacOS / <nl> + Electron . app / Contents / Frameworks / Electron Helper ( Renderer ) . app / Contents / MacOS / Electron Helper ( Renderer ) <nl> + Electron . app / Contents / Frameworks / Electron Helper ( Renderer ) . app / Contents / PkgInfo <nl> Electron . app / Contents / Info . plist <nl> Electron . app / Contents / Library / <nl> Electron . app / Contents / Library / LoginItems / <nl> mmm a / shell / app / atom_content_client . cc <nl> ppp b / shell / app / atom_content_client . cc <nl> AtomContentClient : : AtomContentClient ( ) { } <nl> <nl> AtomContentClient : : ~ AtomContentClient ( ) { } <nl> <nl> - base : : string16 AtomContentClient : : GetLocalizedString ( int message_id ) const { <nl> + base : : string16 AtomContentClient : : GetLocalizedString ( int message_id ) { <nl> return l10n_util : : GetStringUTF16 ( message_id ) ; <nl> } <nl> <nl> base : : StringPiece AtomContentClient : : GetDataResource ( <nl> int resource_id , <nl> - ui : : ScaleFactor scale_factor ) const { <nl> + ui : : ScaleFactor scale_factor ) { <nl> return ui : : ResourceBundle : : GetSharedInstance ( ) . GetRawDataResourceForScale ( <nl> resource_id , scale_factor ) ; <nl> } <nl> <nl> - gfx : : Image & AtomContentClient : : GetNativeImageNamed ( int resource_id ) const { <nl> + gfx : : Image & AtomContentClient : : GetNativeImageNamed ( int resource_id ) { <nl> return ui : : ResourceBundle : : GetSharedInstance ( ) . GetNativeImageNamed ( <nl> resource_id ) ; <nl> } <nl> <nl> base : : RefCountedMemory * AtomContentClient : : GetDataResourceBytes ( <nl> - int resource_id ) const { <nl> + int resource_id ) { <nl> return ui : : ResourceBundle : : GetSharedInstance ( ) . LoadDataResourceBytes ( <nl> resource_id ) ; <nl> } <nl> void AtomContentClient : : AddContentDecryptionModules ( <nl> } <nl> } <nl> <nl> - bool AtomContentClient : : IsDataResourceGzipped ( int resource_id ) const { <nl> + bool AtomContentClient : : IsDataResourceGzipped ( int resource_id ) { <nl> return ui : : ResourceBundle : : GetSharedInstance ( ) . IsGzipped ( resource_id ) ; <nl> } <nl> <nl> mmm a / shell / app / atom_content_client . h <nl> ppp b / shell / app / atom_content_client . h <nl> class AtomContentClient : public content : : ContentClient { <nl> <nl> protected : <nl> / / content : : ContentClient : <nl> - base : : string16 GetLocalizedString ( int message_id ) const override ; <nl> - base : : StringPiece GetDataResource ( int resource_id , <nl> - ui : : ScaleFactor ) const override ; <nl> - gfx : : Image & GetNativeImageNamed ( int resource_id ) const override ; <nl> - base : : RefCountedMemory * GetDataResourceBytes ( int resource_id ) const override ; <nl> + base : : string16 GetLocalizedString ( int message_id ) override ; <nl> + base : : StringPiece GetDataResource ( int resource_id , ui : : ScaleFactor ) override ; <nl> + gfx : : Image & GetNativeImageNamed ( int resource_id ) override ; <nl> + base : : RefCountedMemory * GetDataResourceBytes ( int resource_id ) override ; <nl> void AddAdditionalSchemes ( Schemes * schemes ) override ; <nl> void AddPepperPlugins ( <nl> std : : vector < content : : PepperPluginInfo > * plugins ) override ; <nl> void AddContentDecryptionModules ( <nl> std : : vector < content : : CdmInfo > * cdms , <nl> std : : vector < media : : CdmHostFilePath > * cdm_host_file_paths ) override ; <nl> - bool IsDataResourceGzipped ( int resource_id ) const override ; <nl> + bool IsDataResourceGzipped ( int resource_id ) override ; <nl> <nl> private : <nl> DISALLOW_COPY_AND_ASSIGN ( AtomContentClient ) ; <nl> mmm a / shell / app / atom_main_delegate_mac . mm <nl> ppp b / shell / app / atom_main_delegate_mac . mm <nl> <nl> # include " base / mac / scoped_nsautorelease_pool . h " <nl> # include " base / path_service . h " <nl> # include " base / strings / sys_string_conversions . h " <nl> + # include " content / common / mac_helpers . h " <nl> # include " content / public / common / content_paths . h " <nl> # include " shell / browser / mac / atom_application . h " <nl> # include " shell / common / application_info . h " <nl> <nl> <nl> base : : FilePath GetHelperAppPath ( const base : : FilePath & frameworks_path , <nl> const std : : string & name ) { <nl> - return frameworks_path . Append ( name + " Helper . app " ) <nl> + / / Figure out what helper we are running <nl> + base : : FilePath path ; <nl> + base : : PathService : : Get ( base : : FILE_EXE , & path ) ; <nl> + <nl> + std : : string helper_name = " Helper " ; <nl> + if ( base : : EndsWith ( path . value ( ) , content : : kMacHelperSuffix_renderer , <nl> + base : : CompareCase : : SENSITIVE ) ) { <nl> + helper_name + = content : : kMacHelperSuffix_renderer ; <nl> + } else if ( base : : EndsWith ( path . value ( ) , content : : kMacHelperSuffix_plugin , <nl> + base : : CompareCase : : SENSITIVE ) ) { <nl> + helper_name + = content : : kMacHelperSuffix_plugin ; <nl> + } <nl> + <nl> + return frameworks_path . Append ( name + " " + helper_name + " . app " ) <nl> . Append ( " Contents " ) <nl> . Append ( " MacOS " ) <nl> - . Append ( name + " Helper " ) ; <nl> + . Append ( name + " " + helper_name ) ; <nl> } <nl> <nl> } / / namespace <nl> mmm a / shell / app / uv_task_runner . cc <nl> ppp b / shell / app / uv_task_runner . cc <nl> bool UvTaskRunner : : PostNonNestableDelayedTask ( const base : : Location & from_here , <nl> / / static <nl> void UvTaskRunner : : OnTimeout ( uv_timer_t * timer ) { <nl> UvTaskRunner * self = static_cast < UvTaskRunner * > ( timer - > data ) ; <nl> - if ( ! ContainsKey ( self - > tasks_ , timer ) ) <nl> + if ( ! base : : Contains ( self - > tasks_ , timer ) ) <nl> return ; <nl> <nl> std : : move ( self - > tasks_ [ timer ] ) . Run ( ) ; <nl> mmm a / shell / browser / api / atom_api_app . cc <nl> ppp b / shell / browser / api / atom_api_app . cc <nl> void App : : AllowCertificateError ( <nl> callback . Run ( content : : CERTIFICATE_REQUEST_RESULT_TYPE_DENY ) ; <nl> } <nl> <nl> - void App : : SelectClientCertificate ( <nl> + base : : OnceClosure App : : SelectClientCertificate ( <nl> content : : WebContents * web_contents , <nl> net : : SSLCertRequestInfo * cert_request_info , <nl> net : : ClientCertIdentityList identities , <nl> void App : : SelectClientCertificate ( <nl> std : : move ( ( * shared_identities ) [ 0 ] ) , <nl> base : : BindRepeating ( & GotPrivateKey , shared_delegate , std : : move ( cert ) ) ) ; <nl> } <nl> + return base : : OnceClosure ( ) ; <nl> } <nl> <nl> void App : : OnGpuInfoUpdate ( ) { <nl> mmm a / shell / browser / api / atom_api_app . h <nl> ppp b / shell / browser / api / atom_api_app . h <nl> class App : public AtomBrowserClient : : Delegate , <nl> bool expired_previous_decision , <nl> const base : : RepeatingCallback < <nl> void ( content : : CertificateRequestResultType ) > & callback ) override ; <nl> - void SelectClientCertificate ( <nl> + base : : OnceClosure SelectClientCertificate ( <nl> content : : WebContents * web_contents , <nl> net : : SSLCertRequestInfo * cert_request_info , <nl> net : : ClientCertIdentityList client_certs , <nl> mmm a / shell / browser / api / atom_api_global_shortcut . cc <nl> ppp b / shell / browser / api / atom_api_global_shortcut . cc <nl> bool GlobalShortcut : : Register ( const ui : : Accelerator & accelerator , <nl> } <nl> <nl> void GlobalShortcut : : Unregister ( const ui : : Accelerator & accelerator ) { <nl> - if ( ! ContainsKey ( accelerator_callback_map_ , accelerator ) ) <nl> + if ( ! base : : Contains ( accelerator_callback_map_ , accelerator ) ) <nl> return ; <nl> <nl> accelerator_callback_map_ . erase ( accelerator ) ; <nl> void GlobalShortcut : : UnregisterSome ( <nl> } <nl> <nl> bool GlobalShortcut : : IsRegistered ( const ui : : Accelerator & accelerator ) { <nl> - return ContainsKey ( accelerator_callback_map_ , accelerator ) ; <nl> + return base : : Contains ( accelerator_callback_map_ , accelerator ) ; <nl> } <nl> <nl> void GlobalShortcut : : UnregisterAll ( ) { <nl> mmm a / shell / browser / api / atom_api_net_log . cc <nl> ppp b / shell / browser / api / atom_api_net_log . cc <nl> v8 : : Local < v8 : : Promise > NetLog : : StartLogging ( mate : : Arguments * args ) { <nl> auto command_line_string = <nl> base : : CommandLine : : ForCurrentProcess ( ) - > GetCommandLineString ( ) ; <nl> auto channel_string = std : : string ( " Electron " ELECTRON_VERSION ) ; <nl> - base : : Value custom_constants = base : : Value : : FromUniquePtrValue ( <nl> - net_log : : ChromeNetLog : : GetPlatformConstants ( command_line_string , <nl> - channel_string ) ) ; <nl> + base : : Value custom_constants = <nl> + base : : Value : : FromUniquePtrValue ( net_log : : GetPlatformConstantsForNetLog ( <nl> + command_line_string , channel_string ) ) ; <nl> <nl> auto * network_context = <nl> content : : BrowserContext : : GetDefaultStoragePartition ( browser_context_ ) <nl> mmm a / shell / browser / api / atom_api_power_monitor . cc <nl> ppp b / shell / browser / api / atom_api_power_monitor . cc <nl> PowerMonitor : : PowerMonitor ( v8 : : Isolate * isolate ) { <nl> Browser : : Get ( ) - > SetShutdownHandler ( base : : BindRepeating ( <nl> & PowerMonitor : : ShouldShutdown , base : : Unretained ( this ) ) ) ; <nl> # endif <nl> - base : : PowerMonitor : : Get ( ) - > AddObserver ( this ) ; <nl> + base : : PowerMonitor : : AddObserver ( this ) ; <nl> Init ( isolate ) ; <nl> # if defined ( OS_MACOSX ) | | defined ( OS_WIN ) <nl> InitPlatformSpecificMonitors ( ) ; <nl> PowerMonitor : : PowerMonitor ( v8 : : Isolate * isolate ) { <nl> } <nl> <nl> PowerMonitor : : ~ PowerMonitor ( ) { <nl> - base : : PowerMonitor : : Get ( ) - > RemoveObserver ( this ) ; <nl> + base : : PowerMonitor : : RemoveObserver ( this ) ; <nl> } <nl> <nl> bool PowerMonitor : : ShouldShutdown ( ) { <nl> mmm a / shell / browser / api / atom_api_protocol_ns . cc <nl> ppp b / shell / browser / api / atom_api_protocol_ns . cc <nl> ProtocolError ProtocolNS : : RegisterProtocol ( ProtocolType type , <nl> const std : : string & scheme , <nl> const ProtocolHandler & handler ) { <nl> ProtocolError error = ProtocolError : : OK ; <nl> - if ( ! base : : ContainsKey ( handlers_ , scheme ) ) <nl> + if ( ! base : : Contains ( handlers_ , scheme ) ) <nl> handlers_ [ scheme ] = std : : make_pair ( type , handler ) ; <nl> else <nl> error = ProtocolError : : REGISTERED ; <nl> ProtocolError ProtocolNS : : RegisterProtocol ( ProtocolType type , <nl> void ProtocolNS : : UnregisterProtocol ( const std : : string & scheme , <nl> mate : : Arguments * args ) { <nl> ProtocolError error = ProtocolError : : OK ; <nl> - if ( base : : ContainsKey ( handlers_ , scheme ) ) <nl> + if ( base : : Contains ( handlers_ , scheme ) ) <nl> handlers_ . erase ( scheme ) ; <nl> else <nl> error = ProtocolError : : NOT_REGISTERED ; <nl> void ProtocolNS : : UnregisterProtocol ( const std : : string & scheme , <nl> } <nl> <nl> bool ProtocolNS : : IsProtocolRegistered ( const std : : string & scheme ) { <nl> - return base : : ContainsKey ( handlers_ , scheme ) ; <nl> + return base : : Contains ( handlers_ , scheme ) ; <nl> } <nl> <nl> ProtocolError ProtocolNS : : InterceptProtocol ( ProtocolType type , <nl> const std : : string & scheme , <nl> const ProtocolHandler & handler ) { <nl> ProtocolError error = ProtocolError : : OK ; <nl> - if ( ! base : : ContainsKey ( intercept_handlers_ , scheme ) ) <nl> + if ( ! base : : Contains ( intercept_handlers_ , scheme ) ) <nl> intercept_handlers_ [ scheme ] = std : : make_pair ( type , handler ) ; <nl> else <nl> error = ProtocolError : : INTERCEPTED ; <nl> ProtocolError ProtocolNS : : InterceptProtocol ( ProtocolType type , <nl> void ProtocolNS : : UninterceptProtocol ( const std : : string & scheme , <nl> mate : : Arguments * args ) { <nl> ProtocolError error = ProtocolError : : OK ; <nl> - if ( base : : ContainsKey ( intercept_handlers_ , scheme ) ) <nl> + if ( base : : Contains ( intercept_handlers_ , scheme ) ) <nl> intercept_handlers_ . erase ( scheme ) ; <nl> else <nl> error = ProtocolError : : NOT_INTERCEPTED ; <nl> void ProtocolNS : : UninterceptProtocol ( const std : : string & scheme , <nl> } <nl> <nl> bool ProtocolNS : : IsProtocolIntercepted ( const std : : string & scheme ) { <nl> - return base : : ContainsKey ( intercept_handlers_ , scheme ) ; <nl> + return base : : Contains ( intercept_handlers_ , scheme ) ; <nl> } <nl> <nl> v8 : : Local < v8 : : Promise > ProtocolNS : : IsProtocolHandled ( const std : : string & scheme , <nl> v8 : : Local < v8 : : Promise > ProtocolNS : : IsProtocolHandled ( const std : : string & scheme , <nl> / / So we have to test against a hard - coded builtin schemes <nl> / / list make it work with old code . We should deprecate this <nl> / / API with the new | isProtocolRegistered | API . <nl> - base : : ContainsValue ( kBuiltinSchemes , scheme ) ) ; <nl> + base : : Contains ( kBuiltinSchemes , scheme ) ) ; <nl> return promise . GetHandle ( ) ; <nl> } <nl> <nl> mmm a / shell / browser / api / atom_api_top_level_window . cc <nl> ppp b / shell / browser / api / atom_api_top_level_window . cc <nl> bool TopLevelWindow : : HookWindowMessage ( UINT message , <nl> } <nl> <nl> void TopLevelWindow : : UnhookWindowMessage ( UINT message ) { <nl> - if ( ! ContainsKey ( messages_callback_map_ , message ) ) <nl> + if ( ! base : : Contains ( messages_callback_map_ , message ) ) <nl> return ; <nl> <nl> messages_callback_map_ . erase ( message ) ; <nl> } <nl> <nl> bool TopLevelWindow : : IsWindowMessageHooked ( UINT message ) { <nl> - return ContainsKey ( messages_callback_map_ , message ) ; <nl> + return base : : Contains ( messages_callback_map_ , message ) ; <nl> } <nl> <nl> void TopLevelWindow : : UnhookAllWindowMessages ( ) { <nl> mmm a / shell / browser / api / atom_api_web_contents . cc <nl> ppp b / shell / browser / api / atom_api_web_contents . cc <nl> void WebContents : : FindReply ( content : : WebContents * web_contents , <nl> bool WebContents : : CheckMediaAccessPermission ( <nl> content : : RenderFrameHost * render_frame_host , <nl> const GURL & security_origin , <nl> - blink : : MediaStreamType type ) { <nl> + blink : : mojom : : MediaStreamType type ) { <nl> auto * web_contents = <nl> content : : WebContents : : FromRenderFrameHost ( render_frame_host ) ; <nl> auto * permission_helper = <nl> v8 : : Local < v8 : : Promise > WebContents : : CapturePage ( mate : : Arguments * args ) { <nl> void WebContents : : OnCursorChange ( const content : : WebCursor & cursor ) { <nl> const content : : CursorInfo & info = cursor . info ( ) ; <nl> <nl> - if ( info . type = = blink : : WebCursorInfo : : kTypeCustom ) { <nl> + if ( info . type = = ui : : CursorType : : kCustom ) { <nl> Emit ( " cursor - changed " , CursorTypeToString ( info ) , <nl> gfx : : Image : : CreateFrom1xBitmap ( info . custom_image ) , <nl> info . image_scale_factor , <nl> void WebContents : : Invalidate ( ) { <nl> } <nl> } <nl> <nl> - gfx : : Size WebContents : : GetSizeForNewRenderView ( content : : WebContents * wc ) const { <nl> + gfx : : Size WebContents : : GetSizeForNewRenderView ( content : : WebContents * wc ) { <nl> if ( IsOffScreen ( ) & & wc = = web_contents ( ) ) { <nl> auto * relay = NativeWindowRelay : : FromWebContents ( web_contents ( ) ) ; <nl> if ( relay ) { <nl> mmm a / shell / browser / api / atom_api_web_contents . h <nl> ppp b / shell / browser / api / atom_api_web_contents . h <nl> class WebContents : public mate : : TrackableObject < WebContents > , <nl> int GetFrameRate ( ) const ; <nl> # endif <nl> void Invalidate ( ) ; <nl> - gfx : : Size GetSizeForNewRenderView ( content : : WebContents * ) const override ; <nl> + gfx : : Size GetSizeForNewRenderView ( content : : WebContents * ) override ; <nl> <nl> / / Methods for zoom handling . <nl> void SetZoomLevel ( double level ) ; <nl> class WebContents : public mate : : TrackableObject < WebContents > , <nl> bool final_update ) override ; <nl> bool CheckMediaAccessPermission ( content : : RenderFrameHost * render_frame_host , <nl> const GURL & security_origin , <nl> - blink : : MediaStreamType type ) override ; <nl> + blink : : mojom : : MediaStreamType type ) override ; <nl> void RequestMediaAccessPermission ( <nl> content : : WebContents * web_contents , <nl> const content : : MediaStreamRequest & request , <nl> mmm a / shell / browser / api / views / atom_api_box_layout . cc <nl> ppp b / shell / browser / api / views / atom_api_box_layout . cc <nl> struct Converter < views : : BoxLayout : : Orientation > { <nl> if ( ! ConvertFromV8 ( isolate , val , & orientation ) ) <nl> return false ; <nl> if ( orientation = = " horizontal " ) <nl> - * out = views : : BoxLayout : : kHorizontal ; <nl> + * out = views : : BoxLayout : : Orientation : : kHorizontal ; <nl> else if ( orientation = = " vertical " ) <nl> - * out = views : : BoxLayout : : kVertical ; <nl> + * out = views : : BoxLayout : : Orientation : : kVertical ; <nl> else <nl> return false ; <nl> return true ; <nl> mmm a / shell / browser / atom_browser_client . cc <nl> ppp b / shell / browser / atom_browser_client . cc <nl> <nl> # include " chrome / browser / printing / printing_message_filter . h " <nl> # endif / / BUILDFLAG ( ENABLE_PRINTING ) <nl> <nl> + # if defined ( OS_MACOSX ) <nl> + # include " content / common / mac_helpers . h " <nl> + # include " content / public / common / child_process_host . h " <nl> + # endif <nl> + <nl> using content : : BrowserThread ; <nl> <nl> namespace electron { <nl> content : : WebContents * AtomBrowserClient : : GetWebContentsFromProcessID ( <nl> int process_id ) { <nl> / / If the process is a pending process , we should use the web contents <nl> / / for the frame host passed into RegisterPendingProcess . <nl> - if ( base : : ContainsKey ( pending_processes_ , process_id ) ) <nl> + if ( base : : Contains ( pending_processes_ , process_id ) ) <nl> return pending_processes_ [ process_id ] ; <nl> <nl> / / Certain render process will be created with no associated render view , <nl> void AtomBrowserClient : : ConsiderSiteInstanceForAffinity ( <nl> } <nl> <nl> bool AtomBrowserClient : : IsRendererSubFrame ( int process_id ) const { <nl> - return base : : ContainsKey ( renderer_is_subframe_ , process_id ) ; <nl> + return base : : Contains ( renderer_is_subframe_ , process_id ) ; <nl> } <nl> <nl> void AtomBrowserClient : : RenderProcessWillLaunch ( <nl> void AtomBrowserClient : : AppendExtraCommandLineSwitches ( <nl> / / Make sure we ' re about to launch a known executable <nl> { <nl> base : : FilePath child_path ; <nl> + # if defined ( OS_MACOSX ) <nl> + int flags = content : : ChildProcessHost : : CHILD_NORMAL ; <nl> + if ( base : : EndsWith ( command_line - > GetProgram ( ) . value ( ) , <nl> + content : : kMacHelperSuffix_renderer , <nl> + base : : CompareCase : : SENSITIVE ) ) { <nl> + flags = content : : ChildProcessHost : : CHILD_RENDERER ; <nl> + } <nl> + child_path = content : : ChildProcessHost : : GetChildPath ( flags ) ; <nl> + # else <nl> base : : PathService : : Get ( content : : CHILD_PROCESS_EXE , & child_path ) ; <nl> + # endif <nl> <nl> base : : ThreadRestrictions : : ScopedAllowIO allow_io ; <nl> CHECK ( base : : MakeAbsoluteFilePath ( command_line - > GetProgram ( ) ) = = child_path ) ; <nl> void AtomBrowserClient : : AllowCertificateError ( <nl> } <nl> } <nl> <nl> - void AtomBrowserClient : : SelectClientCertificate ( <nl> + base : : OnceClosure AtomBrowserClient : : SelectClientCertificate ( <nl> content : : WebContents * web_contents , <nl> net : : SSLCertRequestInfo * cert_request_info , <nl> net : : ClientCertIdentityList client_certs , <nl> void AtomBrowserClient : : SelectClientCertificate ( <nl> std : : move ( client_certs ) , <nl> std : : move ( delegate ) ) ; <nl> } <nl> + return base : : OnceClosure ( ) ; <nl> } <nl> <nl> bool AtomBrowserClient : : CanCreateWindow ( <nl> AtomBrowserClient : : GetExtraServiceManifests ( ) { <nl> return GetElectronBuiltinServiceManifests ( ) ; <nl> } <nl> <nl> - net : : NetLog * AtomBrowserClient : : GetNetLog ( ) { <nl> - return g_browser_process - > net_log ( ) ; <nl> - } <nl> - <nl> std : : unique_ptr < content : : BrowserMainParts > <nl> AtomBrowserClient : : CreateBrowserMainParts ( <nl> const content : : MainFunctionParams & params ) { <nl> bool AtomBrowserClient : : ShouldBypassCORB ( int render_process_id ) const { <nl> return it ! = process_preferences_ . end ( ) & & ! it - > second . web_security ; <nl> } <nl> <nl> - std : : string AtomBrowserClient : : GetProduct ( ) const { <nl> + std : : string AtomBrowserClient : : GetProduct ( ) { <nl> return " Chrome / " CHROME_VERSION_STRING ; <nl> } <nl> <nl> - std : : string AtomBrowserClient : : GetUserAgent ( ) const { <nl> + std : : string AtomBrowserClient : : GetUserAgent ( ) { <nl> if ( user_agent_override_ . empty ( ) ) <nl> return GetApplicationUserAgent ( ) ; <nl> return user_agent_override_ ; <nl> mmm a / shell / browser / atom_browser_client . h <nl> ppp b / shell / browser / atom_browser_client . h <nl> class AtomBrowserClient : public content : : ContentBrowserClient , <nl> / / content : : ContentBrowserClient : <nl> bool ShouldEnableStrictSiteIsolation ( ) override ; <nl> <nl> - std : : string GetUserAgent ( ) const override ; <nl> + std : : string GetUserAgent ( ) override ; <nl> void SetUserAgent ( const std : : string & user_agent ) ; <nl> <nl> void SetCanUseCustomSiteInstance ( bool should_disable ) ; <nl> class AtomBrowserClient : public content : : ContentBrowserClient , <nl> bool expired_previous_decision , <nl> const base : : Callback < void ( content : : CertificateRequestResultType ) > & <nl> callback ) override ; <nl> - void SelectClientCertificate ( <nl> + base : : OnceClosure SelectClientCertificate ( <nl> content : : WebContents * web_contents , <nl> net : : SSLCertRequestInfo * cert_request_info , <nl> net : : ClientCertIdentityList client_certs , <nl> class AtomBrowserClient : public content : : ContentBrowserClient , <nl> base : : Optional < service_manager : : Manifest > GetServiceManifestOverlay ( <nl> base : : StringPiece name ) override ; <nl> std : : vector < service_manager : : Manifest > GetExtraServiceManifests ( ) override ; <nl> - net : : NetLog * GetNetLog ( ) override ; <nl> content : : MediaObserver * GetMediaObserver ( ) override ; <nl> content : : DevToolsManagerDelegate * GetDevToolsManagerDelegate ( ) override ; <nl> content : : PlatformNotificationService * GetPlatformNotificationService ( <nl> class AtomBrowserClient : public content : : ContentBrowserClient , <nl> network : : mojom : : NetworkService * network_service ) override ; <nl> std : : vector < base : : FilePath > GetNetworkContextsParentDirectory ( ) override ; <nl> bool ShouldBypassCORB ( int render_process_id ) const override ; <nl> - std : : string GetProduct ( ) const override ; <nl> + std : : string GetProduct ( ) override ; <nl> void RegisterNonNetworkNavigationURLLoaderFactories ( <nl> int frame_tree_node_id , <nl> NonNetworkURLLoaderFactoryMap * factories ) override ; <nl> mmm a / shell / browser / atom_browser_context . cc <nl> ppp b / shell / browser / atom_browser_context . cc <nl> network : : mojom : : NetworkContextPtr AtomBrowserContext : : GetNetworkContext ( ) { <nl> } <nl> } <nl> <nl> - base : : FilePath AtomBrowserContext : : GetPath ( ) const { <nl> + base : : FilePath AtomBrowserContext : : GetPath ( ) { <nl> return path_ ; <nl> } <nl> <nl> - bool AtomBrowserContext : : IsOffTheRecord ( ) const { <nl> + bool AtomBrowserContext : : IsOffTheRecord ( ) { <nl> return in_memory_ ; <nl> } <nl> <nl> AtomBrowserContext : : GetClientHintsControllerDelegate ( ) { <nl> return nullptr ; <nl> } <nl> <nl> - net : : URLRequestContextGetter * <nl> - AtomBrowserContext : : CreateRequestContextForStoragePartition ( <nl> - const base : : FilePath & partition_path , <nl> - bool in_memory , <nl> - content : : ProtocolHandlerMap * protocol_handlers , <nl> - content : : URLRequestInterceptorScopedVector request_interceptors ) { <nl> - NOTREACHED ( ) ; <nl> - return nullptr ; <nl> - } <nl> - <nl> - net : : URLRequestContextGetter * <nl> - AtomBrowserContext : : CreateMediaRequestContextForStoragePartition ( <nl> - const base : : FilePath & partition_path , <nl> - bool in_memory ) { <nl> - NOTREACHED ( ) ; <nl> - return nullptr ; <nl> - } <nl> - <nl> ResolveProxyHelper * AtomBrowserContext : : GetResolveProxyHelper ( ) { <nl> if ( ! resolve_proxy_helper_ ) { <nl> resolve_proxy_helper_ = base : : MakeRefCounted < ResolveProxyHelper > ( this ) ; <nl> mmm a / shell / browser / atom_browser_context . h <nl> ppp b / shell / browser / atom_browser_context . h <nl> class AtomBrowserContext <nl> ResolveProxyHelper * GetResolveProxyHelper ( ) ; <nl> <nl> / / content : : BrowserContext : <nl> - base : : FilePath GetPath ( ) const override ; <nl> - bool IsOffTheRecord ( ) const override ; <nl> + base : : FilePath GetPath ( ) override ; <nl> + bool IsOffTheRecord ( ) override ; <nl> content : : ResourceContext * GetResourceContext ( ) override ; <nl> std : : unique_ptr < content : : ZoomLevelDelegate > CreateZoomLevelDelegate ( <nl> const base : : FilePath & partition_path ) override ; <nl> class AtomBrowserContext <nl> content : : BackgroundSyncController * GetBackgroundSyncController ( ) override ; <nl> content : : BrowsingDataRemoverDelegate * GetBrowsingDataRemoverDelegate ( ) <nl> override ; <nl> - net : : URLRequestContextGetter * CreateRequestContextForStoragePartition ( <nl> - const base : : FilePath & partition_path , <nl> - bool in_memory , <nl> - content : : ProtocolHandlerMap * protocol_handlers , <nl> - content : : URLRequestInterceptorScopedVector request_interceptors ) override ; <nl> - net : : URLRequestContextGetter * CreateMediaRequestContextForStoragePartition ( <nl> - const base : : FilePath & partition_path , <nl> - bool in_memory ) override ; <nl> std : : string GetMediaDeviceIDSalt ( ) override ; <nl> content : : DownloadManagerDelegate * GetDownloadManagerDelegate ( ) override ; <nl> content : : BrowserPluginGuestManager * GetGuestManager ( ) override ; <nl> mmm a / shell / browser / atom_browser_main_parts . cc <nl> ppp b / shell / browser / atom_browser_main_parts . cc <nl> AtomBrowserMainParts : : AtomBrowserMainParts ( <nl> browser_ ( new Browser ) , <nl> node_bindings_ ( <nl> NodeBindings : : Create ( NodeBindings : : BrowserEnvironment : : BROWSER ) ) , <nl> - electron_bindings_ ( new ElectronBindings ( uv_default_loop ( ) ) ) , <nl> - main_function_params_ ( params ) { <nl> + electron_bindings_ ( new ElectronBindings ( uv_default_loop ( ) ) ) { <nl> DCHECK ( ! self_ ) < < " Cannot have two AtomBrowserMainParts " ; <nl> self_ = this ; <nl> / / Register extension scheme as web safe scheme . <nl> int AtomBrowserMainParts : : PreCreateThreads ( ) { <nl> ui : : InitIdleMonitor ( ) ; <nl> # endif <nl> <nl> - fake_browser_process_ - > PreCreateThreads ( main_function_params_ . command_line ) ; <nl> + fake_browser_process_ - > PreCreateThreads ( ) ; <nl> <nl> return 0 ; <nl> } <nl> mmm a / shell / browser / atom_browser_main_parts . h <nl> ppp b / shell / browser / atom_browser_main_parts . h <nl> class AtomBrowserMainParts : public content : : BrowserMainParts { <nl> IconManager * GetIconManager ( ) ; <nl> <nl> Browser * browser ( ) { return browser_ . get ( ) ; } <nl> + BrowserProcessImpl * browser_process ( ) { return fake_browser_process_ . get ( ) ; } <nl> <nl> protected : <nl> / / content : : BrowserMainParts : <nl> class AtomBrowserMainParts : public content : : BrowserMainParts { <nl> <nl> device : : mojom : : GeolocationControlPtr geolocation_control_ ; <nl> <nl> - const content : : MainFunctionParams main_function_params_ ; <nl> - <nl> static AtomBrowserMainParts * self_ ; <nl> <nl> DISALLOW_COPY_AND_ASSIGN ( AtomBrowserMainParts ) ; <nl> mmm a / shell / browser / atom_web_ui_controller_factory . cc <nl> ppp b / shell / browser / atom_web_ui_controller_factory . cc <nl> AtomWebUIControllerFactory : : ~ AtomWebUIControllerFactory ( ) { } <nl> <nl> content : : WebUI : : TypeID AtomWebUIControllerFactory : : GetWebUIType ( <nl> content : : BrowserContext * browser_context , <nl> - const GURL & url ) const { <nl> + const GURL & url ) { <nl> # if BUILDFLAG ( ENABLE_PDF_VIEWER ) <nl> if ( url . host ( ) = = kPdfViewerUIHost ) { <nl> return const_cast < AtomWebUIControllerFactory * > ( this ) ; <nl> content : : WebUI : : TypeID AtomWebUIControllerFactory : : GetWebUIType ( <nl> <nl> bool AtomWebUIControllerFactory : : UseWebUIForURL ( <nl> content : : BrowserContext * browser_context , <nl> - const GURL & url ) const { <nl> + const GURL & url ) { <nl> return GetWebUIType ( browser_context , url ) ! = content : : WebUI : : kNoWebUI ; <nl> } <nl> <nl> bool AtomWebUIControllerFactory : : UseWebUIBindingsForURL ( <nl> content : : BrowserContext * browser_context , <nl> - const GURL & url ) const { <nl> + const GURL & url ) { <nl> return UseWebUIForURL ( browser_context , url ) ; <nl> } <nl> <nl> std : : unique_ptr < content : : WebUIController > <nl> AtomWebUIControllerFactory : : CreateWebUIControllerForURL ( content : : WebUI * web_ui , <nl> - const GURL & url ) const { <nl> + const GURL & url ) { <nl> # if BUILDFLAG ( ENABLE_PDF_VIEWER ) <nl> if ( url . host ( ) = = kPdfViewerUIHost ) { <nl> base : : StringPairs toplevel_params ; <nl> mmm a / shell / browser / atom_web_ui_controller_factory . h <nl> ppp b / shell / browser / atom_web_ui_controller_factory . h <nl> class AtomWebUIControllerFactory : public content : : WebUIControllerFactory { <nl> <nl> / / content : : WebUIControllerFactory : <nl> content : : WebUI : : TypeID GetWebUIType ( content : : BrowserContext * browser_context , <nl> - const GURL & url ) const override ; <nl> + const GURL & url ) override ; <nl> bool UseWebUIForURL ( content : : BrowserContext * browser_context , <nl> - const GURL & url ) const override ; <nl> + const GURL & url ) override ; <nl> bool UseWebUIBindingsForURL ( content : : BrowserContext * browser_context , <nl> - const GURL & url ) const override ; <nl> + const GURL & url ) override ; <nl> std : : unique_ptr < content : : WebUIController > CreateWebUIControllerForURL ( <nl> content : : WebUI * web_ui , <nl> - const GURL & url ) const override ; <nl> + const GURL & url ) override ; <nl> <nl> private : <nl> friend struct base : : DefaultSingletonTraits < AtomWebUIControllerFactory > ; <nl> mmm a / shell / browser / browser_process_impl . cc <nl> ppp b / shell / browser / browser_process_impl . cc <nl> <nl> # include < utility > <nl> <nl> # include " chrome / common / chrome_switches . h " <nl> - # include " components / net_log / chrome_net_log . h " <nl> - # include " components / net_log / net_export_file_writer . h " <nl> # include " components / prefs / in_memory_pref_store . h " <nl> # include " components / prefs / overlay_user_pref_store . h " <nl> # include " components / prefs / pref_registry . h " <nl> <nl> # include " components / proxy_config / proxy_config_dictionary . h " <nl> # include " components / proxy_config / proxy_config_pref_names . h " <nl> # include " content / public / common / content_switches . h " <nl> - # include " net / log / net_log_capture_mode . h " <nl> # include " net / proxy_resolution / proxy_config . h " <nl> # include " net / proxy_resolution / proxy_config_service . h " <nl> # include " net / proxy_resolution / proxy_config_with_annotation . h " <nl> void BrowserProcessImpl : : PostEarlyInitialization ( ) { <nl> local_state_ = prefs_factory . Create ( std : : move ( pref_registry ) ) ; <nl> } <nl> <nl> - void BrowserProcessImpl : : PreCreateThreads ( <nl> - const base : : CommandLine & command_line ) { <nl> + void BrowserProcessImpl : : PreCreateThreads ( ) { <nl> / / Must be created before the IOThread . <nl> / / Once IOThread class is no longer needed , <nl> / / this can be created on first use . <nl> if ( ! SystemNetworkContextManager : : GetInstance ( ) ) <nl> SystemNetworkContextManager : : CreateInstance ( local_state_ . get ( ) ) ; <nl> <nl> - net_log_ = std : : make_unique < net_log : : ChromeNetLog > ( ) ; <nl> - / / start net log trace if - - log - net - log is passed in the command line . <nl> - if ( command_line . HasSwitch ( network : : switches : : kLogNetLog ) ) { <nl> - base : : FilePath log_file = <nl> - command_line . GetSwitchValuePath ( network : : switches : : kLogNetLog ) ; <nl> - if ( ! log_file . empty ( ) ) { <nl> - net_log_ - > StartWritingToFile ( <nl> - log_file , <nl> - net : : GetNetCaptureModeFromCommandLine ( <nl> - command_line , network : : switches : : kNetLogCaptureMode ) , <nl> - command_line . GetCommandLineString ( ) , std : : string ( ) ) ; <nl> - } <nl> - } <nl> - / / Initialize net log file exporter . <nl> - system_network_context_manager ( ) - > GetNetExportFileWriter ( ) - > Initialize ( ) ; <nl> - <nl> / / Manage global state of net and other IO thread related . <nl> - io_thread_ = std : : make_unique < IOThread > ( <nl> - net_log_ . get ( ) , SystemNetworkContextManager : : GetInstance ( ) ) ; <nl> + io_thread_ = <nl> + std : : make_unique < IOThread > ( SystemNetworkContextManager : : GetInstance ( ) ) ; <nl> } <nl> <nl> void BrowserProcessImpl : : PostDestroyThreads ( ) { <nl> PrefService * BrowserProcessImpl : : local_state ( ) { <nl> return local_state_ . get ( ) ; <nl> } <nl> <nl> - net : : URLRequestContextGetter * BrowserProcessImpl : : system_request_context ( ) { <nl> - return nullptr ; <nl> - } <nl> - <nl> scoped_refptr < network : : SharedURLLoaderFactory > <nl> BrowserProcessImpl : : shared_url_loader_factory ( ) { <nl> return system_network_context_manager ( ) - > GetSharedURLLoaderFactory ( ) ; <nl> NotificationPlatformBridge * BrowserProcessImpl : : notification_platform_bridge ( ) { <nl> return nullptr ; <nl> } <nl> <nl> - IOThread * BrowserProcessImpl : : io_thread ( ) { <nl> - DCHECK ( io_thread_ . get ( ) ) ; <nl> - return io_thread_ . get ( ) ; <nl> - } <nl> - <nl> SystemNetworkContextManager * <nl> BrowserProcessImpl : : system_network_context_manager ( ) { <nl> DCHECK ( SystemNetworkContextManager : : GetInstance ( ) ) ; <nl> BrowserProcessImpl : : optimization_guide_service ( ) { <nl> return nullptr ; <nl> } <nl> <nl> - net_log : : ChromeNetLog * BrowserProcessImpl : : net_log ( ) { <nl> - DCHECK ( net_log_ . get ( ) ) ; <nl> - return net_log_ . get ( ) ; <nl> - } <nl> - <nl> component_updater : : ComponentUpdateService * <nl> BrowserProcessImpl : : component_updater ( ) { <nl> return nullptr ; <nl> mmm a / shell / browser / browser_process_impl . h <nl> ppp b / shell / browser / browser_process_impl . h <nl> <nl> # include " shell / browser / io_thread . h " <nl> # include " shell / browser / net / system_network_context_manager . h " <nl> <nl> - namespace net_log { <nl> - class ChromeNetLog ; <nl> - } <nl> - <nl> namespace printing { <nl> class PrintJobManager ; <nl> } <nl> class BrowserProcessImpl : public BrowserProcess { <nl> static void ApplyProxyModeFromCommandLine ( ValueMapPrefStore * pref_store ) ; <nl> <nl> void PostEarlyInitialization ( ) ; <nl> - void PreCreateThreads ( const base : : CommandLine & command_line ) ; <nl> + void PreCreateThreads ( ) ; <nl> void PostDestroyThreads ( ) ; <nl> void PostMainMessageLoopRun ( ) ; <nl> <nl> class BrowserProcessImpl : public BrowserProcess { <nl> rappor : : RapporServiceImpl * rappor_service ( ) override ; <nl> ProfileManager * profile_manager ( ) override ; <nl> PrefService * local_state ( ) override ; <nl> - net : : URLRequestContextGetter * system_request_context ( ) override ; <nl> scoped_refptr < network : : SharedURLLoaderFactory > shared_url_loader_factory ( ) <nl> override ; <nl> variations : : VariationsService * variations_service ( ) override ; <nl> class BrowserProcessImpl : public BrowserProcess { <nl> extensions : : EventRouterForwarder * extension_event_router_forwarder ( ) override ; <nl> NotificationUIManager * notification_ui_manager ( ) override ; <nl> NotificationPlatformBridge * notification_platform_bridge ( ) override ; <nl> - IOThread * io_thread ( ) override ; <nl> SystemNetworkContextManager * system_network_context_manager ( ) override ; <nl> network : : NetworkQualityTracker * network_quality_tracker ( ) override ; <nl> WatchDogThread * watchdog_thread ( ) override ; <nl> class BrowserProcessImpl : public BrowserProcess { <nl> override ; <nl> optimization_guide : : OptimizationGuideService * optimization_guide_service ( ) <nl> override ; <nl> - net_log : : ChromeNetLog * net_log ( ) override ; <nl> component_updater : : ComponentUpdateService * component_updater ( ) override ; <nl> component_updater : : SupervisedUserWhitelistInstaller * <nl> supervised_user_whitelist_installer ( ) override ; <nl> class BrowserProcessImpl : public BrowserProcess { <nl> printing : : PrintJobManager * print_job_manager ( ) override ; <nl> StartupData * startup_data ( ) override ; <nl> <nl> + IOThread * io_thread ( ) const { return io_thread_ . get ( ) ; } <nl> + <nl> private : <nl> # if BUILDFLAG ( ENABLE_PRINTING ) <nl> std : : unique_ptr < printing : : PrintJobManager > print_job_manager_ ; <nl> # endif <nl> std : : unique_ptr < PrefService > local_state_ ; <nl> std : : unique_ptr < IOThread > io_thread_ ; <nl> - std : : unique_ptr < net_log : : ChromeNetLog > net_log_ ; <nl> std : : string locale_ ; <nl> <nl> DISALLOW_COPY_AND_ASSIGN ( BrowserProcessImpl ) ; <nl> mmm a / shell / browser / common_web_contents_delegate . cc <nl> ppp b / shell / browser / common_web_contents_delegate . cc <nl> content : : WebContents * CommonWebContentsDelegate : : OpenURLFromTab ( <nl> return source ; <nl> } <nl> <nl> - bool CommonWebContentsDelegate : : CanOverscrollContent ( ) const { <nl> + bool CommonWebContentsDelegate : : CanOverscrollContent ( ) { <nl> return false ; <nl> } <nl> <nl> void CommonWebContentsDelegate : : ExitFullscreenModeForTab ( <nl> } <nl> <nl> bool CommonWebContentsDelegate : : IsFullscreenForTabOrPending ( <nl> - const content : : WebContents * source ) const { <nl> + const content : : WebContents * source ) { <nl> return html_fullscreen_ ; <nl> } <nl> <nl> mmm a / shell / browser / common_web_contents_delegate . h <nl> ppp b / shell / browser / common_web_contents_delegate . h <nl> class CommonWebContentsDelegate : public content : : WebContentsDelegate , <nl> content : : WebContents * OpenURLFromTab ( <nl> content : : WebContents * source , <nl> const content : : OpenURLParams & params ) override ; <nl> - bool CanOverscrollContent ( ) const override ; <nl> + bool CanOverscrollContent ( ) override ; <nl> content : : ColorChooser * OpenColorChooser ( <nl> content : : WebContents * web_contents , <nl> SkColor color , <nl> class CommonWebContentsDelegate : public content : : WebContentsDelegate , <nl> const GURL & origin , <nl> const blink : : WebFullscreenOptions & options ) override ; <nl> void ExitFullscreenModeForTab ( content : : WebContents * source ) override ; <nl> - bool IsFullscreenForTabOrPending ( <nl> - const content : : WebContents * source ) const override ; <nl> + bool IsFullscreenForTabOrPending ( const content : : WebContents * source ) override ; <nl> blink : : WebSecurityStyle GetSecurityStyle ( <nl> content : : WebContents * web_contents , <nl> content : : SecurityStyleExplanations * explanations ) override ; <nl> mmm a / shell / browser / io_thread . cc <nl> ppp b / shell / browser / io_thread . cc <nl> <nl> <nl> # include " shell / browser / io_thread . h " <nl> <nl> + # include < string > <nl> # include < utility > <nl> <nl> # include " components / net_log / chrome_net_log . h " <nl> <nl> # include " net / cert / cert_verifier . h " <nl> # include " net / cert / cert_verify_proc . h " <nl> # include " net / cert / multi_threaded_cert_verifier . h " <nl> + # include " net / log / net_log_util . h " <nl> # include " net / proxy_resolution / proxy_resolution_service . h " <nl> # include " net / url_request / url_request_context . h " <nl> # include " services / network / network_service . h " <nl> # include " services / network / public / cpp / features . h " <nl> + # include " services / network / public / cpp / network_switches . h " <nl> + # include " services / network / public / mojom / net_log . mojom . h " <nl> # include " services / network / url_request_context_builder_mojo . h " <nl> # include " shell / browser / net / url_request_context_getter . h " <nl> <nl> using content : : BrowserThread ; <nl> <nl> - IOThread : : IOThread ( net_log : : ChromeNetLog * net_log , <nl> - SystemNetworkContextManager * system_network_context_manager ) <nl> - : net_log_ ( net_log ) { <nl> + namespace { <nl> + <nl> + / / Parses the desired granularity of NetLog capturing specified by the command <nl> + / / line . <nl> + net : : NetLogCaptureMode GetNetCaptureModeFromCommandLine ( <nl> + const base : : CommandLine & command_line ) { <nl> + base : : StringPiece switch_name = network : : switches : : kNetLogCaptureMode ; <nl> + <nl> + if ( command_line . HasSwitch ( switch_name ) ) { <nl> + std : : string value = command_line . GetSwitchValueASCII ( switch_name ) ; <nl> + <nl> + if ( value = = " Default " ) <nl> + return net : : NetLogCaptureMode : : Default ( ) ; <nl> + if ( value = = " IncludeCookiesAndCredentials " ) <nl> + return net : : NetLogCaptureMode : : IncludeCookiesAndCredentials ( ) ; <nl> + if ( value = = " IncludeSocketBytes " ) <nl> + return net : : NetLogCaptureMode : : IncludeSocketBytes ( ) ; <nl> + <nl> + LOG ( ERROR ) < < " Unrecognized value for - - " < < switch_name ; <nl> + } <nl> + <nl> + return net : : NetLogCaptureMode : : Default ( ) ; <nl> + } <nl> + <nl> + } / / namespace <nl> + <nl> + IOThread : : IOThread ( <nl> + SystemNetworkContextManager * system_network_context_manager ) { <nl> BrowserThread : : SetIOThreadDelegate ( this ) ; <nl> <nl> system_network_context_manager - > SetUp ( <nl> void IOThread : : Init ( ) { <nl> network_service - > ConfigureHttpAuthPrefs ( <nl> std : : move ( http_auth_dynamic_params_ ) ) ; <nl> <nl> + const base : : CommandLine * command_line = <nl> + base : : CommandLine : : ForCurrentProcess ( ) ; <nl> + / / start net log trace if - - log - net - log is passed in the command line . <nl> + if ( command_line - > HasSwitch ( network : : switches : : kLogNetLog ) ) { <nl> + base : : FilePath log_file = <nl> + command_line - > GetSwitchValuePath ( network : : switches : : kLogNetLog ) ; <nl> + base : : File file ( log_file , <nl> + base : : File : : FLAG_CREATE_ALWAYS | base : : File : : FLAG_WRITE ) ; <nl> + if ( log_file . empty ( ) | | ! file . IsValid ( ) ) { <nl> + LOG ( ERROR ) < < " Failed opening NetLog : " < < log_file . value ( ) ; <nl> + } else { <nl> + auto platform_dict = net_log : : GetPlatformConstantsForNetLog ( <nl> + base : : CommandLine : : ForCurrentProcess ( ) - > GetCommandLineString ( ) , <nl> + std : : string ( ELECTRON_PRODUCT_NAME ) ) ; <nl> + network_service - > StartNetLog ( <nl> + std : : move ( file ) , GetNetCaptureModeFromCommandLine ( * command_line ) , <nl> + platform_dict ? std : : move ( * platform_dict ) <nl> + : base : : DictionaryValue ( ) ) ; <nl> + } <nl> + } <nl> + <nl> system_network_context_ = network_service - > CreateNetworkContextWithBuilder ( <nl> std : : move ( network_context_request_ ) , std : : move ( network_context_params_ ) , <nl> std : : move ( builder ) , & system_request_context_ ) ; <nl> void IOThread : : CleanUp ( ) { <nl> <nl> system_network_context_ . reset ( ) ; <nl> } <nl> - <nl> - if ( net_log_ ) <nl> - net_log_ - > ShutDownBeforeThreadPool ( ) ; <nl> } <nl> mmm a / shell / browser / io_thread . h <nl> ppp b / shell / browser / io_thread . h <nl> namespace net { <nl> class URLRequestContext ; <nl> } <nl> <nl> - namespace net_log { <nl> - class ChromeNetLog ; <nl> - } <nl> - <nl> class IOThread : public content : : BrowserThreadDelegate { <nl> public : <nl> explicit IOThread ( <nl> - net_log : : ChromeNetLog * net_log , <nl> SystemNetworkContextManager * system_network_context_manager ) ; <nl> ~ IOThread ( ) override ; <nl> <nl> class IOThread : public content : : BrowserThreadDelegate { <nl> void CleanUp ( ) override ; <nl> <nl> private : <nl> - / / The NetLog is owned by the browser process , to allow logging from other <nl> - / / threads during shutdown , but is used most frequently on the IOThread . <nl> - net_log : : ChromeNetLog * net_log_ ; <nl> - <nl> / / When the network service is disabled , this holds on to a <nl> / / content : : NetworkContext class that owns | system_request_context_ | . <nl> std : : unique_ptr < network : : mojom : : NetworkContext > system_network_context_ ; <nl> mmm a / shell / browser / media / media_capture_devices_dispatcher . cc <nl> ppp b / shell / browser / media / media_capture_devices_dispatcher . cc <nl> void MediaCaptureDevicesDispatcher : : OnMediaRequestStateChanged ( <nl> int render_view_id , <nl> int page_request_id , <nl> const GURL & security_origin , <nl> - blink : : MediaStreamType stream_type , <nl> + blink : : mojom : : MediaStreamType stream_type , <nl> content : : MediaRequestState state ) { } <nl> <nl> void MediaCaptureDevicesDispatcher : : OnCreatingAudioStream ( int render_process_id , <nl> void MediaCaptureDevicesDispatcher : : OnSetCapturingLinkSecured ( <nl> int render_process_id , <nl> int render_frame_id , <nl> int page_request_id , <nl> - blink : : MediaStreamType stream_type , <nl> + blink : : mojom : : MediaStreamType stream_type , <nl> bool is_secure ) { } <nl> <nl> } / / namespace electron <nl> mmm a / shell / browser / media / media_capture_devices_dispatcher . h <nl> ppp b / shell / browser / media / media_capture_devices_dispatcher . h <nl> class MediaCaptureDevicesDispatcher : public content : : MediaObserver { <nl> int render_view_id , <nl> int page_request_id , <nl> const GURL & security_origin , <nl> - blink : : MediaStreamType stream_type , <nl> + blink : : mojom : : MediaStreamType stream_type , <nl> content : : MediaRequestState state ) override ; <nl> void OnCreatingAudioStream ( int render_process_id , <nl> int render_view_id ) override ; <nl> void OnSetCapturingLinkSecured ( int render_process_id , <nl> int render_frame_id , <nl> int page_request_id , <nl> - blink : : MediaStreamType stream_type , <nl> + blink : : mojom : : MediaStreamType stream_type , <nl> bool is_secure ) override ; <nl> <nl> private : <nl> mmm a / shell / browser / media / media_stream_devices_controller . cc <nl> ppp b / shell / browser / media / media_stream_devices_controller . cc <nl> MediaStreamDevicesController : : MediaStreamDevicesController ( <nl> / / For MEDIA_OPEN_DEVICE requests ( Pepper ) we always request both webcam <nl> / / and microphone to avoid popping two infobars . <nl> microphone_requested_ ( <nl> - request . audio_type = = blink : : MEDIA_DEVICE_AUDIO_CAPTURE | | <nl> + request . audio_type = = <nl> + blink : : mojom : : MediaStreamType : : DEVICE_AUDIO_CAPTURE | | <nl> request . request_type = = blink : : MEDIA_OPEN_DEVICE_PEPPER_ONLY ) , <nl> webcam_requested_ ( <nl> - request . video_type = = blink : : MEDIA_DEVICE_VIDEO_CAPTURE | | <nl> + request . video_type = = <nl> + blink : : mojom : : MediaStreamType : : DEVICE_VIDEO_CAPTURE | | <nl> request . request_type = = blink : : MEDIA_OPEN_DEVICE_PEPPER_ONLY ) { } <nl> <nl> MediaStreamDevicesController : : ~ MediaStreamDevicesController ( ) { <nl> MediaStreamDevicesController : : ~ MediaStreamDevicesController ( ) { <nl> <nl> bool MediaStreamDevicesController : : TakeAction ( ) { <nl> / / Do special handling of desktop screen cast . <nl> - if ( request_ . audio_type = = blink : : MEDIA_GUM_TAB_AUDIO_CAPTURE | | <nl> - request_ . video_type = = blink : : MEDIA_GUM_TAB_VIDEO_CAPTURE | | <nl> - request_ . audio_type = = blink : : MEDIA_GUM_DESKTOP_AUDIO_CAPTURE | | <nl> - request_ . video_type = = blink : : MEDIA_GUM_DESKTOP_VIDEO_CAPTURE ) { <nl> + if ( request_ . audio_type = = <nl> + blink : : mojom : : MediaStreamType : : GUM_TAB_AUDIO_CAPTURE | | <nl> + request_ . video_type = = <nl> + blink : : mojom : : MediaStreamType : : GUM_TAB_VIDEO_CAPTURE | | <nl> + request_ . audio_type = = <nl> + blink : : mojom : : MediaStreamType : : GUM_DESKTOP_AUDIO_CAPTURE | | <nl> + request_ . video_type = = <nl> + blink : : mojom : : MediaStreamType : : GUM_DESKTOP_VIDEO_CAPTURE ) { <nl> HandleUserMediaRequest ( ) ; <nl> return true ; <nl> } <nl> void MediaStreamDevicesController : : Accept ( ) { <nl> const blink : : MediaStreamDevice * device = nullptr ; <nl> / / For open device request pick the desired device or fall back to the <nl> / / first available of the given type . <nl> - if ( request_ . audio_type = = blink : : MEDIA_DEVICE_AUDIO_CAPTURE ) { <nl> + if ( request_ . audio_type = = <nl> + blink : : mojom : : MediaStreamType : : DEVICE_AUDIO_CAPTURE ) { <nl> device = <nl> MediaCaptureDevicesDispatcher : : GetInstance ( ) <nl> - > GetRequestedAudioDevice ( request_ . requested_audio_device_id ) ; <nl> void MediaStreamDevicesController : : Accept ( ) { <nl> device = MediaCaptureDevicesDispatcher : : GetInstance ( ) <nl> - > GetFirstAvailableAudioDevice ( ) ; <nl> } <nl> - } else if ( request_ . video_type = = blink : : MEDIA_DEVICE_VIDEO_CAPTURE ) { <nl> + } else if ( request_ . video_type = = <nl> + blink : : mojom : : MediaStreamType : : DEVICE_VIDEO_CAPTURE ) { <nl> / / Pepper API opens only one device at a time . <nl> device = <nl> MediaCaptureDevicesDispatcher : : GetInstance ( ) <nl> void MediaStreamDevicesController : : Deny ( <nl> void MediaStreamDevicesController : : HandleUserMediaRequest ( ) { <nl> blink : : MediaStreamDevices devices ; <nl> <nl> - if ( request_ . audio_type = = blink : : MEDIA_GUM_TAB_AUDIO_CAPTURE ) { <nl> - devices . push_back ( <nl> - blink : : MediaStreamDevice ( blink : : MEDIA_GUM_TAB_AUDIO_CAPTURE , " " , " " ) ) ; <nl> + if ( request_ . audio_type = = <nl> + blink : : mojom : : MediaStreamType : : GUM_TAB_AUDIO_CAPTURE ) { <nl> + devices . push_back ( blink : : MediaStreamDevice ( <nl> + blink : : mojom : : MediaStreamType : : GUM_TAB_AUDIO_CAPTURE , " " , " " ) ) ; <nl> } <nl> - if ( request_ . video_type = = blink : : MEDIA_GUM_TAB_VIDEO_CAPTURE ) { <nl> - devices . push_back ( <nl> - blink : : MediaStreamDevice ( blink : : MEDIA_GUM_TAB_VIDEO_CAPTURE , " " , " " ) ) ; <nl> + if ( request_ . video_type = = <nl> + blink : : mojom : : MediaStreamType : : GUM_TAB_VIDEO_CAPTURE ) { <nl> + devices . push_back ( blink : : MediaStreamDevice ( <nl> + blink : : mojom : : MediaStreamType : : GUM_TAB_VIDEO_CAPTURE , " " , " " ) ) ; <nl> } <nl> - if ( request_ . audio_type = = blink : : MEDIA_GUM_DESKTOP_AUDIO_CAPTURE ) { <nl> + if ( request_ . audio_type = = <nl> + blink : : mojom : : MediaStreamType : : GUM_DESKTOP_AUDIO_CAPTURE ) { <nl> devices . push_back ( blink : : MediaStreamDevice ( <nl> - blink : : MEDIA_GUM_DESKTOP_AUDIO_CAPTURE , " loopback " , " System Audio " ) ) ; <nl> + blink : : mojom : : MediaStreamType : : GUM_DESKTOP_AUDIO_CAPTURE , " loopback " , <nl> + " System Audio " ) ) ; <nl> } <nl> - if ( request_ . video_type = = blink : : MEDIA_GUM_DESKTOP_VIDEO_CAPTURE ) { <nl> + if ( request_ . video_type = = <nl> + blink : : mojom : : MediaStreamType : : GUM_DESKTOP_VIDEO_CAPTURE ) { <nl> content : : DesktopMediaID screen_id ; <nl> / / If the device id wasn ' t specified then this is a screen capture request <nl> / / ( i . e . chooseDesktopMedia ( ) API wasn ' t used to generate device id ) . <nl> void MediaStreamDevicesController : : HandleUserMediaRequest ( ) { <nl> content : : DesktopMediaID : : Parse ( request_ . requested_video_device_id ) ; <nl> } <nl> <nl> - devices . push_back ( <nl> - blink : : MediaStreamDevice ( blink : : MEDIA_GUM_DESKTOP_VIDEO_CAPTURE , <nl> - screen_id . ToString ( ) , " Screen " ) ) ; <nl> + devices . push_back ( blink : : MediaStreamDevice ( <nl> + blink : : mojom : : MediaStreamType : : GUM_DESKTOP_VIDEO_CAPTURE , <nl> + screen_id . ToString ( ) , " Screen " ) ) ; <nl> } <nl> <nl> std : : move ( callback_ ) . Run ( <nl> mmm a / shell / browser / net / atom_network_delegate . cc <nl> ppp b / shell / browser / net / atom_network_delegate . cc <nl> int AtomNetworkDelegate : : OnBeforeURLRequest ( <nl> net : : URLRequest * request , <nl> net : : CompletionOnceCallback callback , <nl> GURL * new_url ) { <nl> - if ( ! base : : ContainsKey ( response_listeners_ , kOnBeforeRequest ) ) { <nl> + if ( ! base : : Contains ( response_listeners_ , kOnBeforeRequest ) ) { <nl> for ( const auto & domain : ignore_connections_limit_domains_ ) { <nl> if ( request - > url ( ) . DomainIs ( domain ) ) { <nl> / / Allow unlimited concurrent connections . <nl> int AtomNetworkDelegate : : OnBeforeStartTransaction ( <nl> net : : URLRequest * request , <nl> net : : CompletionOnceCallback callback , <nl> net : : HttpRequestHeaders * headers ) { <nl> - if ( ! base : : ContainsKey ( response_listeners_ , kOnBeforeSendHeaders ) ) <nl> + if ( ! base : : Contains ( response_listeners_ , kOnBeforeSendHeaders ) ) <nl> return net : : OK ; <nl> <nl> return HandleResponseEvent ( kOnBeforeSendHeaders , request , std : : move ( callback ) , <nl> int AtomNetworkDelegate : : OnBeforeStartTransaction ( <nl> void AtomNetworkDelegate : : OnStartTransaction ( <nl> net : : URLRequest * request , <nl> const net : : HttpRequestHeaders & headers ) { <nl> - if ( ! base : : ContainsKey ( simple_listeners_ , kOnSendHeaders ) ) <nl> + if ( ! base : : Contains ( simple_listeners_ , kOnSendHeaders ) ) <nl> return ; <nl> <nl> HandleSimpleEvent ( kOnSendHeaders , request , headers ) ; <nl> int AtomNetworkDelegate : : OnHeadersReceived ( <nl> const net : : HttpResponseHeaders * original , <nl> scoped_refptr < net : : HttpResponseHeaders > * override , <nl> GURL * allowed ) { <nl> - if ( ! base : : ContainsKey ( response_listeners_ , kOnHeadersReceived ) ) <nl> + if ( ! base : : Contains ( response_listeners_ , kOnHeadersReceived ) ) <nl> return net : : OK ; <nl> <nl> return HandleResponseEvent ( <nl> int AtomNetworkDelegate : : OnHeadersReceived ( <nl> <nl> void AtomNetworkDelegate : : OnBeforeRedirect ( net : : URLRequest * request , <nl> const GURL & new_location ) { <nl> - if ( ! base : : ContainsKey ( simple_listeners_ , kOnBeforeRedirect ) ) <nl> + if ( ! base : : Contains ( simple_listeners_ , kOnBeforeRedirect ) ) <nl> return ; <nl> <nl> HandleSimpleEvent ( <nl> void AtomNetworkDelegate : : OnBeforeRedirect ( net : : URLRequest * request , <nl> <nl> void AtomNetworkDelegate : : OnResponseStarted ( net : : URLRequest * request , <nl> int net_error ) { <nl> - if ( ! base : : ContainsKey ( simple_listeners_ , kOnResponseStarted ) ) <nl> + if ( ! base : : Contains ( simple_listeners_ , kOnResponseStarted ) ) <nl> return ; <nl> <nl> if ( request - > status ( ) . status ( ) ! = net : : URLRequestStatus : : SUCCESS ) <nl> void AtomNetworkDelegate : : OnCompleted ( net : : URLRequest * request , <nl> return ; <nl> } <nl> <nl> - if ( ! base : : ContainsKey ( simple_listeners_ , kOnCompleted ) ) <nl> + if ( ! base : : Contains ( simple_listeners_ , kOnCompleted ) ) <nl> return ; <nl> <nl> HandleSimpleEvent ( kOnCompleted , request , request - > response_headers ( ) , <nl> bool AtomNetworkDelegate : : OnCanUseReportingClient ( const url : : Origin & origin , <nl> void AtomNetworkDelegate : : OnErrorOccurred ( net : : URLRequest * request , <nl> bool started , <nl> int net_error ) { <nl> - if ( ! base : : ContainsKey ( simple_listeners_ , kOnErrorOccurred ) ) <nl> + if ( ! base : : Contains ( simple_listeners_ , kOnErrorOccurred ) ) <nl> return ; <nl> <nl> HandleSimpleEvent ( kOnErrorOccurred , request , request - > was_cached ( ) , <nl> void AtomNetworkDelegate : : OnListenerResultInIO ( <nl> T out , <nl> std : : unique_ptr < base : : DictionaryValue > response ) { <nl> / / The request has been destroyed . <nl> - if ( ! base : : ContainsKey ( callbacks_ , id ) ) <nl> + if ( ! base : : Contains ( callbacks_ , id ) ) <nl> return ; <nl> <nl> ReadFromResponseObject ( * response , out ) ; <nl> mmm a / shell / browser / net / atom_url_request_job_factory . cc <nl> ppp b / shell / browser / net / atom_url_request_job_factory . cc <nl> bool AtomURLRequestJobFactory : : SetProtocolHandler ( <nl> return true ; <nl> } <nl> <nl> - if ( base : : ContainsKey ( protocol_handler_map_ , scheme ) ) <nl> + if ( base : : Contains ( protocol_handler_map_ , scheme ) ) <nl> return false ; <nl> protocol_handler_map_ [ scheme ] = protocol_handler . release ( ) ; <nl> return true ; <nl> bool AtomURLRequestJobFactory : : SetProtocolHandler ( <nl> bool AtomURLRequestJobFactory : : InterceptProtocol ( <nl> const std : : string & scheme , <nl> std : : unique_ptr < ProtocolHandler > protocol_handler ) { <nl> - if ( ! base : : ContainsKey ( protocol_handler_map_ , scheme ) | | <nl> - base : : ContainsKey ( original_protocols_ , scheme ) ) <nl> + if ( ! base : : Contains ( protocol_handler_map_ , scheme ) | | <nl> + base : : Contains ( original_protocols_ , scheme ) ) <nl> return false ; <nl> ProtocolHandler * original_protocol_handler = protocol_handler_map_ [ scheme ] ; <nl> protocol_handler_map_ [ scheme ] = protocol_handler . release ( ) ; <nl> bool AtomURLRequestJobFactory : : UninterceptProtocol ( const std : : string & scheme ) { <nl> <nl> bool AtomURLRequestJobFactory : : HasProtocolHandler ( <nl> const std : : string & scheme ) const { <nl> - return base : : ContainsKey ( protocol_handler_map_ , scheme ) ; <nl> + return base : : Contains ( protocol_handler_map_ , scheme ) ; <nl> } <nl> <nl> void AtomURLRequestJobFactory : : Clear ( ) { <nl> mmm a / shell / browser / net / system_network_context_manager . cc <nl> ppp b / shell / browser / net / system_network_context_manager . cc <nl> <nl> # include " base / command_line . h " <nl> # include " chrome / browser / browser_process . h " <nl> # include " chrome / browser / net / chrome_mojo_proxy_resolver_factory . h " <nl> - # include " components / net_log / net_export_file_writer . h " <nl> # include " content / public / browser / browser_thread . h " <nl> # include " content / public / browser / network_service_instance . h " <nl> # include " content / public / common / content_features . h " <nl> SystemNetworkContextManager : : GetSharedURLLoaderFactory ( ) { <nl> return shared_url_loader_factory_ ; <nl> } <nl> <nl> - net_log : : NetExportFileWriter * <nl> - SystemNetworkContextManager : : GetNetExportFileWriter ( ) { <nl> - if ( ! net_export_file_writer_ ) { <nl> - net_export_file_writer_ = std : : make_unique < net_log : : NetExportFileWriter > ( ) ; <nl> - } <nl> - return net_export_file_writer_ . get ( ) ; <nl> - } <nl> - <nl> network : : mojom : : NetworkContextParamsPtr <nl> SystemNetworkContextManager : : CreateDefaultNetworkContextParams ( ) { <nl> network : : mojom : : NetworkContextParamsPtr network_context_params = <nl> SystemNetworkContextManager : : CreateDefaultNetworkContextParams ( ) { <nl> network_context_params - > proxy_resolver_factory = <nl> ChromeMojoProxyResolverFactory : : CreateWithSelfOwnedReceiver ( ) ; <nl> <nl> + # if ! BUILDFLAG ( DISABLE_FTP_SUPPORT ) <nl> + network_context_params - > enable_ftp_url_support = true ; <nl> + # endif <nl> + <nl> return network_context_params ; <nl> } <nl> <nl> SystemNetworkContextManager : : CreateNetworkContextParams ( ) { <nl> <nl> network_context_params - > http_cache_enabled = false ; <nl> <nl> - # if ! BUILDFLAG ( DISABLE_FTP_SUPPORT ) <nl> - network_context_params - > enable_ftp_url_support = true ; <nl> - # endif <nl> - <nl> network_context_params - > primary_network_context = true ; <nl> <nl> proxy_config_monitor_ . AddToNetworkContextParams ( network_context_params . get ( ) ) ; <nl> mmm a / shell / browser / net / system_network_context_manager . h <nl> ppp b / shell / browser / net / system_network_context_manager . h <nl> class SystemNetworkContextManager { <nl> / / that is backed by the SystemNetworkContext . <nl> scoped_refptr < network : : SharedURLLoaderFactory > GetSharedURLLoaderFactory ( ) ; <nl> <nl> - / / Returns a shared global NetExportFileWriter instance . <nl> - net_log : : NetExportFileWriter * GetNetExportFileWriter ( ) ; <nl> - <nl> / / Called when content creates a NetworkService . Creates the <nl> / / SystemNetworkContext , if the network service is enabled . <nl> void OnNetworkServiceCreated ( network : : mojom : : NetworkService * network_service ) ; <nl> class SystemNetworkContextManager { <nl> scoped_refptr < URLLoaderFactoryForSystem > shared_url_loader_factory_ ; <nl> network : : mojom : : URLLoaderFactoryPtr url_loader_factory_ ; <nl> <nl> - / / Initialized on first access . <nl> - std : : unique_ptr < net_log : : NetExportFileWriter > net_export_file_writer_ ; <nl> - <nl> DISALLOW_COPY_AND_ASSIGN ( SystemNetworkContextManager ) ; <nl> } ; <nl> <nl> mmm a / shell / browser / net / url_request_context_getter . cc <nl> ppp b / shell / browser / net / url_request_context_getter . cc <nl> <nl> # include " shell / browser / api / atom_api_protocol . h " <nl> # include " shell / browser / atom_browser_client . h " <nl> # include " shell / browser / atom_browser_context . h " <nl> + # include " shell / browser / atom_browser_main_parts . h " <nl> # include " shell / browser / browser_process_impl . h " <nl> # include " shell / browser / net / about_protocol_handler . h " <nl> # include " shell / browser / net / asar / asar_protocol_handler . h " <nl> void SetupAtomURLRequestJobFactory ( <nl> <nl> # if ! BUILDFLAG ( DISABLE_FTP_SUPPORT ) <nl> auto * host_resolver = url_request_context - > host_resolver ( ) ; <nl> + auto * ftp_auth_cache = url_request_context - > ftp_auth_cache ( ) ; <nl> job_factory - > SetProtocolHandler ( <nl> - url : : kFtpScheme , net : : FtpProtocolHandler : : Create ( host_resolver ) ) ; <nl> + url : : kFtpScheme , <nl> + net : : FtpProtocolHandler : : Create ( host_resolver , ftp_auth_cache ) ) ; <nl> # endif <nl> } <nl> <nl> URLRequestContextGetter : : Handle : : CreateMainRequestContextGetter ( <nl> content : : URLRequestInterceptorScopedVector protocol_interceptors ) { <nl> DCHECK_CURRENTLY_ON ( BrowserThread : : UI ) ; <nl> DCHECK ( ! main_request_context_getter_ . get ( ) ) ; <nl> - DCHECK ( g_browser_process - > io_thread ( ) ) ; <nl> + DCHECK ( AtomBrowserMainParts : : Get ( ) - > browser_process ( ) - > io_thread ( ) ) ; <nl> <nl> LazyInitialize ( ) ; <nl> main_request_context_getter_ = new URLRequestContextGetter ( <nl> this , protocol_handlers , std : : move ( protocol_interceptors ) ) ; <nl> - g_browser_process - > io_thread ( ) - > RegisterURLRequestContextGetter ( <nl> - main_request_context_getter_ . get ( ) ) ; <nl> + AtomBrowserMainParts : : Get ( ) <nl> + - > browser_process ( ) <nl> + - > io_thread ( ) <nl> + - > RegisterURLRequestContextGetter ( main_request_context_getter_ . get ( ) ) ; <nl> return main_request_context_getter_ ; <nl> } <nl> <nl> URLRequestContextGetter : : ~ URLRequestContextGetter ( ) { <nl> <nl> void URLRequestContextGetter : : NotifyContextShuttingDown ( ) { <nl> DCHECK_CURRENTLY_ON ( BrowserThread : : IO ) ; <nl> - DCHECK ( g_browser_process - > io_thread ( ) ) ; <nl> + DCHECK ( AtomBrowserMainParts : : Get ( ) - > browser_process ( ) - > io_thread ( ) ) ; <nl> DCHECK ( context_handle_ ) ; <nl> <nl> if ( context_shutting_down_ ) <nl> return ; <nl> <nl> - g_browser_process - > io_thread ( ) - > DeregisterURLRequestContextGetter ( this ) ; <nl> + AtomBrowserMainParts : : Get ( ) <nl> + - > browser_process ( ) <nl> + - > io_thread ( ) <nl> + - > DeregisterURLRequestContextGetter ( this ) ; <nl> <nl> context_shutting_down_ = true ; <nl> context_handle_ - > resource_context_ . reset ( ) ; <nl> net : : URLRequestContext * URLRequestContextGetter : : GetURLRequestContext ( ) { <nl> <nl> builder - > set_ct_verifier ( std : : make_unique < net : : MultiLogCTVerifier > ( ) ) ; <nl> <nl> + / / Enable FTP , we override it later in SetupAtomURLRequestJobFactory <nl> + # if ! BUILDFLAG ( DISABLE_FTP_SUPPORT ) <nl> + builder - > set_ftp_enabled ( true ) ; <nl> + # endif <nl> + <nl> auto * network_service = content : : GetNetworkServiceImpl ( ) ; <nl> network_context_ = network_service - > CreateNetworkContextWithBuilder ( <nl> std : : move ( context_handle_ - > main_network_context_request_ ) , <nl> mmm a / shell / browser / osr / osr_host_display_client . cc <nl> ppp b / shell / browser / osr / osr_host_display_client . cc <nl> void LayeredWindowUpdater : : SetActive ( bool active ) { <nl> <nl> void LayeredWindowUpdater : : OnAllocatedSharedMemory ( <nl> const gfx : : Size & pixel_size , <nl> - mojo : : ScopedSharedBufferHandle scoped_buffer_handle ) { <nl> + base : : UnsafeSharedMemoryRegion region ) { <nl> canvas_ . reset ( ) ; <nl> <nl> + if ( ! region . IsValid ( ) ) <nl> + return ; <nl> + <nl> / / Make sure | pixel_size | is sane . <nl> size_t expected_bytes ; <nl> bool size_result = viz : : ResourceSizes : : MaybeSizeInBytes ( <nl> void LayeredWindowUpdater : : OnAllocatedSharedMemory ( <nl> return ; <nl> <nl> # if defined ( WIN32 ) <nl> - base : : SharedMemoryHandle shm_handle ; <nl> - size_t required_bytes ; <nl> - MojoResult unwrap_result = mojo : : UnwrapSharedMemoryHandle ( <nl> - std : : move ( scoped_buffer_handle ) , & shm_handle , & required_bytes , nullptr ) ; <nl> - if ( unwrap_result ! = MOJO_RESULT_OK ) <nl> - return ; <nl> - <nl> - base : : SharedMemory shm ( shm_handle , false ) ; <nl> - if ( ! shm . Map ( required_bytes ) ) { <nl> - DLOG ( ERROR ) < < " Failed to map " < < required_bytes < < " bytes " ; <nl> - return ; <nl> - } <nl> - <nl> canvas_ = skia : : CreatePlatformCanvasWithSharedSection ( <nl> - pixel_size . width ( ) , pixel_size . height ( ) , false , shm . handle ( ) . GetHandle ( ) , <nl> - skia : : CRASH_ON_FAILURE ) ; <nl> + pixel_size . width ( ) , pixel_size . height ( ) , false , <nl> + region . GetPlatformHandle ( ) , skia : : CRASH_ON_FAILURE ) ; <nl> # else <nl> - auto shm = <nl> - mojo : : UnwrapWritableSharedMemoryRegion ( std : : move ( scoped_buffer_handle ) ) ; <nl> - if ( ! shm . IsValid ( ) ) { <nl> - DLOG ( ERROR ) < < " Failed to unwrap shared memory region " ; <nl> - return ; <nl> - } <nl> - <nl> - shm_mapping_ = shm . Map ( ) ; <nl> + shm_mapping_ = region . Map ( ) ; <nl> if ( ! shm_mapping_ . IsValid ( ) ) { <nl> DLOG ( ERROR ) < < " Failed to map shared memory region " ; <nl> return ; <nl> mmm a / shell / browser / osr / osr_host_display_client . h <nl> ppp b / shell / browser / osr / osr_host_display_client . h <nl> class LayeredWindowUpdater : public viz : : mojom : : LayeredWindowUpdater { <nl> void SetActive ( bool active ) ; <nl> <nl> / / viz : : mojom : : LayeredWindowUpdater implementation . <nl> - void OnAllocatedSharedMemory ( <nl> - const gfx : : Size & pixel_size , <nl> - mojo : : ScopedSharedBufferHandle scoped_buffer_handle ) override ; <nl> + void OnAllocatedSharedMemory ( const gfx : : Size & pixel_size , <nl> + base : : UnsafeSharedMemoryRegion region ) override ; <nl> void Draw ( const gfx : : Rect & damage_rect , DrawCallback draw_callback ) override ; <nl> <nl> private : <nl> mmm a / shell / browser / printing / print_preview_message_handler . cc <nl> ppp b / shell / browser / printing / print_preview_message_handler . cc <nl> void StopWorker ( int document_cookie ) { <nl> return ; <nl> scoped_refptr < printing : : PrintQueriesQueue > queue = <nl> g_browser_process - > print_job_manager ( ) - > queue ( ) ; <nl> - scoped_refptr < printing : : PrinterQuery > printer_query = <nl> + std : : unique_ptr < printing : : PrinterQuery > printer_query = <nl> queue - > PopPrinterQuery ( document_cookie ) ; <nl> if ( printer_query . get ( ) ) { <nl> - base : : PostTaskWithTraits ( <nl> - FROM_HERE , { BrowserThread : : IO } , <nl> - base : : BindOnce ( & printing : : PrinterQuery : : StopWorker , printer_query ) ) ; <nl> + base : : PostTaskWithTraits ( FROM_HERE , { BrowserThread : : IO } , <nl> + base : : BindOnce ( & printing : : PrinterQuery : : StopWorker , <nl> + std : : move ( printer_query ) ) ) ; <nl> } <nl> } <nl> <nl> void PrintPreviewMessageHandler : : OnCompositePdfDocumentDone ( <nl> base : : ReadOnlySharedMemoryRegion region ) { <nl> DCHECK_CURRENTLY_ON ( BrowserThread : : UI ) ; <nl> <nl> - if ( status ! = printing : : mojom : : PdfCompositor : : Status : : SUCCESS ) { <nl> + if ( status ! = printing : : mojom : : PdfCompositor : : Status : : kSuccess ) { <nl> DLOG ( ERROR ) < < " Compositing pdf failed with error " < < status ; <nl> RejectPromise ( ids . request_id ) ; <nl> return ; <nl> mmm a / shell / browser / ui / accelerator_util . cc <nl> ppp b / shell / browser / ui / accelerator_util . cc <nl> void GenerateAcceleratorTable ( AcceleratorTable * table , <nl> <nl> bool TriggerAcceleratorTableCommand ( AcceleratorTable * table , <nl> const ui : : Accelerator & accelerator ) { <nl> - if ( base : : ContainsKey ( * table , accelerator ) ) { <nl> + if ( base : : Contains ( * table , accelerator ) ) { <nl> const accelerator_util : : MenuItem & item = ( * table ) [ accelerator ] ; <nl> if ( item . model - > IsEnabledAt ( item . position ) ) { <nl> const auto event_flags = <nl> mmm a / shell / browser / ui / atom_menu_model . cc <nl> ppp b / shell / browser / ui / atom_menu_model . cc <nl> void AtomMenuModel : : SetRole ( int index , const base : : string16 & role ) { <nl> <nl> base : : string16 AtomMenuModel : : GetRoleAt ( int index ) { <nl> int command_id = GetCommandIdAt ( index ) ; <nl> - if ( base : : ContainsKey ( roles_ , command_id ) ) <nl> + if ( base : : Contains ( roles_ , command_id ) ) <nl> return roles_ [ command_id ] ; <nl> else <nl> return base : : string16 ( ) ; <nl> mmm a / shell / browser / ui / cocoa / atom_ns_window_delegate . mm <nl> ppp b / shell / browser / ui / cocoa / atom_ns_window_delegate . mm <nl> - ( id ) initWithShell : ( electron : : NativeWindowMac * ) shell { <nl> / / window delegate . <nl> auto * bridge_host = views : : NativeWidgetMacNSWindowHost : : GetFromNativeWindow ( <nl> shell - > GetNativeWindow ( ) ) ; <nl> - auto * bridged_view = bridge_host - > bridge_impl ( ) ; <nl> + auto * bridged_view = bridge_host - > GetInProcessNSWindowBridge ( ) ; <nl> if ( ( self = [ super initWithBridgedNativeWidget : bridged_view ] ) ) { <nl> shell_ = shell ; <nl> is_zooming_ = false ; <nl> - ( void ) windowWillClose : ( NSNotification * ) notification { <nl> / / has been closed . <nl> auto * bridge_host = views : : NativeWidgetMacNSWindowHost : : GetFromNativeWindow ( <nl> shell_ - > GetNativeWindow ( ) ) ; <nl> - auto * bridged_view = bridge_host - > bridge_impl ( ) ; <nl> + auto * bridged_view = bridge_host - > GetInProcessNSWindowBridge ( ) ; <nl> bridged_view - > OnWindowWillClose ( ) ; <nl> } <nl> <nl> mmm a / shell / browser / ui / devtools_ui . cc <nl> ppp b / shell / browser / ui / devtools_ui . cc <nl> class BundledDataSource : public content : : URLDataSource { <nl> ~ BundledDataSource ( ) override { } <nl> <nl> / / content : : URLDataSource implementation . <nl> - std : : string GetSource ( ) const override { return kChromeUIDevToolsHost ; } <nl> + std : : string GetSource ( ) override { return kChromeUIDevToolsHost ; } <nl> <nl> void StartDataRequest ( <nl> const std : : string & path , <nl> class BundledDataSource : public content : : URLDataSource { <nl> callback . Run ( nullptr ) ; <nl> } <nl> <nl> - std : : string GetMimeType ( const std : : string & path ) const override { <nl> + std : : string GetMimeType ( const std : : string & path ) override { <nl> return GetMimeTypeForPath ( path ) ; <nl> } <nl> <nl> - bool ShouldAddContentSecurityPolicy ( ) const override { return false ; } <nl> + bool ShouldAddContentSecurityPolicy ( ) override { return false ; } <nl> <nl> - bool ShouldDenyXFrameOptions ( ) const override { return false ; } <nl> + bool ShouldDenyXFrameOptions ( ) override { return false ; } <nl> <nl> - bool ShouldServeMimeTypeAsContentTypeHeader ( ) const override { return true ; } <nl> + bool ShouldServeMimeTypeAsContentTypeHeader ( ) override { return true ; } <nl> <nl> void StartBundledDataRequest ( const std : : string & path , <nl> const GotDataCallback & callback ) { <nl> mmm a / shell / browser / ui / tray_icon_gtk . cc <nl> ppp b / shell / browser / ui / tray_icon_gtk . cc <nl> TrayIconGtk : : ~ TrayIconGtk ( ) { } <nl> <nl> void TrayIconGtk : : SetImage ( const gfx : : Image & image ) { <nl> if ( icon_ ) { <nl> - icon_ - > SetImage ( image . AsImageSkia ( ) ) ; <nl> + icon_ - > SetIcon ( image . AsImageSkia ( ) ) ; <nl> return ; <nl> } <nl> <nl> const auto toolTip = base : : UTF8ToUTF16 ( GetApplicationName ( ) ) ; <nl> icon_ = views : : LinuxUI : : instance ( ) - > CreateLinuxStatusIcon ( <nl> image . AsImageSkia ( ) , toolTip , Browser : : Get ( ) - > GetName ( ) . c_str ( ) ) ; <nl> - icon_ - > set_delegate ( this ) ; <nl> + icon_ - > SetDelegate ( this ) ; <nl> } <nl> <nl> void TrayIconGtk : : SetToolTip ( const std : : string & tool_tip ) { <nl> void TrayIconGtk : : SetContextMenu ( AtomMenuModel * menu_model ) { <nl> icon_ - > UpdatePlatformContextMenu ( menu_model ) ; <nl> } <nl> <nl> + const gfx : : ImageSkia & TrayIconGtk : : GetImage ( ) const { <nl> + NOTREACHED ( ) ; <nl> + return dummy_image_ ; <nl> + } <nl> + <nl> + const base : : string16 & TrayIconGtk : : GetToolTip ( ) const { <nl> + NOTREACHED ( ) ; <nl> + return dummy_string_ ; <nl> + } <nl> + <nl> + ui : : MenuModel * TrayIconGtk : : GetMenuModel ( ) const { <nl> + NOTREACHED ( ) ; <nl> + return nullptr ; <nl> + } <nl> + <nl> + void TrayIconGtk : : OnImplInitializationFailed ( ) { } <nl> + <nl> void TrayIconGtk : : OnClick ( ) { <nl> NotifyClicked ( ) ; <nl> } <nl> mmm a / shell / browser / ui / tray_icon_gtk . h <nl> ppp b / shell / browser / ui / tray_icon_gtk . h <nl> class TrayIconGtk : public TrayIcon , public views : : StatusIconLinux : : Delegate { <nl> void SetToolTip ( const std : : string & tool_tip ) override ; <nl> void SetContextMenu ( AtomMenuModel * menu_model ) override ; <nl> <nl> - private : <nl> - / / views : : StatusIconLinux : : Delegate : <nl> + / / views : : StatusIconLinux : : Delegate <nl> void OnClick ( ) override ; <nl> bool HasClickAction ( ) override ; <nl> + / / The following four methods are only used by StatusIconLinuxDbus , which we <nl> + / / aren ' t yet using , so they are given stub implementations . <nl> + const gfx : : ImageSkia & GetImage ( ) const override ; <nl> + const base : : string16 & GetToolTip ( ) const override ; <nl> + ui : : MenuModel * GetMenuModel ( ) const override ; <nl> + void OnImplInitializationFailed ( ) override ; <nl> <nl> + private : <nl> std : : unique_ptr < views : : StatusIconLinux > icon_ ; <nl> <nl> + gfx : : ImageSkia dummy_image_ ; <nl> + base : : string16 dummy_string_ ; <nl> + <nl> DISALLOW_COPY_AND_ASSIGN ( TrayIconGtk ) ; <nl> } ; <nl> <nl> mmm a / shell / browser / ui / views / menu_bar . cc <nl> ppp b / shell / browser / ui / views / menu_bar . cc <nl> MenuBar : : MenuBar ( RootView * window ) <nl> RefreshColorCache ( ) ; <nl> UpdateViewColors ( ) ; <nl> SetFocusBehavior ( FocusBehavior : : ALWAYS ) ; <nl> - SetLayoutManager ( <nl> - std : : make_unique < views : : BoxLayout > ( views : : BoxLayout : : kHorizontal ) ) ; <nl> + SetLayoutManager ( std : : make_unique < views : : BoxLayout > ( <nl> + views : : BoxLayout : : Orientation : : kHorizontal ) ) ; <nl> window_ - > GetFocusManager ( ) - > AddFocusChangeListener ( color_updater_ . get ( ) ) ; <nl> } <nl> <nl> mmm a / shell / browser / ui / win / taskbar_host . cc <nl> ppp b / shell / browser / ui / win / taskbar_host . cc <nl> bool TaskbarHost : : SetThumbnailToolTip ( HWND window , const std : : string & tooltip ) { <nl> } <nl> <nl> bool TaskbarHost : : HandleThumbarButtonEvent ( int button_id ) { <nl> - if ( ContainsKey ( callback_map_ , button_id ) ) { <nl> + if ( base : : Contains ( callback_map_ , button_id ) ) { <nl> auto callback = callback_map_ [ button_id ] ; <nl> if ( ! callback . is_null ( ) ) <nl> callback . Run ( ) ; <nl> mmm a / shell / browser / web_contents_permission_helper . cc <nl> ppp b / shell / browser / web_contents_permission_helper . cc <nl> <nl> <nl> namespace { <nl> <nl> - std : : string MediaStreamTypeToString ( blink : : MediaStreamType type ) { <nl> + std : : string MediaStreamTypeToString ( blink : : mojom : : MediaStreamType type ) { <nl> switch ( type ) { <nl> - case blink : : MediaStreamType : : MEDIA_DEVICE_AUDIO_CAPTURE : <nl> + case blink : : mojom : : MediaStreamType : : DEVICE_AUDIO_CAPTURE : <nl> return " audio " ; <nl> - case blink : : MediaStreamType : : MEDIA_DEVICE_VIDEO_CAPTURE : <nl> + case blink : : mojom : : MediaStreamType : : DEVICE_VIDEO_CAPTURE : <nl> return " video " ; <nl> default : <nl> return " unknown " ; <nl> void WebContentsPermissionHelper : : RequestMediaAccessPermission ( <nl> base : : DictionaryValue details ; <nl> std : : unique_ptr < base : : ListValue > media_types ( new base : : ListValue ) ; <nl> if ( request . audio_type = = <nl> - blink : : MediaStreamType : : MEDIA_DEVICE_AUDIO_CAPTURE ) { <nl> + blink : : mojom : : MediaStreamType : : DEVICE_AUDIO_CAPTURE ) { <nl> media_types - > AppendString ( " audio " ) ; <nl> } <nl> if ( request . video_type = = <nl> - blink : : MediaStreamType : : MEDIA_DEVICE_VIDEO_CAPTURE ) { <nl> + blink : : mojom : : MediaStreamType : : DEVICE_VIDEO_CAPTURE ) { <nl> media_types - > AppendString ( " video " ) ; <nl> } <nl> details . SetList ( " mediaTypes " , std : : move ( media_types ) ) ; <nl> void WebContentsPermissionHelper : : RequestOpenExternalPermission ( <nl> <nl> bool WebContentsPermissionHelper : : CheckMediaAccessPermission ( <nl> const GURL & security_origin , <nl> - blink : : MediaStreamType type ) const { <nl> + blink : : mojom : : MediaStreamType type ) const { <nl> base : : DictionaryValue details ; <nl> details . SetString ( " securityOrigin " , security_origin . spec ( ) ) ; <nl> details . SetString ( " mediaType " , MediaStreamTypeToString ( type ) ) ; <nl> mmm a / shell / browser / web_contents_permission_helper . h <nl> ppp b / shell / browser / web_contents_permission_helper . h <nl> class WebContentsPermissionHelper <nl> <nl> / / Synchronous Checks <nl> bool CheckMediaAccessPermission ( const GURL & security_origin , <nl> - blink : : MediaStreamType type ) const ; <nl> + blink : : mojom : : MediaStreamType type ) const ; <nl> <nl> private : <nl> explicit WebContentsPermissionHelper ( content : : WebContents * web_contents ) ; <nl> mmm a / shell / browser / web_view_guest_delegate . cc <nl> ppp b / shell / browser / web_view_guest_delegate . cc <nl> void WebViewGuestDelegate : : DidDetach ( ) { <nl> ResetZoomController ( ) ; <nl> } <nl> <nl> - content : : WebContents * WebViewGuestDelegate : : GetOwnerWebContents ( ) const { <nl> + content : : WebContents * WebViewGuestDelegate : : GetOwnerWebContents ( ) { <nl> return embedder_web_contents_ ; <nl> } <nl> <nl> mmm a / shell / browser / web_view_guest_delegate . h <nl> ppp b / shell / browser / web_view_guest_delegate . h <nl> class WebViewGuestDelegate : public content : : BrowserPluginGuestDelegate , <nl> protected : <nl> / / content : : BrowserPluginGuestDelegate : <nl> void DidDetach ( ) final ; <nl> - content : : WebContents * GetOwnerWebContents ( ) const final ; <nl> + content : : WebContents * GetOwnerWebContents ( ) final ; <nl> content : : RenderWidgetHost * GetOwnerRenderWidgetHost ( ) final ; <nl> content : : SiteInstance * GetOwnerSiteInstance ( ) final ; <nl> content : : WebContents * CreateNewGuestWindow ( <nl> mmm a / shell / browser / web_view_manager . cc <nl> ppp b / shell / browser / web_view_manager . cc <nl> void WebViewManager : : AddGuest ( int guest_instance_id , <nl> } <nl> <nl> void WebViewManager : : RemoveGuest ( int guest_instance_id ) { <nl> - if ( ! base : : ContainsKey ( web_contents_embedder_map_ , guest_instance_id ) ) <nl> + if ( ! base : : Contains ( web_contents_embedder_map_ , guest_instance_id ) ) <nl> return ; <nl> <nl> web_contents_embedder_map_ . erase ( guest_instance_id ) ; <nl> void WebViewManager : : RemoveGuest ( int guest_instance_id ) { <nl> } <nl> <nl> content : : WebContents * WebViewManager : : GetEmbedder ( int guest_instance_id ) { <nl> - if ( base : : ContainsKey ( web_contents_embedder_map_ , guest_instance_id ) ) <nl> + if ( base : : Contains ( web_contents_embedder_map_ , guest_instance_id ) ) <nl> return web_contents_embedder_map_ [ guest_instance_id ] . embedder ; <nl> else <nl> return nullptr ; <nl> content : : WebContents * WebViewManager : : GetGuestByInstanceID ( <nl> int owner_process_id , <nl> int element_instance_id ) { <nl> ElementInstanceKey key ( owner_process_id , element_instance_id ) ; <nl> - if ( ! base : : ContainsKey ( element_instance_id_to_guest_map_ , key ) ) <nl> + if ( ! base : : Contains ( element_instance_id_to_guest_map_ , key ) ) <nl> return nullptr ; <nl> <nl> int guest_instance_id = element_instance_id_to_guest_map_ [ key ] ; <nl> - if ( base : : ContainsKey ( web_contents_embedder_map_ , guest_instance_id ) ) <nl> + if ( base : : Contains ( web_contents_embedder_map_ , guest_instance_id ) ) <nl> return web_contents_embedder_map_ [ guest_instance_id ] . web_contents ; <nl> else <nl> return nullptr ; <nl> mmm a / shell / common / api / atom_api_clipboard . cc <nl> ppp b / shell / common / api / atom_api_clipboard . cc <nl> namespace api { <nl> ui : : ClipboardType Clipboard : : GetClipboardType ( mate : : Arguments * args ) { <nl> std : : string type ; <nl> if ( args - > GetNext ( & type ) & & type = = " selection " ) <nl> - return ui : : CLIPBOARD_TYPE_SELECTION ; <nl> + return ui : : ClipboardType : : kSelection ; <nl> else <nl> - return ui : : CLIPBOARD_TYPE_COPY_PASTE ; <nl> + return ui : : ClipboardType : : kCopyPaste ; <nl> } <nl> <nl> std : : vector < base : : string16 > Clipboard : : AvailableFormats ( mate : : Arguments * args ) { <nl> mmm a / shell / common / api / electron_bindings . cc <nl> ppp b / shell / common / api / electron_bindings . cc <nl> v8 : : Local < v8 : : Promise > ElectronBindings : : GetProcessMemoryInfo ( <nl> v8 : : Local < v8 : : Value > ElectronBindings : : GetBlinkMemoryInfo ( <nl> v8 : : Isolate * isolate ) { <nl> auto allocated = blink : : ProcessHeap : : TotalAllocatedObjectSize ( ) ; <nl> - auto marked = blink : : ProcessHeap : : TotalMarkedObjectSize ( ) ; <nl> auto total = blink : : ProcessHeap : : TotalAllocatedSpace ( ) ; <nl> <nl> mate : : Dictionary dict = mate : : Dictionary : : CreateEmpty ( isolate ) ; <nl> dict . SetHidden ( " simple " , true ) ; <nl> dict . Set ( " allocated " , static_cast < double > ( allocated > > 10 ) ) ; <nl> - dict . Set ( " marked " , static_cast < double > ( marked > > 10 ) ) ; <nl> dict . Set ( " total " , static_cast < double > ( total > > 10 ) ) ; <nl> return dict . GetHandle ( ) ; <nl> } <nl> mmm a / shell / common / asar / asar_util . cc <nl> ppp b / shell / common / asar / asar_util . cc <nl> std : : shared_ptr < Archive > GetOrCreateAsarArchive ( const base : : FilePath & path ) { <nl> if ( ! g_archive_map_tls . Pointer ( ) - > Get ( ) ) <nl> g_archive_map_tls . Pointer ( ) - > Set ( new ArchiveMap ) ; <nl> ArchiveMap & archive_map = * g_archive_map_tls . Pointer ( ) - > Get ( ) ; <nl> - if ( ! ContainsKey ( archive_map , path ) ) { <nl> + if ( ! base : : Contains ( archive_map , path ) ) { <nl> std : : shared_ptr < Archive > archive ( new Archive ( path ) ) ; <nl> if ( ! archive - > Init ( ) ) <nl> return nullptr ; <nl> mmm a / shell / common / mac / main_application_bundle . mm <nl> ppp b / shell / common / mac / main_application_bundle . mm <nl> <nl> # include " base / mac / foundation_util . h " <nl> # include " base / path_service . h " <nl> # include " base / strings / string_util . h " <nl> + # include " content / common / mac_helpers . h " <nl> <nl> namespace electron { <nl> <nl> bool HasMainProcessKey ( ) { <nl> <nl> / / Up to Contents . <nl> if ( ! HasMainProcessKey ( ) & & <nl> - base : : EndsWith ( path . value ( ) , " Helper " , base : : CompareCase : : SENSITIVE ) ) { <nl> + ( base : : EndsWith ( path . value ( ) , " Helper " , base : : CompareCase : : SENSITIVE ) | | <nl> + base : : EndsWith ( path . value ( ) , content : : kMacHelperSuffix_renderer , <nl> + base : : CompareCase : : SENSITIVE ) | | <nl> + base : : EndsWith ( path . value ( ) , content : : kMacHelperSuffix_plugin , <nl> + base : : CompareCase : : SENSITIVE ) ) ) { <nl> / / The running executable is the helper . Go up five steps : <nl> / / Contents / Frameworks / Helper . app / Contents / MacOS / Helper <nl> / / ^ to here ^ from here <nl> mmm a / shell / common / mouse_util . cc <nl> ppp b / shell / common / mouse_util . cc <nl> <nl> # include " shell / common / mouse_util . h " <nl> # include < string > <nl> <nl> - using Cursor = blink : : WebCursorInfo : : Type ; <nl> + using Cursor = ui : : CursorType ; <nl> <nl> namespace electron { <nl> <nl> std : : string CursorTypeToString ( const content : : CursorInfo & info ) { <nl> switch ( info . type ) { <nl> - case Cursor : : kTypePointer : <nl> + case Cursor : : kPointer : <nl> return " default " ; <nl> - case Cursor : : kTypeCross : <nl> + case Cursor : : kCross : <nl> return " crosshair " ; <nl> - case Cursor : : kTypeHand : <nl> + case Cursor : : kHand : <nl> return " pointer " ; <nl> - case Cursor : : kTypeIBeam : <nl> + case Cursor : : kIBeam : <nl> return " text " ; <nl> - case Cursor : : kTypeWait : <nl> + case Cursor : : kWait : <nl> return " wait " ; <nl> - case Cursor : : kTypeHelp : <nl> + case Cursor : : kHelp : <nl> return " help " ; <nl> - case Cursor : : kTypeEastResize : <nl> + case Cursor : : kEastResize : <nl> return " e - resize " ; <nl> - case Cursor : : kTypeNorthResize : <nl> + case Cursor : : kNorthResize : <nl> return " n - resize " ; <nl> - case Cursor : : kTypeNorthEastResize : <nl> + case Cursor : : kNorthEastResize : <nl> return " ne - resize " ; <nl> - case Cursor : : kTypeNorthWestResize : <nl> + case Cursor : : kNorthWestResize : <nl> return " nw - resize " ; <nl> - case Cursor : : kTypeSouthResize : <nl> + case Cursor : : kSouthResize : <nl> return " s - resize " ; <nl> - case Cursor : : kTypeSouthEastResize : <nl> + case Cursor : : kSouthEastResize : <nl> return " se - resize " ; <nl> - case Cursor : : kTypeSouthWestResize : <nl> + case Cursor : : kSouthWestResize : <nl> return " sw - resize " ; <nl> - case Cursor : : kTypeWestResize : <nl> + case Cursor : : kWestResize : <nl> return " w - resize " ; <nl> - case Cursor : : kTypeNorthSouthResize : <nl> + case Cursor : : kNorthSouthResize : <nl> return " ns - resize " ; <nl> - case Cursor : : kTypeEastWestResize : <nl> + case Cursor : : kEastWestResize : <nl> return " ew - resize " ; <nl> - case Cursor : : kTypeNorthEastSouthWestResize : <nl> + case Cursor : : kNorthEastSouthWestResize : <nl> return " nesw - resize " ; <nl> - case Cursor : : kTypeNorthWestSouthEastResize : <nl> + case Cursor : : kNorthWestSouthEastResize : <nl> return " nwse - resize " ; <nl> - case Cursor : : kTypeColumnResize : <nl> + case Cursor : : kColumnResize : <nl> return " col - resize " ; <nl> - case Cursor : : kTypeRowResize : <nl> + case Cursor : : kRowResize : <nl> return " row - resize " ; <nl> - case Cursor : : kTypeMiddlePanning : <nl> + case Cursor : : kMiddlePanning : <nl> return " m - panning " ; <nl> - case Cursor : : kTypeEastPanning : <nl> + case Cursor : : kEastPanning : <nl> return " e - panning " ; <nl> - case Cursor : : kTypeNorthPanning : <nl> + case Cursor : : kNorthPanning : <nl> return " n - panning " ; <nl> - case Cursor : : kTypeNorthEastPanning : <nl> + case Cursor : : kNorthEastPanning : <nl> return " ne - panning " ; <nl> - case Cursor : : kTypeNorthWestPanning : <nl> + case Cursor : : kNorthWestPanning : <nl> return " nw - panning " ; <nl> - case Cursor : : kTypeSouthPanning : <nl> + case Cursor : : kSouthPanning : <nl> return " s - panning " ; <nl> - case Cursor : : kTypeSouthEastPanning : <nl> + case Cursor : : kSouthEastPanning : <nl> return " se - panning " ; <nl> - case Cursor : : kTypeSouthWestPanning : <nl> + case Cursor : : kSouthWestPanning : <nl> return " sw - panning " ; <nl> - case Cursor : : kTypeWestPanning : <nl> + case Cursor : : kWestPanning : <nl> return " w - panning " ; <nl> - case Cursor : : kTypeMove : <nl> + case Cursor : : kMove : <nl> return " move " ; <nl> - case Cursor : : kTypeVerticalText : <nl> + case Cursor : : kVerticalText : <nl> return " vertical - text " ; <nl> - case Cursor : : kTypeCell : <nl> + case Cursor : : kCell : <nl> return " cell " ; <nl> - case Cursor : : kTypeContextMenu : <nl> + case Cursor : : kContextMenu : <nl> return " context - menu " ; <nl> - case Cursor : : kTypeAlias : <nl> + case Cursor : : kAlias : <nl> return " alias " ; <nl> - case Cursor : : kTypeProgress : <nl> + case Cursor : : kProgress : <nl> return " progress " ; <nl> - case Cursor : : kTypeNoDrop : <nl> + case Cursor : : kNoDrop : <nl> return " nodrop " ; <nl> - case Cursor : : kTypeCopy : <nl> + case Cursor : : kCopy : <nl> return " copy " ; <nl> - case Cursor : : kTypeNone : <nl> + case Cursor : : kNone : <nl> return " none " ; <nl> - case Cursor : : kTypeNotAllowed : <nl> + case Cursor : : kNotAllowed : <nl> return " not - allowed " ; <nl> - case Cursor : : kTypeZoomIn : <nl> + case Cursor : : kZoomIn : <nl> return " zoom - in " ; <nl> - case Cursor : : kTypeZoomOut : <nl> + case Cursor : : kZoomOut : <nl> return " zoom - out " ; <nl> - case Cursor : : kTypeGrab : <nl> + case Cursor : : kGrab : <nl> return " grab " ; <nl> - case Cursor : : kTypeGrabbing : <nl> + case Cursor : : kGrabbing : <nl> return " grabbing " ; <nl> - case Cursor : : kTypeCustom : <nl> + case Cursor : : kCustom : <nl> return " custom " ; <nl> default : <nl> return " default " ; <nl> mmm a / shell / common / native_mate_converters / blink_converter . cc <nl> ppp b / shell / common / native_mate_converters / blink_converter . cc <nl> v8 : : Local < v8 : : Value > EditFlagsToV8 ( v8 : : Isolate * isolate , int editFlags ) { <nl> std : : vector < base : : string16 > types ; <nl> bool ignore ; <nl> ui : : Clipboard : : GetForCurrentThread ( ) - > ReadAvailableTypes ( <nl> - ui : : CLIPBOARD_TYPE_COPY_PASTE , & types , & ignore ) ; <nl> + ui : : ClipboardType : : kCopyPaste , & types , & ignore ) ; <nl> pasteFlag = ! types . empty ( ) ; <nl> } <nl> dict . Set ( " canPaste " , pasteFlag ) ; <nl> mmm a / spec - main / api - browser - window - spec . ts <nl> ppp b / spec - main / api - browser - window - spec . ts <nl> import * as fs from ' fs ' <nl> import * as qs from ' querystring ' <nl> import * as http from ' http ' <nl> import { AddressInfo } from ' net ' <nl> - import { app , BrowserWindow , ipcMain , OnBeforeSendHeadersListenerDetails , screen } from ' electron ' <nl> + import { app , BrowserWindow , ipcMain , OnBeforeSendHeadersListenerDetails , screen , protocol } from ' electron ' <nl> import { emittedOnce } from ' . / events - helpers ' ; <nl> import { closeWindow } from ' . / window - helpers ' ; <nl> <nl> describe ( ' BrowserWindow module ' , ( ) = > { <nl> <nl> describe ( ' BrowserWindow . loadURL ( url ) ' , ( ) = > { <nl> let w = null as unknown as BrowserWindow <nl> + const scheme = ' other ' <nl> + const srcPath = path . join ( fixtures , ' api ' , ' loaded - from - dataurl . js ' ) <nl> + before ( ( done ) = > { <nl> + protocol . registerFileProtocol ( scheme , ( request , callback ) = > { <nl> + callback ( srcPath ) <nl> + } , ( error ) = > done ( error ) ) <nl> + } ) <nl> + <nl> + after ( ( ) = > { <nl> + protocol . unregisterProtocol ( scheme ) <nl> + } ) <nl> + <nl> beforeEach ( ( ) = > { <nl> w = new BrowserWindow ( { show : false , webPreferences : { nodeIntegration : true } } ) <nl> } ) <nl> describe ( ' BrowserWindow module ' , ( ) = > { <nl> expect ( test ) . to . equal ( ' test ' ) <nl> done ( ) <nl> } ) <nl> - w . loadURL ( ' data : text / html , < script src = " loaded - from - dataurl . js " > < / script > ' , { baseURLForDataURL : ` file : / / $ { path . join ( fixtures , ' api ' ) } $ { path . sep } ` } ) <nl> + w . loadURL ( ' data : text / html , < script src = " loaded - from - dataurl . js " > < / script > ' , { baseURLForDataURL : ` other : / / $ { path . join ( fixtures , ' api ' ) } $ { path . sep } ` } ) <nl> } ) <nl> } ) <nl> <nl> mmm a / spec - main / api - session - spec . js <nl> ppp b / spec - main / api - session - spec . js <nl> describe ( ' session module ' , ( ) = > { <nl> <nl> describe ( ' ses . setPermissionRequestHandler ( handler ) ' , ( ) = > { <nl> it ( ' cancels any pending requests when cleared ' , async ( ) = > { <nl> + if ( w ! = null ) w . destroy ( ) <nl> + w = new BrowserWindow ( { <nl> + show : false , <nl> + webPreferences : { <nl> + partition : ` very - temp - permision - handler ` , <nl> + nodeIntegration : true , <nl> + } <nl> + } ) <nl> + <nl> const ses = w . webContents . session <nl> ses . setPermissionRequestHandler ( ( ) = > { <nl> ses . setPermissionRequestHandler ( null ) <nl> } ) <nl> <nl> + ses . protocol . interceptStringProtocol ( ' https ' , ( req , cb ) = > { <nl> + cb ( ` < html > < script > ( $ { remote } ) ( ) < / script > < / html > ` ) <nl> + } ) <nl> + <nl> const result = emittedOnce ( require ( ' electron ' ) . ipcMain , ' message ' ) <nl> <nl> function remote ( ) { <nl> describe ( ' session module ' , ( ) = > { <nl> } ) ; <nl> } <nl> <nl> - await w . loadURL ( ` data : text / html , < script > ( $ { remote } ) ( ) < / script > ` ) <nl> + await w . loadURL ( ' https : / / myfakesite ' ) <nl> <nl> const [ , name ] = await result <nl> expect ( name ) . to . deep . equal ( ' SecurityError ' ) <nl> mmm a / spec / api - process - spec . js <nl> ppp b / spec / api - process - spec . js <nl> describe ( ' process module ' , ( ) = > { <nl> it ( ' returns blink memory information object ' , ( ) = > { <nl> const heapStats = process . getBlinkMemoryInfo ( ) <nl> expect ( heapStats . allocated ) . to . be . a ( ' number ' ) <nl> - expect ( heapStats . marked ) . to . be . a ( ' number ' ) <nl> expect ( heapStats . total ) . to . be . a ( ' number ' ) <nl> } ) <nl> } ) <nl> mmm a / spec / chromium - spec . js <nl> ppp b / spec / chromium - spec . js <nl> describe ( ' chromium feature ' , ( ) = > { <nl> document . body . appendChild ( webview ) <nl> } ) <nl> <nl> - it ( ' SharedWorker can work ' , ( done ) = > { <nl> - const worker = new SharedWorker ( ' . . / fixtures / workers / shared_worker . js ' ) <nl> - const message = ' ping ' <nl> - worker . port . onmessage = ( event ) = > { <nl> - expect ( event . data ) . to . equal ( message ) <nl> - done ( ) <nl> - } <nl> - worker . port . postMessage ( message ) <nl> - } ) <nl> - <nl> - it ( ' SharedWorker has no node integration by default ' , ( done ) = > { <nl> - const worker = new SharedWorker ( ' . . / fixtures / workers / shared_worker_node . js ' ) <nl> - worker . port . onmessage = ( event ) = > { <nl> - expect ( event . data ) . to . equal ( ' undefined undefined undefined undefined ' ) <nl> - done ( ) <nl> - } <nl> - } ) <nl> + / / FIXME : disabled during chromium update due to crash in content : : WorkerScriptFetchInitiator : : CreateScriptLoaderOnIO <nl> + xdescribe ( ' SharedWorker ' , ( ) = > { <nl> + it ( ' can work ' , ( done ) = > { <nl> + const worker = new SharedWorker ( ' . . / fixtures / workers / shared_worker . js ' ) <nl> + const message = ' ping ' <nl> + worker . port . onmessage = ( event ) = > { <nl> + expect ( event . data ) . to . equal ( message ) <nl> + done ( ) <nl> + } <nl> + worker . port . postMessage ( message ) <nl> + } ) <nl> <nl> - it ( ' SharedWorker has node integration with nodeIntegrationInWorker ' , ( done ) = > { <nl> - const webview = new WebView ( ) <nl> - webview . addEventListener ( ' console - message ' , ( e ) = > { <nl> - console . log ( e ) <nl> + it ( ' has no node integration by default ' , ( done ) = > { <nl> + const worker = new SharedWorker ( ' . . / fixtures / workers / shared_worker_node . js ' ) <nl> + worker . port . onmessage = ( event ) = > { <nl> + expect ( event . data ) . to . equal ( ' undefined undefined undefined undefined ' ) <nl> + done ( ) <nl> + } <nl> } ) <nl> - webview . addEventListener ( ' ipc - message ' , ( e ) = > { <nl> - expect ( e . channel ) . to . equal ( ' object function object function ' ) <nl> - webview . remove ( ) <nl> - done ( ) <nl> + <nl> + it ( ' has node integration with nodeIntegrationInWorker ' , ( done ) = > { <nl> + const webview = new WebView ( ) <nl> + webview . addEventListener ( ' console - message ' , ( e ) = > { <nl> + console . log ( e ) <nl> + } ) <nl> + webview . addEventListener ( ' ipc - message ' , ( e ) = > { <nl> + expect ( e . channel ) . to . equal ( ' object function object function ' ) <nl> + webview . remove ( ) <nl> + done ( ) <nl> + } ) <nl> + webview . src = ` file : / / $ { fixtures } / pages / shared_worker . html ` <nl> + webview . setAttribute ( ' webpreferences ' , ' nodeIntegration , nodeIntegrationInWorker ' ) <nl> + document . body . appendChild ( webview ) <nl> } ) <nl> - webview . src = ` file : / / $ { fixtures } / pages / shared_worker . html ` <nl> - webview . setAttribute ( ' webpreferences ' , ' nodeIntegration , nodeIntegrationInWorker ' ) <nl> - document . body . appendChild ( webview ) <nl> } ) <nl> } ) <nl> <nl> mmm a / spec / node - spec . js <nl> ppp b / spec / node - spec . js <nl> describe ( ' node feature ' , ( ) = > { <nl> function dataListener ( data ) { <nl> output + = data <nl> <nl> - if ( output . trim ( ) . startsWith ( ' Debugger listening on ws : / / ' ) & & output . endsWith ( ' \ n ' ) ) { <nl> + if ( output . trim ( ) . indexOf ( ' Debugger listening on ws : / / ' ) > - 1 & & output . indexOf ( ' \ n ' ) > - 1 ) { <nl> const socketMatch = output . trim ( ) . match ( / ( ws : \ / \ / . + : [ 0 - 9 ] + \ / . + ? ) \ n / gm ) <nl> if ( socketMatch & & socketMatch [ 0 ] ) { <nl> child . stderr . removeListener ( ' data ' , dataListener ) <nl> mmm a / spec / webview - spec . js <nl> ppp b / spec / webview - spec . js <nl> describe ( ' < webview > tag ' , function ( ) { <nl> <nl> const generateSpecs = ( description , sandbox ) = > { <nl> describe ( description , ( ) = > { <nl> - it ( ' emits resize events ' , async ( ) = > { <nl> + / / TODO ( nornagon ) : disabled during chromium roll 2019 - 06 - 11 due to a <nl> + / / ' ResizeObserver loop limit exceeded ' error on Windows <nl> + xit ( ' emits resize events ' , async ( ) = > { <nl> const firstResizeSignal = waitForEvent ( webview , ' resize ' ) <nl> const domReadySignal = waitForEvent ( webview , ' dom - ready ' ) <nl> <nl> mmm a / spec / yarn . lock <nl> ppp b / spec / yarn . lock <nl> <nl> integrity sha512 - ugvXJjwF5ldtUpa7D95kruNJ41yFQDEKyF5CW4TgKJnh + W / zmlBzXXeKTyqIgwMFrkePN2JqOBqcF0M0oOunow = = <nl> <nl> abstract - socket @ ^ 2 . 0 . 0 : <nl> - version " 2 . 0 . 0 " <nl> - resolved " https : / / registry . yarnpkg . com / abstract - socket / - / abstract - socket - 2 . 0 . 0 . tgz # d83c93e7df30d27e23f3e82a763e7f5e78d916f9 " <nl> - integrity sha1 - 2DyT598w0n4j8 + gqdj5 / XnjZFvk = <nl> + version " 2 . 1 . 0 " <nl> + resolved " https : / / registry . yarnpkg . com / abstract - socket / - / abstract - socket - 2 . 1 . 0 . tgz # a57193dbbf585991b0dc811d7b18e053ff846f8a " <nl> + integrity sha512 - rZ3G6Eqkdi / 9PzYu03Xt1QEZ9aHYTnUpxLyV5EtjM / 06BCDzYORTAfmCRAL6jIj98YqVviKGgt1qXcFUsM4e0w = = <nl> dependencies : <nl> bindings " ^ 1 . 2 . 1 " <nl> - nan " ^ 2 . 0 . 9 " <nl> + nan " ^ 2 . 12 . 1 " <nl> <nl> " abstract - socket @ github : nornagon / node - abstractsocket # v8 - compat " : <nl> - version " 2 . 0 . 0 " <nl> - resolved " https : / / codeload . github . com / nornagon / node - abstractsocket / tar . gz / 7d9c770f9ffef14373349034f8820ff059879845 " <nl> + version " 2 . 1 . 0 " <nl> + resolved " https : / / codeload . github . com / nornagon / node - abstractsocket / tar . gz / 10c40472a0132c14451d1d8e4fdf534b00dc3797 " <nl> dependencies : <nl> bindings " ^ 1 . 2 . 1 " <nl> - nan " ^ 2 . 0 . 9 " <nl> + nan " ^ 2 . 12 . 1 " <nl> <nl> ansi - regex @ ^ 2 . 0 . 0 : <nl> version " 2 . 1 . 1 " <nl> multiparty @ ^ 4 . 2 . 1 : <nl> safe - buffer " 5 . 1 . 2 " <nl> uid - safe " 2 . 1 . 5 " <nl> <nl> - nan @ 2 . x , nan @ ^ 2 . 0 . 9 , nan @ ^ 2 . 2 . 1 : <nl> - version " 2 . 13 . 2 " <nl> - resolved " https : / / registry . yarnpkg . com / nan / - / nan - 2 . 13 . 2 . tgz # f51dc7ae66ba7d5d55e1e6d4d8092e802c9aefe7 " <nl> - integrity sha512 - TghvYc72wlMGMVMluVo9WRJc0mB8KxxF / gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv / lw = = <nl> + nan @ 2 . x , nan @ ^ 2 . 12 . 1 , nan @ ^ 2 . 2 . 1 : <nl> + version " 2 . 14 . 0 " <nl> + resolved " https : / / registry . yarnpkg . com / nan / - / nan - 2 . 14 . 0 . tgz # 7818f722027b2459a86f0295d434d1fc2336c52c " <nl> + integrity sha512 - INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9 + 5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg = = <nl> <nl> nice - try @ ^ 1 . 0 . 4 : <nl> version " 1 . 0 . 5 " <nl> mmm a / vsts - arm - test - steps . yml <nl> ppp b / vsts - arm - test - steps . yml <nl> steps : <nl> timeoutInMinutes : 10 <nl> env : <nl> ELECTRON_DISABLE_SANDBOX : 1 <nl> + ELECTRON_DISABLE_SECURITY_WARNINGS : 1 <nl> <nl> - bash : | <nl> cd src <nl> mmm a / vsts - arm32v7 . yml <nl> ppp b / vsts - arm32v7 . yml <nl> resources : <nl> containers : <nl> - container : arm32v7 - test - container <nl> image : electronbuilds / arm32v7 : 0 . 0 . 2 <nl> + options : - - shm - size 128m <nl> <nl> jobs : <nl> - job : Test_Arm32v7 <nl> mmm a / vsts - arm64v8 . yml <nl> ppp b / vsts - arm64v8 . yml <nl> resources : <nl> containers : <nl> - container : arm64v8 - test - container <nl> image : electronbuilds / arm64v8 : 0 . 0 . 4 <nl> + options : - - shm - size 128m <nl> env : <nl> RUN_NATIVE_MKSNAPSHOT : true <nl> <nl> | chore : bump chromium to f1d9522c04ca8fa0a906f88ababe9 ( master ) ( ) | electron/electron | 50b9c7051ef482bb53ff5227d4e1a94d62442363 | 2019-07-03T01:22:09Z |
mmm a / tensorflow / lite / tools / optimize / operator_property . cc <nl> ppp b / tensorflow / lite / tools / optimize / operator_property . cc <nl> OperatorProperty GetOperatorProperty ( const ModelT * model , int subgraph_index , <nl> property . inputs = { { 0 , { } } , { 1 , { } } } ; <nl> property . outputs = { { 0 , { } } } ; <nl> property . restrict_same_input_output_scale = true ; <nl> + property . restrict_multiple_inputs_scale = true ; <nl> property . version = 2 ; <nl> break ; <nl> case BuiltinOperator_MEAN : <nl> OperatorProperty GetOperatorProperty ( const ModelT * model , int subgraph_index , <nl> property . inputs = { { 0 , { } } , { 1 , { } } } ; <nl> property . outputs = { { 0 , { } } } ; <nl> property . restrict_same_input_output_scale = true ; <nl> + property . restrict_multiple_inputs_scale = true ; <nl> property . version = 2 ; <nl> break ; <nl> case BuiltinOperator_MUL : <nl> mmm a / tensorflow / lite / tools / optimize / operator_property . h <nl> ppp b / tensorflow / lite / tools / optimize / operator_property . h <nl> struct OperatorProperty { <nl> <nl> / / Force output to reuse the same scale and zero point of input . <nl> bool restrict_same_input_output_scale = false ; <nl> + / / In the case of multiple inputs , requantize all inputs to have <nl> + / / the same scale and zero point . <nl> + bool restrict_multiple_inputs_scale = false ; <nl> <nl> / / Use same min of min and max of max for each group . <nl> / / Incompatable with restrict_same_input_output_scale and restricted_value . <nl> mmm a / tensorflow / lite / tools / optimize / quantize_model . cc <nl> ppp b / tensorflow / lite / tools / optimize / quantize_model . cc <nl> TfLiteStatus ApplyConstraints ( ModelT * model , <nl> if ( ! property . quantizable ) { <nl> continue ; <nl> } <nl> - / / Basically only Concat passes this check . <nl> - if ( ! property . arbitrary_inputs | | <nl> + / / Basically only Concat , Max and Min passes this check . <nl> + if ( ( ! property . arbitrary_inputs & & <nl> + ! property . restrict_multiple_inputs_scale ) | | <nl> ! property . restrict_same_input_output_scale ) { <nl> continue ; <nl> } <nl> bool ShouldRestrictSameInputOutputScale ( <nl> operator_property : : OperatorProperty property ) { <nl> / / Ops with multiple inputs ( i . e . concat ) gets restricted in ApplyConstraints . <nl> return ( ! property . arbitrary_inputs & & <nl> - property . restrict_same_input_output_scale ) ; <nl> + property . restrict_same_input_output_scale & & <nl> + ! property . restrict_multiple_inputs_scale ) ; <nl> } <nl> <nl> bool IsSubgraphInput ( SubGraphT * subgraph , int32_t index ) { <nl> mmm a / tensorflow / lite / tools / optimize / quantize_model_test . cc <nl> ppp b / tensorflow / lite / tools / optimize / quantize_model_test . cc <nl> TEST_P ( QuantizeMinimumMaximumTest , VerifyMinimumMaximum ) { <nl> BuiltinOperator_QUANTIZE ) ; <nl> EXPECT_EQ ( model_ . operator_codes [ dequant_idx ] - > builtin_code , <nl> BuiltinOperator_DEQUANTIZE ) ; <nl> - auto op = subgraph - > operators [ 1 ] . get ( ) ; <nl> + const auto & requant1 = subgraph - > operators [ 1 ] . get ( ) ; <nl> + / / Check that we have RE operator . <nl> + auto requant1_builtin_code = model_ . operator_codes [ requant1 - > opcode_index ] . get ( ) - > builtin_code ; <nl> + ASSERT_TRUE ( requant1_builtin_code = = tflite : : BuiltinOperator_QUANTIZE ) ; <nl> + <nl> + const auto & requant2 = subgraph - > operators [ 2 ] . get ( ) ; <nl> + / / Check that we have RE operator . <nl> + auto requant2_builtin_code = model_ . operator_codes [ requant2 - > opcode_index ] . get ( ) - > builtin_code ; <nl> + ASSERT_TRUE ( requant2_builtin_code = = tflite : : BuiltinOperator_QUANTIZE ) ; <nl> + <nl> + const auto & op = subgraph - > operators [ 3 ] . get ( ) ; <nl> <nl> / / Check that we have MINIMUM or MAXIMUM operator . <nl> auto op_builtin_code = model_ . operator_codes [ op - > opcode_index ] . get ( ) - > builtin_code ; <nl> TEST_P ( QuantizeMinimumMaximumTest , VerifyMinimumMaximum ) { <nl> EXPECT_EQ ( output - > quantization - > zero_point , <nl> input2 - > quantization - > zero_point ) ; <nl> <nl> - EXPECT_EQ ( subgraph - > tensors . size ( ) , 5 ) ; <nl> + EXPECT_EQ ( subgraph - > tensors . size ( ) , 7 ) ; <nl> <nl> EXPECT_EQ ( subgraph - > tensors [ 0 ] - > name , " input_int8 " ) ; <nl> EXPECT_EQ ( subgraph - > tensors [ 1 ] - > name , " output_int8 " ) ; <nl> EXPECT_EQ ( subgraph - > tensors [ 2 ] - > name , " output / y " ) ; <nl> - EXPECT_EQ ( subgraph - > tensors [ 3 ] - > name , " input " ) ; <nl> - EXPECT_EQ ( subgraph - > tensors [ 4 ] - > name , " output " ) ; <nl> + EXPECT_EQ ( subgraph - > tensors [ 3 ] - > name , " input_requantized " ) ; <nl> + EXPECT_EQ ( subgraph - > tensors [ 4 ] - > name , " output / y_requantized " ) ; <nl> + EXPECT_EQ ( subgraph - > tensors [ 5 ] - > name , " input " ) ; <nl> + EXPECT_EQ ( subgraph - > tensors [ 6 ] - > name , " output " ) ; <nl> } <nl> INSTANTIATE_TEST_SUITE_P ( MinimumMaximumTestInst , QuantizeMinimumMaximumTest , <nl> testing : : ValuesIn ( { internal : : kModelWithMinimumOp , <nl> | Fix for the bug with maximum / minimum operator . | tensorflow/tensorflow | c966b0ff900a8fe7d2b210e79848e4524a784fee | 2019-11-22T14:19:10Z |
mmm a / tests / test_core . py <nl> ppp b / tests / test_core . py <nl> def test_tracing ( self ) : <nl> <nl> self . do_run_in_out_file_test ( ' tests ' , ' core ' , ' test_tracing ' ) <nl> <nl> + @ no_wasm_backend ( ' EVAL_CTORS does not work with wasm backend ' ) <nl> def test_eval_ctors ( self ) : <nl> - if ' - O2 ' not in str ( self . emcc_args ) or ' - O1 ' in str ( self . emcc_args ) : self . skipTest ( ' need js optimizations ' ) <nl> + if ' - O2 ' not in str ( self . emcc_args ) or ' - O1 ' in str ( self . emcc_args ) : <nl> + self . skipTest ( ' need js optimizations ' ) <nl> <nl> orig_args = self . emcc_args [ : ] + [ ' - s ' , ' EVAL_CTORS = 0 ' ] <nl> <nl> def test_eval_ctors ( self ) : <nl> int main ( ) { } <nl> ' ' ' , " constructing ! \ n " ) ; <nl> <nl> - code_file = ' src . cpp . o . js ' if not self . get_setting ( ' WASM ' ) else ' src . cpp . o . wasm ' <nl> + <nl> + def get_code_size ( ) : <nl> + if self . is_wasm ( ) : <nl> + # Use number of functions as a for code size <nl> + return self . count_wasm_contents ( ' src . cpp . o . wasm ' , ' funcs ' ) <nl> + else : <nl> + return os . path . getsize ( ' src . cpp . o . js ' ) <nl> + <nl> + def get_mem_size ( ) : <nl> + if self . is_wasm ( ) : <nl> + # Use number of functions as a for code size <nl> + return self . count_wasm_contents ( ' src . cpp . o . wasm ' , ' memory - data ' ) <nl> + if self . uses_memory_init_file ( ) : <nl> + return os . path . getsize ( ' src . cpp . o . js . mem ' ) <nl> + <nl> + # otherwise we ignore memory size <nl> + return 0 <nl> <nl> def do_test ( test ) : <nl> self . emcc_args = orig_args + [ ' - s ' , ' EVAL_CTORS = 1 ' ] <nl> test ( ) <nl> - ec_code_size = os . stat ( code_file ) . st_size <nl> - if self . uses_memory_init_file ( ) : <nl> - ec_mem_size = os . stat ( ' src . cpp . o . js . mem ' ) . st_size <nl> + ec_code_size = get_code_size ( ) <nl> + ec_mem_size = get_mem_size ( ) <nl> self . emcc_args = orig_args [ : ] <nl> test ( ) <nl> - code_size = os . stat ( code_file ) . st_size <nl> - if self . uses_memory_init_file ( ) : <nl> - mem_size = os . stat ( ' src . cpp . o . js . mem ' ) . st_size <nl> - # if we are wasm , then the mem init is inside the wasm too , so the total change in code + data may grow * or * shrink <nl> - code_size_should_shrink = not self . is_wasm ( ) <nl> - print ( code_size , ' = > ' , ec_code_size , ' , are we testing code size ? ' , code_size_should_shrink ) <nl> - if self . uses_memory_init_file ( ) : <nl> - print ( mem_size , ' = > ' , ec_mem_size ) <nl> - if code_size_should_shrink : <nl> - assert ec_code_size < code_size <nl> - else : <nl> - assert ec_code_size ! = code_size , ' should at least change ' <nl> - if self . uses_memory_init_file ( ) : <nl> - assert ec_mem_size > mem_size <nl> + code_size = get_code_size ( ) <nl> + mem_size = get_mem_size ( ) <nl> + if mem_size : <nl> + print ( ' mem : ' , mem_size , ' = > ' , ec_mem_size ) <nl> + self . assertGreater ( ec_mem_size , mem_size ) <nl> + print ( ' code : ' , code_size , ' = > ' , ec_code_size ) <nl> + self . assertLess ( ec_code_size , code_size ) <nl> <nl> print ( ' remove ctor of just assigns to memory ' ) <nl> def test1 ( ) : <nl> def test2 ( ) : <nl> self . set_setting ( ' ASSERTIONS ' , 0 ) <nl> <nl> print ( ' remove just some , leave others ' ) <nl> + <nl> def test3 ( ) : <nl> self . do_run ( r ' ' ' <nl> # include < iostream > <nl> mmm a / tests / test_other . py <nl> ppp b / tests / test_other . py <nl> def test_EM_ASM_i64 ( self ) : <nl> self . assertContained ( ' EM_ASM should not receive i64s as inputs , they are not valid in JS ' , err ) <nl> <nl> @ unittest . skipIf ( ' EMCC_DEBUG ' in os . environ , ' cannot run in debug mode ' ) <nl> + @ no_wasm_backend ( ' EVAL_CTORS does not work with wasm backend ' ) <nl> def test_eval_ctors ( self ) : <nl> for wasm in ( 1 , 0 ) : <nl> print ( ' wasm ' , wasm ) <nl> def test_eval_ctors ( self ) : <nl> int main ( ) { } <nl> ' ' ' <nl> open ( ' src . cpp ' , ' w ' ) . write ( src ) <nl> - check_execute ( [ PYTHON , EMCC , ' src . cpp ' , ' - O2 ' , ' - s ' , ' EVAL_CTORS = 1 ' , ' - profiling - funcs ' , ' - s ' , ' WASM = % d ' % wasm ] ) <nl> + run_process ( [ PYTHON , EMCC , ' src . cpp ' , ' - O2 ' , ' - s ' , ' EVAL_CTORS = 1 ' , ' - profiling - funcs ' , ' - s ' , ' WASM = % d ' % wasm ] ) <nl> print ( ' check no ctors is ok ' ) <nl> - check_execute ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . cpp ' ) , ' - Oz ' , ' - s ' , ' WASM = % d ' % wasm ] ) <nl> + run_process ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_world . cpp ' ) , ' - Oz ' , ' - s ' , ' WASM = % d ' % wasm ] ) <nl> self . assertContained ( ' hello , world ! ' , run_js ( ' a . out . js ' ) ) <nl> + <nl> # on by default in - Oz , but user - overridable <nl> def get_size ( args ) : <nl> print ( ' get_size ' , args ) <nl> check_execute ( [ PYTHON , EMCC , path_from_root ( ' tests ' , ' hello_libcxx . cpp ' ) , ' - s ' , ' WASM = % d ' % wasm ] + args ) <nl> self . assertContained ( ' hello , world ! ' , run_js ( ' a . out . js ' ) ) <nl> - if not wasm : <nl> - return ( os . stat ( ' a . out . js ' ) . st_size , os . stat ( ' a . out . js . mem ' ) . st_size ) <nl> + if wasm : <nl> + codesize = self . count_wasm_contents ( ' a . out . wasm ' , ' funcs ' ) <nl> + memsize = self . count_wasm_contents ( ' a . out . wasm ' , ' memory - data ' ) <nl> else : <nl> - return ( os . stat ( ' a . out . js ' ) . st_size , 0 ) # can ' t measure just the mem out of the wasm <nl> + codesize = os . path . getsize ( ' a . out . js ' ) <nl> + memsize = os . path . getsize ( ' a . out . js . mem ' ) <nl> + return ( codesize , memsize ) <nl> + <nl> def check_size ( left , right ) : <nl> # can ' t measure just the mem out of the wasm , so ignore [ 1 ] for wasm <nl> - if left [ 0 ] = = right [ 0 ] and ( wasm or left [ 1 ] = = right [ 1 ] ) : return 0 <nl> - if left [ 0 ] < right [ 0 ] and ( wasm or left [ 1 ] > right [ 1 ] ) : return - 1 # smaller js , bigger mem <nl> - if left [ 0 ] > right [ 0 ] and ( wasm or left [ 1 ] < right [ 1 ] ) : return 1 <nl> + if left [ 0 ] = = right [ 0 ] and left [ 1 ] = = right [ 1 ] : return 0 <nl> + if left [ 0 ] < right [ 0 ] and left [ 1 ] > right [ 1 ] : return - 1 # smaller code , bigger mem <nl> + if left [ 0 ] > right [ 0 ] and left [ 1 ] < right [ 1 ] : return 1 <nl> assert 0 , [ left , right ] <nl> + <nl> o2_size = get_size ( [ ' - O2 ' ] ) <nl> assert check_size ( get_size ( [ ' - O2 ' ] ) , o2_size ) = = 0 , ' deterministic ' <nl> assert check_size ( get_size ( [ ' - O2 ' , ' - s ' , ' EVAL_CTORS = 1 ' ] ) , o2_size ) < 0 , ' eval_ctors works if user asks for it ' <nl> def test ( p1 , p2 , p3 , last , expected ) : <nl> } <nl> ' ' ' % ( p1 , p2 , p3 , last ) <nl> open ( ' src . cpp ' , ' w ' ) . write ( src ) <nl> - check_execute ( [ PYTHON , EMCC , ' src . cpp ' , ' - O2 ' , ' - s ' , ' EVAL_CTORS = 1 ' , ' - profiling - funcs ' , ' - s ' , ' WASM = % d ' % wasm ] ) <nl> + run_process ( [ PYTHON , EMCC , ' src . cpp ' , ' - O2 ' , ' - s ' , ' EVAL_CTORS = 1 ' , ' - profiling - funcs ' , ' - s ' , ' WASM = % d ' % wasm ] ) <nl> self . assertContained ( ' total is % s . ' % hex ( expected ) , run_js ( ' a . out . js ' ) ) <nl> shutil . copyfile ( ' a . out . js ' , ' x ' + hex ( expected ) + ' . js ' ) <nl> - if not wasm : <nl> - return open ( ' a . out . js ' ) . read ( ) . count ( ' function _ ' ) <nl> - else : <nl> + if wasm : <nl> shutil . copyfile ( ' a . out . wasm ' , ' x ' + hex ( expected ) + ' . wasm ' ) <nl> - return self . count_wasm_contents ( ' a . out . wasm ' , ' total ' ) <nl> + return self . count_wasm_contents ( ' a . out . wasm ' , ' funcs ' ) <nl> + else : <nl> + return open ( ' a . out . js ' ) . read ( ) . count ( ' function _ ' ) <nl> print ( ' no bad ctor ' ) <nl> first = test ( 1000 , 2000 , 3000 , 0xe , 0x58e ) <nl> second = test ( 3000 , 1000 , 2000 , 0xe , 0x8e5 ) <nl> mmm a / tools / ports / binaryen . py <nl> ppp b / tools / ports / binaryen . py <nl> <nl> import os , shutil , logging <nl> <nl> - TAG = ' version_49 ' <nl> + TAG = ' version_50 ' <nl> <nl> def needed ( settings , shared , ports ) : <nl> if not settings . WASM : return False <nl> | Cleanup test_eval_ctors ( ) | emscripten-core/emscripten | 7cc6ab3439c67e1d741198b05a4c566d9e3ff71e | 2018-08-08T16:50:11Z |
mmm a / Marlin / Marlin_main . cpp <nl> ppp b / Marlin / Marlin_main . cpp <nl> static const PROGMEM type array # # _P [ 3 ] = \ <nl> static inline type array ( int axis ) \ <nl> { return pgm_read_any ( & array # # _P [ axis ] ) ; } <nl> <nl> - XYZ_CONSTS_FROM_CONFIG ( float , base_min_pos , MIN_POS ) ; <nl> - XYZ_CONSTS_FROM_CONFIG ( float , base_max_pos , MAX_POS ) ; <nl> - XYZ_CONSTS_FROM_CONFIG ( float , base_home_pos , HOME_POS ) ; <nl> - XYZ_CONSTS_FROM_CONFIG ( float , max_length , MAX_LENGTH ) ; <nl> - XYZ_CONSTS_FROM_CONFIG ( float , home_bump_mm , HOME_BUMP_MM ) ; <nl> - XYZ_CONSTS_FROM_CONFIG ( signed char , home_dir , HOME_DIR ) ; <nl> + XYZ_CONSTS_FROM_CONFIG ( float , base_min_pos , MIN_POS ) ; <nl> + XYZ_CONSTS_FROM_CONFIG ( float , base_max_pos , MAX_POS ) ; <nl> + XYZ_CONSTS_FROM_CONFIG ( float , base_home_pos , HOME_POS ) ; <nl> + XYZ_CONSTS_FROM_CONFIG ( float , max_length , MAX_LENGTH ) ; <nl> + XYZ_CONSTS_FROM_CONFIG ( float , home_bump_mm , HOME_BUMP_MM ) ; <nl> + XYZ_CONSTS_FROM_CONFIG ( signed char , home_dir , HOME_DIR ) ; <nl> <nl> # ifdef DUAL_X_CARRIAGE <nl> <nl> | Spacing in XYZ_CONSTS | MarlinFirmware/Marlin | 17ad80c1e10254434323cb983862108bce33ca08 | 2015-04-14T00:58:47Z |
new file mode 100644 <nl> index 000000000000 . . 867c082dff0c <nl> mmm / dev / null <nl> ppp b / docs / api / process - stats . md <nl> <nl> + # processStats <nl> + <nl> + > Collect memory statistics about the system as well as the current process ( either <nl> + > the main process or any renderer process ) <nl> + <nl> + ` ` ` js <nl> + import { processStats } from ' electron ' ; <nl> + <nl> + processStats . getProcessMemoryInfo ( ) ; <nl> + > > > Object { workingSetSize : 86052 , peakWorkingSetSize : 92244 , privateBytes : 25932 , sharedBytes : 60248 } <nl> + ` ` ` <nl> + <nl> + # # Methods <nl> + <nl> + The processStats has the following methods : <nl> + <nl> + # # # getProcessMemoryInfo ( ) <nl> + <nl> + Return an object giving memory usage statistics about the current process . Note that <nl> + all statistics are reported in Kilobytes . <nl> + <nl> + * ` workingSetSize ` - The amount of memory currently pinned to actual physical RAM <nl> + * ` peakWorkingSetSize ` - The maximum amount of memory that has ever been pinned to actual physical RAM <nl> + * ` privateBytes ` - The amount of memory not shared by other processes , such as JS heap or HTML content . <nl> + * ` sharedBytes ` - The amount of memory shared between processes , typically memory consumed by the Electron code itself <nl> + <nl> + # # # getSystemMemoryInfo ( ) <nl> + <nl> + Return an object giving memory usage statistics about the entire system . Note that <nl> + all statistics are reported in Kilobytes . <nl> + <nl> + * ` total ` - The total amount of physical memory in Kilobytes available to the system <nl> + * ` free ` - The total amount of memory not being used by applications or disk cache <nl> + <nl> + On Windows / Linux : <nl> + <nl> + * ` swapTotal ` - The total amount of swap memory in Kilobytes available to the system <nl> + * ` swapFree ` - The free amount of swap memory in Kilobytes available to the system <nl> | Add docs | electron/electron | b51be9b83f9cc84514b4849181ec3b1d4fa0c749 | 2016-05-17T21:47:56Z |
mmm a / src / Storages / MergeTree / ReplicatedMergeTreeQueue . h <nl> ppp b / src / Storages / MergeTree / ReplicatedMergeTreeQueue . h <nl> class ReplicatedMergeTreeQueue <nl> <nl> / / / Return empty optional if mutation was killed . Otherwise return partially <nl> / / / filled mutation status with information about error ( latest_fail * ) and <nl> - / / / is_done . mutation_ids filled with all mutations with same errors , because <nl> - / / / they may be executed simultaneously as one mutation . <nl> + / / / is_done . mutation_ids filled with all mutations with same errors , <nl> + / / / because they may be executed simultaneously as one mutation . Order is <nl> + / / / important for better readability of exception message . If mutation was <nl> + / / / killed doesn ' t return any ids . <nl> std : : optional < MergeTreeMutationStatus > getIncompleteMutationsStatus ( const String & znode_name , std : : set < String > * mutation_ids = nullptr ) const ; <nl> <nl> std : : vector < MergeTreeMutationStatus > getMutationsStatus ( ) const ; <nl> mmm a / src / Storages / StorageMergeTree . cpp <nl> ppp b / src / Storages / StorageMergeTree . cpp <nl> void StorageMergeTree : : waitForMutation ( Int64 version , const String & file_name ) <nl> mutation_wait_event . wait ( lock , check ) ; <nl> } <nl> <nl> + / / / At least we have our current mutation <nl> std : : set < String > mutation_ids ; <nl> mutation_ids . insert ( file_name ) ; <nl> + <nl> auto mutation_status = getIncompleteMutationsStatus ( version , & mutation_ids ) ; <nl> checkMutationStatus ( mutation_status , mutation_ids ) ; <nl> <nl> mmm a / src / Storages / StorageMergeTree . h <nl> ppp b / src / Storages / StorageMergeTree . h <nl> class StorageMergeTree final : public ext : : shared_ptr_helper < StorageMergeTree > , <nl> <nl> / / / Return empty optional if mutation was killed . Otherwise return partially <nl> / / / filled mutation status with information about error ( latest_fail * ) and <nl> - / / / is_done . mutation_ids filled with mutations with the same errors , because we <nl> - / / / can execute several mutations at once <nl> + / / / is_done . mutation_ids filled with mutations with the same errors , <nl> + / / / because we can execute several mutations at once . Order is important for <nl> + / / / better readability of exception message . If mutation was killed doesn ' t <nl> + / / / return any ids . <nl> std : : optional < MergeTreeMutationStatus > getIncompleteMutationsStatus ( Int64 mutation_version , std : : set < String > * mutation_ids = nullptr ) const ; <nl> <nl> void startBackgroundMovesIfNeeded ( ) override ; <nl> mmm a / src / Storages / StorageReplicatedMergeTree . cpp <nl> ppp b / src / Storages / StorageReplicatedMergeTree . cpp <nl> void StorageReplicatedMergeTree : : waitMutationToFinishOnReplicas ( <nl> throw Exception ( ErrorCodes : : UNFINISHED , " Mutation { } was killed , manually removed or table was dropped " , mutation_id ) ; <nl> } <nl> <nl> + / / / At least we have our current mutation <nl> std : : set < String > mutation_ids ; <nl> mutation_ids . insert ( mutation_id ) ; <nl> <nl> | Better comments | ClickHouse/ClickHouse | 45894fcf99446d449286e10d109c345b72406a75 | 2020-07-31T12:22:32Z |
mmm a / stdlib / public / runtime / Heap . cpp <nl> ppp b / stdlib / public / runtime / Heap . cpp <nl> <nl> # include " . . / SwiftShims / RuntimeShims . h " <nl> # include < algorithm > <nl> # include < stdlib . h > <nl> + # if defined ( __APPLE__ ) <nl> + # include " swift / Basic / Lazy . h " <nl> + # include < malloc / malloc . h > <nl> + # endif <nl> <nl> using namespace swift ; <nl> <nl> using namespace swift ; <nl> static_assert ( _swift_MinAllocationAlignment > MALLOC_ALIGN_MASK , <nl> " Swift ' s default alignment must exceed platform malloc mask . " ) ; <nl> <nl> + # if defined ( __APPLE__ ) <nl> + static inline malloc_zone_t * DEFAULT_ZONE ( ) { <nl> + static malloc_zone_t * z = SWIFT_LAZY_CONSTANT ( malloc_default_zone ( ) ) ; <nl> + return z ; <nl> + } <nl> + # endif <nl> + <nl> / / When alignMask = = ~ ( size_t ( 0 ) ) , allocation uses the " default " <nl> / / _swift_MinAllocationAlignment . This is different than calling swift_slowAlloc <nl> / / with ` alignMask = = _swift_MinAllocationAlignment - 1 ` because it forces <nl> void * swift : : swift_slowAlloc ( size_t size , size_t alignMask ) { <nl> void * p ; <nl> / / This check also forces " default " alignment to use AlignedAlloc . <nl> if ( alignMask < = MALLOC_ALIGN_MASK ) { <nl> + # if defined ( __APPLE__ ) <nl> + p = malloc_zone_malloc ( DEFAULT_ZONE ( ) , size ) ; <nl> + # else <nl> p = malloc ( size ) ; <nl> + # endif <nl> } else { <nl> size_t alignment = ( alignMask = = ~ ( size_t ( 0 ) ) ) <nl> ? _swift_MinAllocationAlignment <nl> void * swift : : swift_slowAlloc ( size_t size , size_t alignMask ) { <nl> / / consistent with allocation with the same alignment . <nl> void swift : : swift_slowDealloc ( void * ptr , size_t bytes , size_t alignMask ) { <nl> if ( alignMask < = MALLOC_ALIGN_MASK ) { <nl> + # if defined ( __APPLE__ ) <nl> + malloc_zone_free ( DEFAULT_ZONE ( ) , ptr ) ; <nl> + # else <nl> free ( ptr ) ; <nl> + # endif <nl> } else { <nl> AlignedFree ( ptr ) ; <nl> } <nl> | Merge remote - tracking branch ' origin / master ' into master - next | apple/swift | c33fbd2f65af6f2515800f5c00652863ff5ebfc8 | 2020-02-21T02:26:28Z |
mmm a / Code / CryEngine / RenderDll / Common / Shaders / ShaderResources . cpp <nl> ppp b / Code / CryEngine / RenderDll / Common / Shaders / ShaderResources . cpp <nl> void CShaderResources : : RT_UpdateConstants ( IShader * pISH ) <nl> Vec4 deformWave ( 0 , 0 , 0 , 1 ) ; <nl> if ( m_pDeformInfo & & m_pDeformInfo - > m_fDividerX ! = 0 ) <nl> { <nl> - deformWave . x = gcpRendD3D - > m_RP . m_TI [ gcpRendD3D - > m_RP . m_nProcessThreadID ] . m_RealTime * m_pDeformInfo - > m_WaveX . m_Freq + m_pDeformInfo - > m_WaveX . m_Phase ; <nl> + deformWave . x = m_pDeformInfo - > m_WaveX . m_Freq + m_pDeformInfo - > m_WaveX . m_Phase ; <nl> deformWave . y = m_pDeformInfo - > m_WaveX . m_Amp ; <nl> deformWave . z = m_pDeformInfo - > m_WaveX . m_Level ; <nl> deformWave . w = 1 . 0f / m_pDeformInfo - > m_fDividerX ; <nl> mmm a / Engine / Shaders / HWScripts / CryFX / ModificatorVT . cfi <nl> ppp b / Engine / Shaders / HWScripts / CryFX / ModificatorVT . cfi <nl> void pos_wind_General ( inout float4 InPos , float3 vNorm , float4 cVtxColors , strea <nl> <nl> void _VTModify ( inout float4 inPos , float3 vNorm , float4x4 InstMatrix , streamPos IN , bool bRelativeToCam , int nType ) <nl> { <nl> - / / CM_DeformWave : . x = time * Freq + Phase ; . y = Amp ; . z = Level ; . w = VertDivider <nl> + / / CM_DeformWave : . x = time * Freq + Phase ; . y = Amp ; . z = Level ; . w = VertDivider <nl> <nl> + const half fTime = g_VS_AnimGenParams . z ; <nl> float4 vTC = 0 ; <nl> # if ! % TEMP_TERRAIN <nl> vTC = IN . baseTC ; <nl> void _VTModify ( inout float4 inPos , float3 vNorm , float4x4 InstMatrix , streamPos <nl> if ( nType = = VTM_SINWAVE ) <nl> { <nl> float f = ( inPos . x + inPos . y + inPos . z ) * CM_DeformWave . w ; <nl> - f = ( f + CM_DeformWave . x ) * 3 . 1415926 ; <nl> + f = ( f + CM_DeformWave . x * fTime ) * 3 . 1415926 ; <nl> float fWave = sin ( f ) * CM_DeformWave . y + CM_DeformWave . z ; <nl> inPos . xyz + = vNorm . xyz * fWave ; <nl> } <nl> else <nl> if ( nType = = VTM_SINWAVE_VTXCOL ) <nl> { <nl> - float f = ( inPos . x + inPos . y + inPos . z ) * CM_DeformWave . w * IN . Color . y ; <nl> - f = ( f + CM_DeformWave . x + IN . Color . x ) * 3 . 1415926 ; <nl> + float f = ( inPos . x + inPos . y + inPos . z ) * CM_DeformWave . w * IN . Color . y ; <nl> + f = ( f + ( CM_DeformWave . x * fTime ) + IN . Color . x ) * 3 . 1415926 ; <nl> float fWave = sin ( f ) * CM_DeformWave . y + CM_DeformWave . z ; <nl> inPos . xyz + = vNorm . xyz * fWave * IN . Color . z ; <nl> } <nl> else <nl> if ( nType = = VTM_SQUEEZE ) <nl> { <nl> - float f = CM_DeformWave . x * 3 . 1415926 ; <nl> + float f = ( CM_DeformWave . x * fTime ) * 3 . 1415926 ; <nl> float fWave = sin ( f ) * CM_DeformWave . y + CM_DeformWave . z ; <nl> inPos . xyz + = vNorm . xyz * fWave ; <nl> } <nl> void _VTModify ( inout float4 inPos , float3 vNorm , float4x4 InstMatrix , streamPos <nl> if ( nType = = VTM_BULGE ) <nl> { <nl> float f = ( vTC . x + vTC . y + inPos . x + inPos . y + inPos . z ) * CM_DeformWave . w ; <nl> - f = ( f + CM_DeformWave . x ) * 3 . 1415926 ; <nl> + f = ( f + CM_DeformWave . x * fTime ) * 3 . 1415926 ; <nl> float fWave = sin ( f ) * CM_DeformWave . y + CM_DeformWave . z ; <nl> inPos . xyz + = vNorm . xyz * fWave ; <nl> } <nl> | ! B ( Renderer ) Fixed vertex modificators in graphics pipeline 2 ( Approved by nicolas ) | CRYTEK/CRYENGINE | 114805e6b35278a3dd44008ea28e30d052b563b3 | 2016-04-18T11:35:22Z |
new file mode 100644 <nl> index 0000000000 . . d8445c457e <nl> mmm / dev / null <nl> ppp b / change / @ office - iss - react - native - win32 - 2020 - 08 - 13 - 16 - 08 - 48 - master . json <nl> <nl> + { <nl> + " type " : " prerelease " , <nl> + " comment " : " Integrate 5 / 4 nightly build . " , <nl> + " packageName " : " @ office - iss / react - native - win32 " , <nl> + " email " : " igklemen @ microsoft . com " , <nl> + " dependentChangeType " : " patch " , <nl> + " date " : " 2020 - 08 - 13T23 : 08 : 28 . 686Z " <nl> + } <nl> new file mode 100644 <nl> index 0000000000 . . ef73a9cfbc <nl> mmm / dev / null <nl> ppp b / change / react - native - windows - 2020 - 08 - 13 - 16 - 08 - 48 - master . json <nl> <nl> + { <nl> + " type " : " prerelease " , <nl> + " comment " : " Integrate 5 / 4 nightly build . " , <nl> + " packageName " : " react - native - windows " , <nl> + " email " : " igklemen @ microsoft . com " , <nl> + " dependentChangeType " : " patch " , <nl> + " date " : " 2020 - 08 - 13T23 : 08 : 48 . 555Z " <nl> + } <nl> mmm a / packages / E2ETest / package . json <nl> ppp b / packages / E2ETest / package . json <nl> <nl> " dependencies " : { <nl> " prompt - sync " : " ^ 4 . 2 . 0 " , <nl> " react " : " 16 . 13 . 1 " , <nl> - " react - native " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " react - native " : " 0 . 0 . 0 - 30a89f30c " , <nl> " react - native - windows " : " 0 . 0 . 0 - canary . 140 " <nl> } , <nl> " devDependencies " : { <nl> mmm a / packages / microsoft - reactnative - sampleapps / package . json <nl> ppp b / packages / microsoft - reactnative - sampleapps / package . json <nl> <nl> } , <nl> " dependencies " : { <nl> " react " : " 16 . 13 . 1 " , <nl> - " react - native " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " react - native " : " 0 . 0 . 0 - 30a89f30c " , <nl> " react - native - windows " : " 0 . 0 . 0 - canary . 140 " <nl> } , <nl> " devDependencies " : { <nl> mmm a / packages / playground / package . json <nl> ppp b / packages / playground / package . json <nl> <nl> } , <nl> " dependencies " : { <nl> " react " : " 16 . 13 . 1 " , <nl> - " react - native " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " react - native " : " 0 . 0 . 0 - 30a89f30c " , <nl> " react - native - windows " : " 0 . 0 . 0 - canary . 140 " <nl> } , <nl> " devDependencies " : { <nl> mmm a / packages / react - native - win32 / overrides . json <nl> ppp b / packages / react - native - win32 / overrides . json <nl> <nl> " type " : " derived " , <nl> " file " : " . flowconfig " , <nl> " baseFile " : " . flowconfig " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 3210a076de8ff5c698de48d8af444b2677270ca6 " <nl> } , <nl> { <nl> " type " : " derived " , <nl> " file " : " src / index . win32 . js " , <nl> " baseFile " : " index . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 27967b6f36e9bc2bc3f4ac79c1320b7152d93f83 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / Libraries / Alert / Alert . win32 . js " , <nl> " baseFile " : " Libraries / Alert / Alert . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " b4867752830f6953516c5898a7e2fc0dc796dcfa " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " derived " , <nl> " file " : " src / Libraries / Components / AccessibilityInfo / AccessibilityInfo . win32 . js " , <nl> " baseFile " : " Libraries / Components / AccessibilityInfo / AccessibilityInfo . android . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 611e89285ac812456b381568052cf575c955575a " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / Libraries / Components / AccessibilityInfo / NativeAccessibilityInfo . win32 . js " , <nl> " baseFile " : " Libraries / Components / AccessibilityInfo / NativeAccessibilityInfo . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " b3e2c37d96de6f00066495267f7c32d6e9d3f840 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " copy " , <nl> " file " : " src / Libraries / Components / DatePicker / DatePickerIOS . win32 . js " , <nl> " baseFile " : " Libraries / Components / DatePicker / DatePickerIOS . android . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 218895e2a5f3d7614a2cb577da187800857850ea " , <nl> " issue " : 4378 <nl> } , <nl> <nl> " type " : " copy " , <nl> " file " : " src / Libraries / Components / DatePickerAndroid / DatePickerAndroid . win32 . js " , <nl> " baseFile " : " Libraries / Components / DatePickerAndroid / DatePickerAndroid . ios . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 09d82215c57ca5873a53523a63006daebf07ffbc " , <nl> " issue " : 4378 <nl> } , <nl> <nl> " type " : " copy " , <nl> " file " : " src / Libraries / Components / DrawerAndroid / DrawerLayoutAndroid . js " , <nl> " baseFile " : " Libraries / Components / DrawerAndroid / DrawerLayoutAndroid . ios . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " e5bb18f4dc9ddbf96ab9b83cfc21b1c0495ac59a " , <nl> " issue " : 4378 <nl> } , <nl> <nl> " type " : " copy " , <nl> " file " : " src / Libraries / Components / MaskedView / MaskedViewIOS . win32 . js " , <nl> " baseFile " : " Libraries / Components / MaskedView / MaskedViewIOS . android . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 0b409391c852a1001cee74a84414a13c4fe88f8b " , <nl> " issue " : 4378 <nl> } , <nl> <nl> " type " : " copy " , <nl> " file " : " src / Libraries / Components / Picker / PickerAndroid . js " , <nl> " baseFile " : " Libraries / Components / Picker / PickerAndroid . ios . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " e5bb18f4dc9ddbf96ab9b83cfc21b1c0495ac59a " , <nl> " issue " : 4378 <nl> } , <nl> <nl> " type " : " copy " , <nl> " file " : " src / Libraries / Components / Picker / PickerIOS . js " , <nl> " baseFile " : " Libraries / Components / Picker / PickerIOS . android . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 0c6bf0751e053672123cbad30d67851ba0007af6 " , <nl> " issue " : 4378 <nl> } , <nl> <nl> " type " : " copy " , <nl> " file " : " src / Libraries / Components / ProgressBarAndroid / ProgressBarAndroid . js " , <nl> " baseFile " : " Libraries / Components / ProgressBarAndroid / ProgressBarAndroid . ios . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " e5bb18f4dc9ddbf96ab9b83cfc21b1c0495ac59a " , <nl> " issue " : 4378 <nl> } , <nl> <nl> " type " : " derived " , <nl> " file " : " src / Libraries / Components / ProgressViewIOS / ProgressViewIOS . win32 . js " , <nl> " baseFile " : " Libraries / Components / ProgressViewIOS / ProgressViewIOS . android . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " f0b35fdee6b1c9e7bfe860a9e0aefc00337ea7fd " <nl> } , <nl> { <nl> " type " : " patch " , <nl> " file " : " src / Libraries / Components / SafeAreaView / SafeAreaView . win32 . js " , <nl> " baseFile " : " Libraries / Components / SafeAreaView / SafeAreaView . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 59dabb86baedb0088e110f8cdeb914fa3271dfd9 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " copy " , <nl> " file " : " src / Libraries / Components / SegmentedControlIOS / SegmentedControlIOS . js " , <nl> " baseFile " : " Libraries / Components / SegmentedControlIOS / SegmentedControlIOS . android . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 37cea8b532ea4e4335120c6f8b2d3d3548e31b18 " , <nl> " issue " : 4378 <nl> } , <nl> <nl> " type " : " derived " , <nl> " file " : " src / Libraries / Components / TextInput / TextInput . win32 . tsx " , <nl> " baseFile " : " Libraries / Components / TextInput / TextInput . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 9d9e65ecd506387e98d0ef5a58321c568a95ad41 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / Libraries / Components / TextInput / TextInputState . win32 . js " , <nl> " baseFile " : " Libraries / Components / TextInput / TextInputState . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " e982deb23d7ad5312ab0c09508a6d58c152b5be7 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " copy " , <nl> " file " : " src / Libraries / Components / ToastAndroid / ToastAndroid . win32 . js " , <nl> " baseFile " : " Libraries / Components / ToastAndroid / ToastAndroid . ios . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 614b7e88c38f5820656c79d64239bfb74ca308c0 " , <nl> " issue " : 4378 <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / Libraries / Components / View / ReactNativeViewAttributes . win32 . js " , <nl> " baseFile " : " Libraries / Components / View / ReactNativeViewAttributes . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 0825b0257e19cfef2d626f19d219256a01c54b67 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / Libraries / Components / View / ReactNativeViewViewConfig . win32 . js " , <nl> " baseFile " : " Libraries / Components / View / ReactNativeViewViewConfig . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 8d5d480284b4cdaf7d8d86935967370d455b7b68 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / Libraries / core / ReactNativeVersionCheck . win32 . js " , <nl> " baseFile " : " Libraries / core / ReactNativeVersionCheck . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 599ad6d6c8485cd453cd926cdf89f06640d439f6 " , <nl> " issue " : 5170 <nl> } , <nl> <nl> " type " : " derived " , <nl> " file " : " src / Libraries / Image / Image . win32 . js " , <nl> " baseFile " : " Libraries / Image / Image . ios . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 26acff268b815c7b3c5da0d6c9c009073b202ea8 " , <nl> " issue " : 4320 <nl> } , <nl> <nl> " type " : " derived " , <nl> " file " : " src / Libraries / Image / NativeImageLoaderWin32 . js " , <nl> " baseFile " : " Libraries / Image / NativeImageLoaderIOS . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 6161ce89a0b45b24e8df69aa108af22a7b591483 " , <nl> " issue " : 4320 <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / Libraries / Inspector / Inspector . win32 . js " , <nl> " baseFile " : " Libraries / Inspector / Inspector . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 60aa482532caac00745f8ae8611a36c756fb5b75 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / Libraries / Inspector / InspectorOverlay . win32 . js " , <nl> " baseFile " : " Libraries / Inspector / InspectorOverlay . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 31687eefb91682d95abba47f8288f7c42158706e " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " derived " , <nl> " file " : " src / Libraries / Network / RCTNetworking . win32 . js " , <nl> " baseFile " : " Libraries / Network / RCTNetworking . android . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 9ba4db01878648ef181dfd51debd821a837f56b3 " , <nl> " issue " : 4318 <nl> } , <nl> <nl> " type " : " derived " , <nl> " file " : " src / Libraries / Settings / Settings . win32 . js " , <nl> " baseFile " : " Libraries / Settings / Settings . android . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 00604dd0ab624b3f5b80d460f48dbc3ac7ee905d " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / Libraries / StyleSheet / StyleSheet . win32 . js " , <nl> " baseFile " : " Libraries / StyleSheet / StyleSheet . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 95ed8a2da162e168c7d740640a9d6c0fdb282c84 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / Libraries / StyleSheet / StyleSheetValidation . win32 . js " , <nl> " baseFile " : " Libraries / StyleSheet / StyleSheetValidation . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 5fe7febd1eb5374745fe612030806512e9161796 " , <nl> " issue " : 5269 <nl> } , <nl> <nl> " type " : " derived " , <nl> " file " : " src / Libraries / Utilities / BackHandler . win32 . ts " , <nl> " baseFile " : " Libraries / Utilities / BackHandler . android . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 2fbb5d988289f3678809dd440b15828df1bae56d " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " derived " , <nl> " file " : " src / Libraries / Utilities / DeviceInfo . win32 . js " , <nl> " baseFile " : " Libraries / Utilities / DeviceInfo . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 19aa984db7404750d8b86ad1359057dfe8912b24 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " derived " , <nl> " file " : " src / Libraries / Utilities / Dimensions . win32 . js " , <nl> " baseFile " : " Libraries / Utilities / Dimensions . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 6a61022dbe92a0683a82669ace739fc7ca110c7d " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " derived " , <nl> " file " : " src / Libraries / Utilities / NativePlatformConstantsWin . js " , <nl> " baseFile " : " Libraries / Utilities / NativePlatformConstantsIOS . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 168fe4a9608c0b151237122eea94d78f7b0093e5 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " derived " , <nl> " file " : " src / Libraries / Utilities / Platform . win32 . js " , <nl> " baseFile " : " Libraries / Utilities / Platform . android . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " bcaebbe089a41de46724b00e69fcdba7e6b1ed7f " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / RNTester / js / components / ListExampleShared . win32 . js " , <nl> " baseFile " : " RNTester / js / components / ListExampleShared . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " d7be07e3fd8d9c1df8e23d5674ce3eb067d00865 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / RNTester / js / components / RNTesterExampleFilter . win32 . js " , <nl> " baseFile " : " RNTester / js / components / RNTesterExampleFilter . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 8a8182f7c36e8184b7bbfe1445263ceca622b2c1 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " derived " , <nl> " file " : " src / RNTester / js / RNTesterApp . win32 . js " , <nl> " baseFile " : " RNTester / js / RNTesterApp . ios . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 34d2517461704840a508ce1856bc3a364fb3fc7e " , <nl> " issue " : 4586 <nl> } , <nl> <nl> " type " : " derived " , <nl> " file " : " src / RNTester / js / utils / RNTesterList . win32 . js " , <nl> " baseFile " : " RNTester / js / utils / RNTesterList . android . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 20a6f5c42266beb017dccc7f22d45bde02907d89 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> mmm a / packages / react - native - win32 / package . json <nl> ppp b / packages / react - native - win32 / package . json <nl> <nl> " babel - eslint " : " 10 . 0 . 1 " , <nl> " eslint " : " 6 . 7 . 0 " , <nl> " flow - bin " : " ^ 0 . 123 . 0 " , <nl> - " jscodeshift " : " ^ 0 . 7 . 0 " , <nl> + " jscodeshift " : " ^ 0 . 9 . 0 " , <nl> " just - scripts " : " ^ 0 . 36 . 1 " , <nl> " react " : " 16 . 13 . 1 " , <nl> - " react - native " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " react - native " : " 0 . 0 . 0 - 30a89f30c " , <nl> " react - native - platform - override " : " ^ 0 . 2 . 1 " , <nl> " typescript " : " ^ 3 . 8 . 3 " <nl> } , <nl> " peerDependencies " : { <nl> " react " : " 16 . 13 . 1 " , <nl> - " react - native " : " 0 . 0 . 0 - d8e6c4578 " <nl> + " react - native " : " 0 . 0 . 0 - 30a89f30c " <nl> } , <nl> " beachball " : { <nl> " defaultNpmTag " : " canary " , <nl> mmm a / vnext / . flowconfig <nl> ppp b / vnext / . flowconfig <nl> <nl> < PROJECT_ROOT > / Libraries / Components / View / ViewPropTypes . js <nl> < PROJECT_ROOT > / Libraries / DeprecatedPropTypes / DeprecatedViewAccessibility . js <nl> < PROJECT_ROOT > / Libraries / Image / Image . js <nl> - < PROJECT_ROOT > / Libraries / Lists / VirtualizedList . js <nl> < PROJECT_ROOT > / Libraries / Network / RCTNetworking . js <nl> < PROJECT_ROOT > / Libraries / NewAppScreen / components / DebugInstructions . js <nl> < PROJECT_ROOT > / Libraries / NewAppScreen / components / ReloadInstructions . js <nl> deleted file mode 100644 <nl> index 67c4a61c90 . . 0000000000 <nl> mmm a / vnext / DeforkingPatches / ReactCommon / turbomodule / samples / SampleTurboCxxModule . cpp <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( c ) Facebook , Inc . and its affiliates . <nl> - * <nl> - * This source code is licensed under the MIT license found in the <nl> - * LICENSE file in the root directory of this source tree . <nl> - * / <nl> - <nl> - # include " SampleTurboCxxModule . h " <nl> - <nl> - # include < ReactCommon / TurboModuleUtils . h > <nl> - <nl> - using namespace facebook ; <nl> - <nl> - namespace facebook { <nl> - namespace react { <nl> - <nl> - SampleTurboCxxModule : : SampleTurboCxxModule ( <nl> - std : : shared_ptr < CallInvoker > callInvoker ) <nl> - : NativeSampleTurboCxxModuleSpecJSI ( callInvoker ) { } <nl> - <nl> - void SampleTurboCxxModule : : voidFunc ( jsi : : Runtime & rt ) { <nl> - / / Nothing to do <nl> - } <nl> - <nl> - bool SampleTurboCxxModule : : getBool ( jsi : : Runtime & rt , bool arg ) { <nl> - return arg ; <nl> - } <nl> - <nl> - double SampleTurboCxxModule : : getNumber ( jsi : : Runtime & rt , double arg ) { <nl> - return arg ; <nl> - } <nl> - <nl> - jsi : : String SampleTurboCxxModule : : getString ( <nl> - jsi : : Runtime & rt , <nl> - const jsi : : String & arg ) { <nl> - return jsi : : String : : createFromUtf8 ( rt , arg . utf8 ( rt ) ) ; <nl> - } <nl> - <nl> - jsi : : Array SampleTurboCxxModule : : getArray ( <nl> - jsi : : Runtime & rt , <nl> - const jsi : : Array & arg ) { <nl> - return deepCopyJSIArray ( rt , arg ) ; <nl> - } <nl> - <nl> - jsi : : Object SampleTurboCxxModule : : getObject ( <nl> - jsi : : Runtime & rt , <nl> - const jsi : : Object & arg ) { <nl> - return deepCopyJSIObject ( rt , arg ) ; <nl> - } <nl> - <nl> - jsi : : Object SampleTurboCxxModule : : getValue ( <nl> - jsi : : Runtime & rt , <nl> - double x , <nl> - const jsi : : String & y , <nl> - const jsi : : Object & z ) { <nl> - / / Note : return type isn ' t type - safe . <nl> - jsi : : Object result ( rt ) ; <nl> - result . setProperty ( rt , " x " , jsi : : Value ( x ) ) ; <nl> - result . setProperty ( rt , " y " , jsi : : String : : createFromUtf8 ( rt , y . utf8 ( rt ) ) ) ; <nl> - result . setProperty ( rt , " z " , deepCopyJSIObject ( rt , z ) ) ; <nl> - return result ; <nl> - } <nl> - <nl> - void SampleTurboCxxModule : : getValueWithCallback ( <nl> - jsi : : Runtime & rt , <nl> - const jsi : : Function & callback ) { <nl> - callback . call ( rt , jsi : : String : : createFromUtf8 ( rt , " value from callback ! " ) ) ; <nl> - } <nl> - <nl> - jsi : : Value SampleTurboCxxModule : : getValueWithPromise ( <nl> - jsi : : Runtime & rt , <nl> - bool error ) { <nl> - return createPromiseAsJSIValue ( <nl> - rt , [ error ] ( jsi : : Runtime & rt2 , std : : shared_ptr < Promise > promise ) { <nl> - if ( error ) { <nl> - promise - > reject ( " intentional promise rejection " ) ; <nl> - } else { <nl> - promise - > resolve ( jsi : : String : : createFromUtf8 ( rt2 , " result ! " ) ) ; <nl> - } <nl> - } ) ; <nl> - } <nl> - <nl> - jsi : : Object SampleTurboCxxModule : : getConstants ( jsi : : Runtime & rt ) { <nl> - / / Note : return type isn ' t type - safe . <nl> - jsi : : Object result ( rt ) ; <nl> - result . setProperty ( rt , " const1 " , jsi : : Value ( true ) ) ; <nl> - result . setProperty ( rt , " const2 " , jsi : : Value ( 375 ) ) ; <nl> - result . setProperty ( <nl> - rt , " const3 " , jsi : : String : : createFromUtf8 ( rt , " something " ) ) ; <nl> - return result ; <nl> - } <nl> - <nl> - } / / namespace react <nl> - } / / namespace facebook <nl> deleted file mode 100644 <nl> index 6109c929f4 . . 0000000000 <nl> mmm a / vnext / DeforkingPatches / ReactCommon / turbomodule / samples / SampleTurboCxxModule . h <nl> ppp / dev / null <nl> <nl> - / * <nl> - * Copyright ( c ) Facebook , Inc . and its affiliates . <nl> - * <nl> - * This source code is licensed under the MIT license found in the <nl> - * LICENSE file in the root directory of this source tree . <nl> - * / <nl> - <nl> - # pragma once <nl> - <nl> - # include < memory > <nl> - <nl> - # include " NativeSampleTurboCxxModuleSpecJSI . h " <nl> - <nl> - namespace facebook { <nl> - namespace react { <nl> - <nl> - / * * <nl> - * A sample implementation of the C + + spec . In practice , this class can just <nl> - * extend jsi : : HostObject directly , but using the spec provides build - time <nl> - * type - safety . <nl> - * / <nl> - class SampleTurboCxxModule : public NativeSampleTurboCxxModuleSpecJSI { <nl> - public : <nl> - SampleTurboCxxModule ( std : : shared_ptr < CallInvoker > callInvoker ) ; <nl> - <nl> - void voidFunc ( jsi : : Runtime & rt ) override ; <nl> - bool getBool ( jsi : : Runtime & rt , bool arg ) override ; <nl> - double getNumber ( jsi : : Runtime & rt , double arg ) override ; <nl> - jsi : : String getString ( jsi : : Runtime & rt , const jsi : : String & arg ) override ; <nl> - jsi : : Array getArray ( jsi : : Runtime & rt , const jsi : : Array & arg ) override ; <nl> - jsi : : Object getObject ( jsi : : Runtime & rt , const jsi : : Object & arg ) override ; <nl> - jsi : : Object getValue ( <nl> - jsi : : Runtime & rt , <nl> - double x , <nl> - const jsi : : String & y , <nl> - const jsi : : Object & z ) override ; <nl> - void getValueWithCallback ( jsi : : Runtime & rt , const jsi : : Function & callback ) <nl> - override ; <nl> - jsi : : Value getValueWithPromise ( jsi : : Runtime & rt , bool error ) override ; <nl> - jsi : : Object getConstants ( jsi : : Runtime & rt ) override ; <nl> - } ; <nl> - <nl> - } / / namespace react <nl> - } / / namespace facebook <nl> mmm a / vnext / ReactCopies / RNTester / js / examples / PushNotificationIOS / PushNotificationIOSExample . js <nl> ppp b / vnext / ReactCopies / RNTester / js / examples / PushNotificationIOS / PushNotificationIOSExample . js <nl> class NotificationPermissionExample extends React . Component < <nl> ) ; <nl> this . _checkPermissions ( ) ; <nl> } , <nl> - ( onReject ? ) = > { <nl> + ( ) = > { <nl> this . _showAlert ( ' Error requesting permissions ' ) ; <nl> this . _checkPermissions ( ) ; <nl> } , <nl> mmm a / vnext / overrides . json <nl> ppp b / vnext / overrides . json <nl> <nl> " type " : " derived " , <nl> " file " : " . flowconfig " , <nl> " baseFile " : " . flowconfig " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 3210a076de8ff5c698de48d8af444b2677270ca6 " <nl> } , <nl> - { <nl> - " type " : " patch " , <nl> - " file " : " DeforkingPatches / ReactCommon / turbomodule / samples / SampleTurboCxxModule . cpp " , <nl> - " baseFile " : " ReactCommon / turbomodule / samples / SampleTurboCxxModule . cpp " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> - " baseHash " : " b8840ecbf1d0a61d5e13d6f9690722e41cacb7ab " , <nl> - " issue " : " LEGACY_FIXME " <nl> - } , <nl> - { <nl> - " type " : " patch " , <nl> - " file " : " DeforkingPatches / ReactCommon / turbomodule / samples / SampleTurboCxxModule . h " , <nl> - " baseFile " : " ReactCommon / turbomodule / samples / SampleTurboCxxModule . h " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> - " baseHash " : " 2e4e38798e5504d891342e46da17ef3b073123d8 " , <nl> - " issue " : " LEGACY_FIXME " <nl> - } , <nl> { <nl> " type " : " patch " , <nl> " file " : " DeforkingPatches / ReactCommon / yoga / yoga / Yoga . cpp " , <nl> " baseFile " : " ReactCommon / yoga / yoga / Yoga . cpp " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " b92ec8e02589b928d695148b399b88ab522e14e1 " , <nl> " issue " : 3994 <nl> } , <nl> <nl> " type " : " copy " , <nl> " directory " : " ReactCopies / IntegrationTests " , <nl> " baseDirectory " : " IntegrationTests " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " b189414bfc74b1a14e0181a79b92a18e67253491 " , <nl> " issue " : 4054 <nl> } , <nl> <nl> " type " : " copy " , <nl> " directory " : " ReactCopies / RNTester / js " , <nl> " baseDirectory " : " RNTester / js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> - " baseHash " : " 93eb55b5604ae2e8f6133bfebde7c3f086f98538 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> + " baseHash " : " f0f71634fbd406dfa5aadff5b257773592a98010 " , <nl> " issue " : 4054 <nl> } , <nl> { <nl> " type " : " patch " , <nl> " file " : " src / babel - plugin - inline - view - configs / GenerateViewConfigJs . js " , <nl> " baseFile " : " packages / react - native - codegen / src / generators / components / GenerateViewConfigJs . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 80aa1fe96412a5f027dbf5e3df3feddab91c3ccb " , <nl> " issue " : 5430 <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / babel - plugin - inline - view - configs / index . js " , <nl> " baseFile " : " packages / babel - plugin - inline - view - configs / index . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 02590f3430fb57fcd954357c9dbeeaa8bdc01d06 " , <nl> " issue " : 5430 <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / babel - plugin - inline - view - configs / package . json " , <nl> " baseFile " : " packages / babel - plugin - inline - view - configs / package . json " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 8d37fac510a533c0badffacd9c3aa9c392fd58c6 " , <nl> " issue " : 5430 <nl> } , <nl> <nl> " type " : " derived " , <nl> " file " : " src / index . windows . js " , <nl> " baseFile " : " index . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 27967b6f36e9bc2bc3f4ac79c1320b7152d93f83 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / Libraries / Alert / Alert . windows . js " , <nl> " baseFile " : " Libraries / Alert / Alert . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " b4867752830f6953516c5898a7e2fc0dc796dcfa " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " copy " , <nl> " file " : " src / Libraries / Components / AccessibilityInfo / AccessibilityInfo . windows . js " , <nl> " baseFile " : " Libraries / Components / AccessibilityInfo / AccessibilityInfo . android . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 611e89285ac812456b381568052cf575c955575a " , <nl> " issue " : 4578 <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / Libraries / Components / Button . windows . js " , <nl> " baseFile " : " Libraries / Components / Button . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 3c1baecf9171422511a08436edd423c5da9cf5c2 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " derived " , <nl> " file " : " src / Libraries / Components / DatePicker / DatePickerIOS . windows . js " , <nl> " baseFile " : " Libraries / Components / DatePicker / DatePickerIOS . android . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 218895e2a5f3d7614a2cb577da187800857850ea " <nl> } , <nl> { <nl> <nl> " type " : " derived " , <nl> " file " : " src / Libraries / Components / DatePickerAndroid / DatePickerAndroid . windows . js " , <nl> " baseFile " : " Libraries / Components / DatePickerAndroid / DatePickerAndroid . ios . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 09d82215c57ca5873a53523a63006daebf07ffbc " <nl> } , <nl> { <nl> " type " : " derived " , <nl> " file " : " src / Libraries / Components / DrawerAndroid / DrawerLayoutAndroid . windows . js " , <nl> " baseFile " : " Libraries / Components / DrawerAndroid / DrawerLayoutAndroid . ios . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " e5bb18f4dc9ddbf96ab9b83cfc21b1c0495ac59a " <nl> } , <nl> { <nl> <nl> " type " : " derived " , <nl> " file " : " src / Libraries / Components / MaskedView / MaskedViewIOS . windows . js " , <nl> " baseFile " : " Libraries / Components / MaskedView / MaskedViewIOS . android . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 0b409391c852a1001cee74a84414a13c4fe88f8b " <nl> } , <nl> { <nl> " type " : " patch " , <nl> " file " : " src / Libraries / Components / Picker / Picker . windows . js " , <nl> " baseFile " : " Libraries / Components / Picker / Picker . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " ebfef6691cf4634daa34c025327f837d292ef44f " , <nl> " issue " : 4611 <nl> } , <nl> <nl> " type " : " derived " , <nl> " file " : " src / Libraries / Components / Picker / PickerAndroid . windows . js " , <nl> " baseFile " : " Libraries / Components / Picker / PickerAndroid . ios . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " e5bb18f4dc9ddbf96ab9b83cfc21b1c0495ac59a " <nl> } , <nl> { <nl> " type " : " derived " , <nl> " file " : " src / Libraries / Components / Picker / PickerIOS . windows . js " , <nl> " baseFile " : " Libraries / Components / Picker / PickerIOS . android . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 0c6bf0751e053672123cbad30d67851ba0007af6 " <nl> } , <nl> { <nl> <nl> " type " : " derived " , <nl> " file " : " src / Libraries / Components / Picker / PickerWindows . tsx " , <nl> " baseFile " : " Libraries / Components / Picker / PickerIOS . ios . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 1a94e2e99474b15141d1c67c1211ac1dc2c2a62d " , <nl> " issue " : 4611 <nl> } , <nl> <nl> " type " : " derived " , <nl> " file " : " src / Libraries / Components / ProgressBarAndroid / ProgressBarAndroid . windows . js " , <nl> " baseFile " : " Libraries / Components / ProgressBarAndroid / ProgressBarAndroid . ios . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " e5bb18f4dc9ddbf96ab9b83cfc21b1c0495ac59a " <nl> } , <nl> { <nl> " type " : " derived " , <nl> " file " : " src / Libraries / Components / ProgressViewIOS / ProgressViewIOS . windows . js " , <nl> " baseFile " : " Libraries / Components / ProgressViewIOS / ProgressViewIOS . android . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " f0b35fdee6b1c9e7bfe860a9e0aefc00337ea7fd " <nl> } , <nl> { <nl> " type " : " patch " , <nl> " file " : " src / Libraries / Components / RefreshControl / RefreshControl . windows . js " , <nl> " baseFile " : " Libraries / Components / RefreshControl / RefreshControl . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 0efdf9cc52f5411bbf296f92e30aa44f83668b45 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " derived " , <nl> " file " : " src / Libraries / Components / SafeAreaView / SafeAreaView . windows . js " , <nl> " baseFile " : " Libraries / Components / SafeAreaView / SafeAreaView . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 59dabb86baedb0088e110f8cdeb914fa3271dfd9 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " derived " , <nl> " file " : " src / Libraries / Components / SegmentedControlIOS / SegmentedControlIOS . windows . js " , <nl> " baseFile " : " Libraries / Components / SegmentedControlIOS / SegmentedControlIOS . android . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 37cea8b532ea4e4335120c6f8b2d3d3548e31b18 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / Libraries / Components / TextInput / TextInput . windows . js " , <nl> " baseFile " : " Libraries / Components / TextInput / TextInput . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 9d9e65ecd506387e98d0ef5a58321c568a95ad41 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / Libraries / Components / TextInput / TextInputState . windows . js " , <nl> " baseFile " : " Libraries / Components / TextInput / TextInputState . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " e982deb23d7ad5312ab0c09508a6d58c152b5be7 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " derived " , <nl> " file " : " src / Libraries / Components / ToastAndroid / ToastAndroid . windows . js " , <nl> " baseFile " : " Libraries / Components / ToastAndroid / ToastAndroid . ios . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 614b7e88c38f5820656c79d64239bfb74ca308c0 " <nl> } , <nl> { <nl> " type " : " patch " , <nl> " file " : " src / Libraries / Components / Touchable / TouchableHighlight . windows . js " , <nl> " baseFile " : " Libraries / Components / Touchable / TouchableHighlight . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " a41ceb18692f6d3df5fe3e93bd86f5cfa5399d97 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / Libraries / Components / Touchable / TouchableOpacity . windows . js " , <nl> " baseFile " : " Libraries / Components / Touchable / TouchableOpacity . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " e9b3b0a49be45f4030f34f7c91f5a47c01b50582 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / Libraries / Components / Touchable / TouchableWithoutFeedback . windows . js " , <nl> " baseFile " : " Libraries / Components / Touchable / TouchableWithoutFeedback . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 8fef33cd9edce5725695ca1e7fd9705916578799 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / Libraries / Components / View / ReactNativeViewViewConfig . windows . js " , <nl> " baseFile " : " Libraries / Components / View / ReactNativeViewViewConfig . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 8d5d480284b4cdaf7d8d86935967370d455b7b68 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / Libraries / Components / View / ViewAccessibility . windows . js " , <nl> " baseFile " : " Libraries / Components / View / ViewAccessibility . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 2d01902a9edd76f728e9044e2ed8a35d44f34424 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / Libraries / Components / View / ViewPropTypes . windows . js " , <nl> " baseFile " : " Libraries / Components / View / ViewPropTypes . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " f768a7dd320d434d9bc9dacef3ee2ca9776e2197 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / Libraries / DeprecatedPropTypes / DeprecatedViewAccessibility . windows . js " , <nl> " baseFile " : " Libraries / DeprecatedPropTypes / DeprecatedViewAccessibility . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " c6d80f9ea60e5802d2e67ed50a78f2b6840d1162 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " copy " , <nl> " file " : " src / Libraries / Image / Image . windows . js " , <nl> " baseFile " : " Libraries / Image / Image . ios . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 26acff268b815c7b3c5da0d6c9c009073b202ea8 " , <nl> " issue " : 4590 <nl> } , <nl> - { <nl> - " type " : " patch " , <nl> - " file " : " src / Libraries / Lists / VirtualizedList . windows . js " , <nl> - " baseFile " : " Libraries / Lists / VirtualizedList . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> - " baseHash " : " d5e35225b23fafa691e7388790fd16d7a3760f68 " , <nl> - " issue " : " LEGACY_FIXME " <nl> - } , <nl> { <nl> " type " : " platform " , <nl> " file " : " src / Libraries / Network / RCTNetworking . windows . js " <nl> <nl> " type " : " derived " , <nl> " file " : " src / Libraries / Network / RCTNetworkingWinShared . js " , <nl> " baseFile " : " Libraries / Network / RCTNetworking . ios . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " fa5d7d307e25d22d699a1d2d1eec9c0ac79ba928 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / Libraries / NewAppScreen / components / DebugInstructions . windows . js " , <nl> " baseFile " : " Libraries / NewAppScreen / components / DebugInstructions . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " a9f4db370db2e34a8708abd57bc5a7ab5c44ccf1 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / Libraries / NewAppScreen / components / ReloadInstructions . windows . js " , <nl> " baseFile " : " Libraries / NewAppScreen / components / ReloadInstructions . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 39326801da6c9ce8c350aa8ba971be4a386499bc " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / Libraries / Pressability / Pressability . windows . js " , <nl> " baseFile " : " Libraries / Pressability / Pressability . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " a3e33cfe943788b47933ea2c7a807326c8545492 " , <nl> " issue " : 4379 <nl> } , <nl> <nl> " type " : " derived " , <nl> " file " : " src / Libraries / Settings / Settings . windows . js " , <nl> " baseFile " : " Libraries / Settings / Settings . android . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 00604dd0ab624b3f5b80d460f48dbc3ac7ee905d " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / Libraries / StyleSheet / StyleSheetValidation . windows . js " , <nl> " baseFile " : " Libraries / StyleSheet / StyleSheetValidation . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 5fe7febd1eb5374745fe612030806512e9161796 " , <nl> " issue " : 5269 <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / Libraries / Types / CoreEventTypes . js " , <nl> " baseFile " : " Libraries / Types / CoreEventTypes . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 83b203d547d9bdc57a8f3346ecee6f6e34b25f5d " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " copy " , <nl> " file " : " src / Libraries / Utilities / BackHandler . windows . js " , <nl> " baseFile " : " Libraries / Utilities / BackHandler . android . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 2fbb5d988289f3678809dd440b15828df1bae56d " , <nl> " issue " : 4629 <nl> } , <nl> <nl> " type " : " derived " , <nl> " file " : " src / Libraries / Utilities / NativePlatformConstantsWin . js " , <nl> " baseFile " : " Libraries / Utilities / NativePlatformConstantsIOS . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 168fe4a9608c0b151237122eea94d78f7b0093e5 " <nl> } , <nl> { <nl> " type " : " derived " , <nl> " file " : " src / Libraries / Utilities / Platform . windows . js " , <nl> " baseFile " : " Libraries / Utilities / Platform . android . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " bcaebbe089a41de46724b00e69fcdba7e6b1ed7f " <nl> } , <nl> { <nl> <nl> " type " : " patch " , <nl> " file " : " src / RNTester / js / components / ListExampleShared . windows . js " , <nl> " baseFile " : " RNTester / js / components / ListExampleShared . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " d7be07e3fd8d9c1df8e23d5674ce3eb067d00865 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / RNTester / js / components / RNTesterExampleList . windows . js " , <nl> " baseFile " : " RNTester / js / components / RNTesterExampleList . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " fc507321dc5cb53be93df517ba5c4b1acd0074f4 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " derived " , <nl> " file " : " src / RNTester / js / examples / PlatformColor / PlatformColorExample . windows . js " , <nl> " baseFile " : " RNTester / js / examples / PlatformColor / PlatformColorExample . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " a63038b104bcf3caa0984d994bf3916ef1aa38ee " , <nl> " issue " : 4055 <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / RNTester / js / examples / ScrollView / ScrollViewExample . windows . js " , <nl> " baseFile " : " RNTester / js / examples / ScrollView / ScrollViewExample . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 1840fda2dd4591883df92d28c1e1aeabff190f7f " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / RNTester / js / examples / TextInput / TextInputExample . windows . js " , <nl> " baseFile " : " RNTester / js / examples / TextInput / TextInputExample . android . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 1755bffd6ae353838f1779007dc4a512b8dddcdc " , <nl> " issue " : 5688 <nl> } , <nl> <nl> " type " : " patch " , <nl> " file " : " src / RNTester / js / examples / View / ViewExample . windows . js " , <nl> " baseFile " : " RNTester / js / examples / View / ViewExample . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 76d4a9914e731bffefefd3b0de90c97a1726e2a9 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> <nl> " type " : " derived " , <nl> " file " : " src / RNTester / js / RNTesterApp . windows . js " , <nl> " baseFile " : " RNTester / js / RNTesterApp . ios . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 34d2517461704840a508ce1856bc3a364fb3fc7e " , <nl> " issue " : 4586 <nl> } , <nl> <nl> " type " : " derived " , <nl> " file " : " src / RNTester / js / utils / RNTesterList . windows . ts " , <nl> " baseFile " : " RNTester / js / utils / RNTesterList . android . js " , <nl> - " baseVersion " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " baseVersion " : " 0 . 0 . 0 - 30a89f30c " , <nl> " baseHash " : " 20a6f5c42266beb017dccc7f22d45bde02907d89 " , <nl> " issue " : " LEGACY_FIXME " <nl> } , <nl> mmm a / vnext / package . json <nl> ppp b / vnext / package . json <nl> <nl> " eslint " : " 6 . 7 . 0 " , <nl> " eslint - plugin - prettier " : " 2 . 6 . 2 " , <nl> " flow - bin " : " ^ 0 . 123 . 0 " , <nl> - " jscodeshift " : " ^ 0 . 7 . 0 " , <nl> + " jscodeshift " : " ^ 0 . 9 . 0 " , <nl> " just - scripts " : " ^ 0 . 36 . 1 " , <nl> " prettier " : " 1 . 17 . 0 " , <nl> " react " : " 16 . 13 . 1 " , <nl> - " react - native " : " 0 . 0 . 0 - d8e6c4578 " , <nl> + " react - native " : " 0 . 0 . 0 - 30a89f30c " , <nl> " react - native - platform - override " : " ^ 0 . 2 . 1 " , <nl> " react - native - windows - codegen " : " 0 . 1 . 0 " , <nl> " react - refresh " : " ^ 0 . 4 . 0 " , <nl> <nl> } , <nl> " peerDependencies " : { <nl> " react " : " 16 . 13 . 1 " , <nl> - " react - native " : " 0 . 0 . 0 - d8e6c4578 " <nl> + " react - native " : " 0 . 0 . 0 - 30a89f30c " <nl> } , <nl> " beachball " : { <nl> " defaultNpmTag " : " canary " , <nl> deleted file mode 100644 <nl> index 1df7a21d11 . . 0000000000 <nl> mmm a / vnext / src / Libraries / Lists / VirtualizedList . windows . js <nl> ppp / dev / null <nl> <nl> - / * * <nl> - * Copyright ( c ) Facebook , Inc . and its affiliates . <nl> - * <nl> - * This source code is licensed under the MIT license found in the <nl> - * LICENSE file in the root directory of this source tree . <nl> - * <nl> - * @ flow <nl> - * @ format <nl> - * / <nl> - <nl> - ' use strict ' ; <nl> - <nl> - const Batchinator = require ( ' . . / Interaction / Batchinator ' ) ; <nl> - const FillRateHelper = require ( ' . / FillRateHelper ' ) ; <nl> - const PropTypes = require ( ' prop - types ' ) ; <nl> - const React = require ( ' react ' ) ; <nl> - const ReactNative = require ( ' . . / Renderer / shims / ReactNative ' ) ; <nl> - const RefreshControl = require ( ' . . / Components / RefreshControl / RefreshControl ' ) ; <nl> - const ScrollView = require ( ' . . / Components / ScrollView / ScrollView ' ) ; <nl> - const StyleSheet = require ( ' . . / StyleSheet / StyleSheet ' ) ; <nl> - const View = require ( ' . . / Components / View / View ' ) ; <nl> - const ViewabilityHelper = require ( ' . / ViewabilityHelper ' ) ; <nl> - <nl> - const flattenStyle = require ( ' . . / StyleSheet / flattenStyle ' ) ; <nl> - const infoLog = require ( ' . . / Utilities / infoLog ' ) ; <nl> - const invariant = require ( ' invariant ' ) ; <nl> - const warning = require ( ' fbjs / lib / warning ' ) ; <nl> - <nl> - const { computeWindowedRenderLimits } = require ( ' . / VirtualizeUtils ' ) ; <nl> - <nl> - import type { ScrollResponderType } from ' . . / Components / ScrollView / ScrollView ' ; <nl> - import type { ViewStyleProp } from ' . . / StyleSheet / StyleSheet ' ; <nl> - import type { <nl> - ViewabilityConfig , <nl> - ViewToken , <nl> - ViewabilityConfigCallbackPair , <nl> - } from ' . / ViewabilityHelper ' ; <nl> - <nl> - type Item = any ; <nl> - <nl> - export type Separators = { <nl> - highlight : ( ) = > void , <nl> - unhighlight : ( ) = > void , <nl> - updateProps : ( select : ' leading ' | ' trailing ' , newProps : Object ) = > void , <nl> - . . . <nl> - } ; <nl> - <nl> - export type RenderItemProps < ItemT > = { <nl> - item : ItemT , <nl> - index : number , <nl> - separators : Separators , <nl> - . . . <nl> - } ; <nl> - <nl> - export type RenderItemType < ItemT > = ( <nl> - info : RenderItemProps < ItemT > , <nl> - ) = > React . Node ; <nl> - <nl> - type ViewabilityHelperCallbackTuple = { <nl> - viewabilityHelper : ViewabilityHelper , <nl> - onViewableItemsChanged : ( info : { <nl> - viewableItems : Array < ViewToken > , <nl> - changed : Array < ViewToken > , <nl> - . . . <nl> - } ) = > void , <nl> - . . . <nl> - } ; <nl> - <nl> - type RequiredProps = { | <nl> - / * * <nl> - * The default accessor functions assume this is an Array < { key : string } | { id : string } > but you can override <nl> - * getItem , getItemCount , and keyExtractor to handle any type of index - based data . <nl> - * / <nl> - data ? : any , <nl> - / * * <nl> - * A generic accessor for extracting an item from any sort of data blob . <nl> - * / <nl> - getItem : ( data : any , index : number ) = > ? Item , <nl> - / * * <nl> - * Determines how many items are in the data blob . <nl> - * / <nl> - getItemCount : ( data : any ) = > number , <nl> - | } ; <nl> - type OptionalProps = { | <nl> - renderItem ? : ? RenderItemType < Item > , <nl> - / * * <nl> - * ` debug ` will turn on extra logging and visual overlays to aid with debugging both usage and <nl> - * implementation , but with a significant perf hit . <nl> - * / <nl> - debug ? : ? boolean , <nl> - / * * <nl> - * DEPRECATED : Virtualization provides significant performance and memory optimizations , but fully <nl> - * unmounts react instances that are outside of the render window . You should only need to disable <nl> - * this for debugging purposes . <nl> - * / <nl> - disableVirtualization ? : ? boolean , <nl> - / * * <nl> - * A marker property for telling the list to re - render ( since it implements ` PureComponent ` ) . If <nl> - * any of your ` renderItem ` , Header , Footer , etc . functions depend on anything outside of the <nl> - * ` data ` prop , stick it here and treat it immutably . <nl> - * / <nl> - extraData ? : any , <nl> - / / e . g . height , y <nl> - getItemLayout ? : ( <nl> - data : any , <nl> - index : number , <nl> - ) = > { <nl> - length : number , <nl> - offset : number , <nl> - index : number , <nl> - . . . <nl> - } , <nl> - horizontal ? : ? boolean , <nl> - / * * <nl> - * How many items to render in the initial batch . This should be enough to fill the screen but not <nl> - * much more . Note these items will never be unmounted as part of the windowed rendering in order <nl> - * to improve perceived performance of scroll - to - top actions . <nl> - * / <nl> - initialNumToRender : number , <nl> - / * * <nl> - * Instead of starting at the top with the first item , start at ` initialScrollIndex ` . This <nl> - * disables the " scroll to top " optimization that keeps the first ` initialNumToRender ` items <nl> - * always rendered and immediately renders the items starting at this initial index . Requires <nl> - * ` getItemLayout ` to be implemented . <nl> - * / <nl> - initialScrollIndex ? : ? number , <nl> - / * * <nl> - * Reverses the direction of scroll . Uses scale transforms of - 1 . <nl> - * / <nl> - inverted ? : ? boolean , <nl> - keyExtractor : ( item : Item , index : number ) = > string , <nl> - / * * <nl> - * Each cell is rendered using this element . Can be a React Component Class , <nl> - * or a render function . Defaults to using View . <nl> - * / <nl> - CellRendererComponent ? : ? React . ComponentType < any > , <nl> - / * * <nl> - * Rendered in between each item , but not at the top or bottom . By default , ` highlighted ` and <nl> - * ` leadingItem ` props are provided . ` renderItem ` provides ` separators . highlight ` / ` unhighlight ` <nl> - * which will update the ` highlighted ` prop , but you can also add custom props with <nl> - * ` separators . updateProps ` . <nl> - * / <nl> - ItemSeparatorComponent ? : ? React . ComponentType < any > , <nl> - / * * <nl> - * Takes an item from ` data ` and renders it into the list . Example usage : <nl> - * <nl> - * < FlatList <nl> - * ItemSeparatorComponent = { Platform . OS ! = = ' android ' & & ( { highlighted } ) = > ( <nl> - * < View style = { [ style . separator , highlighted & & { marginLeft : 0 } ] } / > <nl> - * ) } <nl> - * data = { [ { title : ' Title Text ' , key : ' item1 ' } ] } <nl> - * ListItemComponent = { ( { item , separators } ) = > ( <nl> - * < TouchableHighlight <nl> - * onPress = { ( ) = > this . _onPress ( item ) } <nl> - * onShowUnderlay = { separators . highlight } <nl> - * onHideUnderlay = { separators . unhighlight } > <nl> - * < View style = { { backgroundColor : ' white ' } } > <nl> - * < Text > { item . title } < / Text > <nl> - * < / View > <nl> - * < / TouchableHighlight > <nl> - * ) } <nl> - * / > <nl> - * <nl> - * Provides additional metadata like ` index ` if you need it , as well as a more generic <nl> - * ` separators . updateProps ` function which let ' s you set whatever props you want to change the <nl> - * rendering of either the leading separator or trailing separator in case the more common <nl> - * ` highlight ` and ` unhighlight ` ( which set the ` highlighted : boolean ` prop ) are insufficient for <nl> - * your use - case . <nl> - * / <nl> - ListItemComponent ? : ? ( React . ComponentType < any > | React . Element < any > ) , <nl> - / * * <nl> - * Rendered when the list is empty . Can be a React Component Class , a render function , or <nl> - * a rendered element . <nl> - * / <nl> - ListEmptyComponent ? : ? ( React . ComponentType < any > | React . Element < any > ) , <nl> - / * * <nl> - * Rendered at the bottom of all the items . Can be a React Component Class , a render function , or <nl> - * a rendered element . <nl> - * / <nl> - ListFooterComponent ? : ? ( React . ComponentType < any > | React . Element < any > ) , <nl> - / * * <nl> - * Styling for internal View for ListFooterComponent <nl> - * / <nl> - ListFooterComponentStyle ? : ViewStyleProp , <nl> - / * * <nl> - * Rendered at the top of all the items . Can be a React Component Class , a render function , or <nl> - * a rendered element . <nl> - * / <nl> - ListHeaderComponent ? : ? ( React . ComponentType < any > | React . Element < any > ) , <nl> - / * * <nl> - * Styling for internal View for ListHeaderComponent <nl> - * / <nl> - ListHeaderComponentStyle ? : ViewStyleProp , <nl> - / * * <nl> - * A unique identifier for this list . If there are multiple VirtualizedLists at the same level of <nl> - * nesting within another VirtualizedList , this key is necessary for virtualization to <nl> - * work properly . <nl> - * / <nl> - listKey ? : string , <nl> - / * * <nl> - * The maximum number of items to render in each incremental render batch . The more rendered at <nl> - * once , the better the fill rate , but responsiveness may suffer because rendering content may <nl> - * interfere with responding to button taps or other interactions . <nl> - * / <nl> - maxToRenderPerBatch : number , <nl> - / * * <nl> - * Called once when the scroll position gets within ` onEndReachedThreshold ` of the rendered <nl> - * content . <nl> - * / <nl> - onEndReached ? : ? ( info : { distanceFromEnd : number , . . . } ) = > void , <nl> - / * * <nl> - * How far from the end ( in units of visible length of the list ) the bottom edge of the <nl> - * list must be from the end of the content to trigger the ` onEndReached ` callback . <nl> - * Thus a value of 0 . 5 will trigger ` onEndReached ` when the end of the content is <nl> - * within half the visible length of the list . <nl> - * / <nl> - onEndReachedThreshold ? : ? number , <nl> - / * * <nl> - * If provided , a standard RefreshControl will be added for " Pull to Refresh " functionality . Make <nl> - * sure to also set the ` refreshing ` prop correctly . <nl> - * / <nl> - onRefresh ? : ? ( ) = > void , <nl> - / * * <nl> - * Used to handle failures when scrolling to an index that has not been measured yet . Recommended <nl> - * action is to either compute your own offset and ` scrollTo ` it , or scroll as far as possible and <nl> - * then try again after more items have been rendered . <nl> - * / <nl> - onScrollToIndexFailed ? : ? ( info : { <nl> - index : number , <nl> - highestMeasuredFrameIndex : number , <nl> - averageItemLength : number , <nl> - . . . <nl> - } ) = > void , <nl> - / * * <nl> - * Called when the viewability of rows changes , as defined by the <nl> - * ` viewabilityConfig ` prop . <nl> - * / <nl> - onViewableItemsChanged ? : ? ( info : { <nl> - viewableItems : Array < ViewToken > , <nl> - changed : Array < ViewToken > , <nl> - . . . <nl> - } ) = > void , <nl> - persistentScrollbar ? : ? boolean , <nl> - / * * <nl> - * Set this when offset is needed for the loading indicator to show correctly . <nl> - * @ platform android <nl> - * / <nl> - progressViewOffset ? : number , <nl> - / * * <nl> - * A custom refresh control element . When set , it overrides the default <nl> - * < RefreshControl > component built internally . The onRefresh and refreshing <nl> - * props are also ignored . Only works for vertical VirtualizedList . <nl> - * / <nl> - refreshControl ? : ? React . Element < any > , <nl> - / * * <nl> - * Set this true while waiting for new data from a refresh . <nl> - * / <nl> - refreshing ? : ? boolean , <nl> - / * * <nl> - * Note : may have bugs ( missing content ) in some circumstances - use at your own risk . <nl> - * <nl> - * This may improve scroll performance for large lists . <nl> - * / <nl> - removeClippedSubviews ? : boolean , <nl> - / * * <nl> - * Render a custom scroll component , e . g . with a differently styled ` RefreshControl ` . <nl> - * / <nl> - renderScrollComponent ? : ( props : Object ) = > React . Element < any > , <nl> - / * * <nl> - * Amount of time between low - pri item render batches , e . g . for rendering items quite a ways off <nl> - * screen . Similar fill rate / responsiveness tradeoff as ` maxToRenderPerBatch ` . <nl> - * / <nl> - updateCellsBatchingPeriod : number , <nl> - / * * <nl> - * See ` ViewabilityHelper ` for flow type and further documentation . <nl> - * / <nl> - viewabilityConfig ? : ViewabilityConfig , <nl> - / * * <nl> - * List of ViewabilityConfig / onViewableItemsChanged pairs . A specific onViewableItemsChanged <nl> - * will be called when its corresponding ViewabilityConfig ' s conditions are met . <nl> - * / <nl> - viewabilityConfigCallbackPairs ? : Array < ViewabilityConfigCallbackPair > , <nl> - / * * <nl> - * Determines the maximum number of items rendered outside of the visible area , in units of <nl> - * visible lengths . So if your list fills the screen , then ` windowSize = { 21 } ` ( the default ) will <nl> - * render the visible screen area plus up to 10 screens above and 10 below the viewport . Reducing <nl> - * this number will reduce memory consumption and may improve performance , but will increase the <nl> - * chance that fast scrolling may reveal momentary blank areas of unrendered content . <nl> - * / <nl> - windowSize : number , <nl> - / * * <nl> - * The legacy implementation is no longer supported . <nl> - * / <nl> - legacyImplementation ? : empty , <nl> - | } ; <nl> - <nl> - type Props = { | <nl> - . . . React . ElementConfig < typeof ScrollView > , <nl> - . . . RequiredProps , <nl> - . . . OptionalProps , <nl> - | } ; <nl> - <nl> - type DefaultProps = { | <nl> - disableVirtualization : boolean , <nl> - horizontal : boolean , <nl> - initialNumToRender : number , <nl> - keyExtractor : ( item : Item , index : number ) = > string , <nl> - maxToRenderPerBatch : number , <nl> - onEndReachedThreshold : number , <nl> - scrollEventThrottle : number , <nl> - updateCellsBatchingPeriod : number , <nl> - windowSize : number , <nl> - | } ; <nl> - <nl> - let _usedIndexForKey = false ; <nl> - let _keylessItemComponentName : string = ' ' ; <nl> - <nl> - type Frame = { <nl> - offset : number , <nl> - length : number , <nl> - index : number , <nl> - inLayout : boolean , <nl> - . . . <nl> - } ; <nl> - <nl> - type ChildListState = { <nl> - first : number , <nl> - last : number , <nl> - frames : { [ key : number ] : Frame , . . . } , <nl> - . . . <nl> - } ; <nl> - <nl> - type State = { <nl> - first : number , <nl> - last : number , <nl> - . . . <nl> - } ; <nl> - <nl> - / / Data propagated through nested lists ( regardless of orientation ) that is <nl> - / / useful for producing diagnostics for usage errors involving nesting ( e . g <nl> - / / missing / duplicate keys ) . <nl> - type ListDebugInfo = { <nl> - cellKey : string , <nl> - listKey : string , <nl> - parent : ? ListDebugInfo , <nl> - / / We include all ancestors regardless of orientation , so this is not always <nl> - / / identical to the child ' s orientation . <nl> - horizontal : boolean , <nl> - } ; <nl> - <nl> - / * * <nl> - * Base implementation for the more convenient [ ` < FlatList > ` ] ( https : / / reactnative . dev / docs / flatlist . html ) <nl> - * and [ ` < SectionList > ` ] ( https : / / reactnative . dev / docs / sectionlist . html ) components , which are also better <nl> - * documented . In general , this should only really be used if you need more flexibility than <nl> - * ` FlatList ` provides , e . g . for use with immutable data instead of plain arrays . <nl> - * <nl> - * Virtualization massively improves memory consumption and performance of large lists by <nl> - * maintaining a finite render window of active items and replacing all items outside of the render <nl> - * window with appropriately sized blank space . The window adapts to scrolling behavior , and items <nl> - * are rendered incrementally with low - pri ( after any running interactions ) if they are far from the <nl> - * visible area , or with hi - pri otherwise to minimize the potential of seeing blank space . <nl> - * <nl> - * Some caveats : <nl> - * <nl> - * - Internal state is not preserved when content scrolls out of the render window . Make sure all <nl> - * your data is captured in the item data or external stores like Flux , Redux , or Relay . <nl> - * - This is a ` PureComponent ` which means that it will not re - render if ` props ` remain shallow - <nl> - * equal . Make sure that everything your ` renderItem ` function depends on is passed as a prop <nl> - * ( e . g . ` extraData ` ) that is not ` = = = ` after updates , otherwise your UI may not update on <nl> - * changes . This includes the ` data ` prop and parent component state . <nl> - * - In order to constrain memory and enable smooth scrolling , content is rendered asynchronously <nl> - * offscreen . This means it ' s possible to scroll faster than the fill rate ands momentarily see <nl> - * blank content . This is a tradeoff that can be adjusted to suit the needs of each application , <nl> - * and we are working on improving it behind the scenes . <nl> - * - By default , the list looks for a ` key ` or ` id ` prop on each item and uses that for the React key . <nl> - * Alternatively , you can provide a custom ` keyExtractor ` prop . <nl> - * <nl> - * / <nl> - class VirtualizedList extends React . PureComponent < Props , State > { <nl> - props : Props ; <nl> - <nl> - / / scrollToEnd may be janky without getItemLayout prop <nl> - scrollToEnd ( params ? : ? { animated ? : ? boolean , . . . } ) { <nl> - const animated = params ? params . animated : true ; <nl> - const veryLast = this . props . getItemCount ( this . props . data ) - 1 ; <nl> - const frame = this . _getFrameMetricsApprox ( veryLast ) ; <nl> - const offset = Math . max ( <nl> - 0 , <nl> - frame . offset + <nl> - frame . length + <nl> - this . _footerLength - <nl> - this . _scrollMetrics . visibleLength , <nl> - ) ; <nl> - <nl> - if ( this . _scrollRef = = null ) { <nl> - return ; <nl> - } <nl> - <nl> - this . _scrollRef . scrollTo ( <nl> - this . props . horizontal ? { x : offset , animated } : { y : offset , animated } , <nl> - ) ; <nl> - } <nl> - <nl> - / / scrollToIndex may be janky without getItemLayout prop <nl> - scrollToIndex ( params : { <nl> - animated ? : ? boolean , <nl> - index : number , <nl> - viewOffset ? : number , <nl> - viewPosition ? : number , <nl> - . . . <nl> - } ) { <nl> - const { <nl> - data , <nl> - horizontal , <nl> - getItemCount , <nl> - getItemLayout , <nl> - onScrollToIndexFailed , <nl> - } = this . props ; <nl> - const { animated , index , viewOffset , viewPosition } = params ; <nl> - invariant ( <nl> - index > = 0 , <nl> - ` scrollToIndex out of range : requested index $ { index } but minimum is 0 ` , <nl> - ) ; <nl> - invariant ( <nl> - getItemCount ( data ) > = 1 , <nl> - ` scrollToIndex out of range : item length $ { getItemCount ( <nl> - data , <nl> - ) } but minimum is 1 ` , <nl> - ) ; <nl> - invariant ( <nl> - index < getItemCount ( data ) , <nl> - ` scrollToIndex out of range : requested index $ { index } is out of 0 to $ { getItemCount ( <nl> - data , <nl> - ) - 1 } ` , <nl> - ) ; <nl> - if ( ! getItemLayout & & index > this . _highestMeasuredFrameIndex ) { <nl> - invariant ( <nl> - ! ! onScrollToIndexFailed , <nl> - ' scrollToIndex should be used in conjunction with getItemLayout or onScrollToIndexFailed , ' + <nl> - ' otherwise there is no way to know the location of offscreen indices or handle failures . ' , <nl> - ) ; <nl> - onScrollToIndexFailed ( { <nl> - averageItemLength : this . _averageCellLength , <nl> - highestMeasuredFrameIndex : this . _highestMeasuredFrameIndex , <nl> - index , <nl> - } ) ; <nl> - return ; <nl> - } <nl> - const frame = this . _getFrameMetricsApprox ( index ) ; <nl> - const offset = <nl> - Math . max ( <nl> - 0 , <nl> - frame . offset - <nl> - ( viewPosition | | 0 ) * <nl> - ( this . _scrollMetrics . visibleLength - frame . length ) , <nl> - ) - ( viewOffset | | 0 ) ; <nl> - <nl> - if ( this . _scrollRef = = null ) { <nl> - return ; <nl> - } <nl> - <nl> - this . _scrollRef . scrollTo ( <nl> - horizontal ? { x : offset , animated } : { y : offset , animated } , <nl> - ) ; <nl> - } <nl> - <nl> - / / scrollToItem may be janky without getItemLayout prop . Required linear scan through items - <nl> - / / use scrollToIndex instead if possible . <nl> - scrollToItem ( params : { <nl> - animated ? : ? boolean , <nl> - item : Item , <nl> - viewPosition ? : number , <nl> - . . . <nl> - } ) { <nl> - const { item } = params ; <nl> - const { data , getItem , getItemCount } = this . props ; <nl> - const itemCount = getItemCount ( data ) ; <nl> - for ( let index = 0 ; index < itemCount ; index + + ) { <nl> - if ( getItem ( data , index ) = = = item ) { <nl> - this . scrollToIndex ( { . . . params , index } ) ; <nl> - break ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - / * * <nl> - * Scroll to a specific content pixel offset in the list . <nl> - * <nl> - * Param ` offset ` expects the offset to scroll to . <nl> - * In case of ` horizontal ` is true , the offset is the x - value , <nl> - * in any other case the offset is the y - value . <nl> - * <nl> - * Param ` animated ` ( ` true ` by default ) defines whether the list <nl> - * should do an animation while scrolling . <nl> - * / <nl> - scrollToOffset ( params : { animated ? : ? boolean , offset : number , . . . } ) { <nl> - const { animated , offset } = params ; <nl> - <nl> - if ( this . _scrollRef = = null ) { <nl> - return ; <nl> - } <nl> - <nl> - this . _scrollRef . scrollTo ( <nl> - this . props . horizontal ? { x : offset , animated } : { y : offset , animated } , <nl> - ) ; <nl> - } <nl> - <nl> - recordInteraction ( ) { <nl> - this . _nestedChildLists . forEach ( childList = > { <nl> - childList . ref & & childList . ref . recordInteraction ( ) ; <nl> - } ) ; <nl> - this . _viewabilityTuples . forEach ( t = > { <nl> - t . viewabilityHelper . recordInteraction ( ) ; <nl> - } ) ; <nl> - this . _updateViewableItems ( this . props . data ) ; <nl> - } <nl> - <nl> - flashScrollIndicators ( ) { <nl> - if ( this . _scrollRef = = null ) { <nl> - return ; <nl> - } <nl> - <nl> - this . _scrollRef . flashScrollIndicators ( ) ; <nl> - } <nl> - <nl> - / * * <nl> - * Provides a handle to the underlying scroll responder . <nl> - * Note that ` this . _scrollRef ` might not be a ` ScrollView ` , so we <nl> - * need to check that it responds to ` getScrollResponder ` before calling it . <nl> - * / <nl> - getScrollResponder ( ) : ? ScrollResponderType { <nl> - if ( this . _scrollRef & & this . _scrollRef . getScrollResponder ) { <nl> - return this . _scrollRef . getScrollResponder ( ) ; <nl> - } <nl> - } <nl> - <nl> - getScrollableNode ( ) : ? number { <nl> - if ( this . _scrollRef & & this . _scrollRef . getScrollableNode ) { <nl> - return this . _scrollRef . getScrollableNode ( ) ; <nl> - } else { <nl> - return ReactNative . findNodeHandle ( this . _scrollRef ) ; <nl> - } <nl> - } <nl> - <nl> - getScrollRef ( ) : <nl> - | ? React . ElementRef < typeof ScrollView > <nl> - | ? React . ElementRef < typeof View > { <nl> - if ( this . _scrollRef & & this . _scrollRef . getScrollRef ) { <nl> - return this . _scrollRef . getScrollRef ( ) ; <nl> - } else { <nl> - return this . _scrollRef ; <nl> - } <nl> - } <nl> - <nl> - setNativeProps ( props : Object ) { <nl> - if ( this . _scrollRef ) { <nl> - this . _scrollRef . setNativeProps ( props ) ; <nl> - } <nl> - } <nl> - <nl> - static defaultProps : DefaultProps = { <nl> - disableVirtualization : false , <nl> - horizontal : false , <nl> - initialNumToRender : 10 , <nl> - keyExtractor : ( item : Item , index : number ) = > { <nl> - if ( item . key ! = null ) { <nl> - return item . key ; <nl> - } <nl> - if ( item . id ! = null ) { <nl> - return item . id ; <nl> - } <nl> - _usedIndexForKey = true ; <nl> - if ( item . type & & item . type . displayName ) { <nl> - _keylessItemComponentName = item . type . displayName ; <nl> - } <nl> - return String ( index ) ; <nl> - } , <nl> - maxToRenderPerBatch : 10 , <nl> - onEndReachedThreshold : 2 , / / multiples of length <nl> - scrollEventThrottle : 50 , <nl> - updateCellsBatchingPeriod : 50 , <nl> - windowSize : 21 , / / multiples of length <nl> - } ; <nl> - <nl> - static contextTypes : <nl> - | any <nl> - | { | <nl> - virtualizedCell : { | <nl> - cellKey : React $ PropType $ Primitive < string > , <nl> - | } , <nl> - virtualizedList : { | <nl> - getScrollMetrics : React $ PropType $ Primitive < Function > , <nl> - horizontal : React $ PropType $ Primitive < boolean > , <nl> - getOutermostParentListRef : React $ PropType $ Primitive < Function > , <nl> - getNestedChildState : React $ PropType $ Primitive < Function > , <nl> - registerAsNestedChild : React $ PropType $ Primitive < Function > , <nl> - unregisterAsNestedChild : React $ PropType $ Primitive < Function > , <nl> - debugInfo : { | <nl> - listKey : React $ PropType $ Primitive < string > , <nl> - cellKey : React $ PropType $ Primitive < string > , <nl> - | } , <nl> - | } , <nl> - | } = { <nl> - virtualizedCell : PropTypes . shape ( { <nl> - cellKey : PropTypes . string , <nl> - } ) , <nl> - virtualizedList : PropTypes . shape ( { <nl> - getScrollMetrics : PropTypes . func , <nl> - horizontal : PropTypes . bool , <nl> - getOutermostParentListRef : PropTypes . func , <nl> - getNestedChildState : PropTypes . func , <nl> - registerAsNestedChild : PropTypes . func , <nl> - unregisterAsNestedChild : PropTypes . func , <nl> - debugInfo : PropTypes . shape ( { <nl> - listKey : PropTypes . string , <nl> - cellKey : PropTypes . string , <nl> - } ) , <nl> - } ) , <nl> - } ; <nl> - <nl> - static childContextTypes : <nl> - | any <nl> - | { | <nl> - getScrollMetrics : React $ PropType $ Primitive < Function > , <nl> - horizontal : React $ PropType $ Primitive < boolean > , <nl> - getOutermostParentListRef : React $ PropType $ Primitive < Function > , <nl> - getNestedChildState : React $ PropType $ Primitive < Function > , <nl> - registerAsNestedChild : React $ PropType $ Primitive < Function > , <nl> - unregisterAsNestedChild : React $ PropType $ Primitive < Function > , <nl> - | } = { <nl> - virtualizedList : PropTypes . shape ( { <nl> - getScrollMetrics : PropTypes . func , <nl> - horizontal : PropTypes . bool , <nl> - getOutermostParentListRef : PropTypes . func , <nl> - getNestedChildState : PropTypes . func , <nl> - registerAsNestedChild : PropTypes . func , <nl> - unregisterAsNestedChild : PropTypes . func , <nl> - } ) , <nl> - } ; <nl> - <nl> - getChildContext ( ) : { | <nl> - virtualizedList : { <nl> - getScrollMetrics : ( ) = > { <nl> - contentLength : number , <nl> - dOffset : number , <nl> - dt : number , <nl> - offset : number , <nl> - timestamp : number , <nl> - velocity : number , <nl> - visibleLength : number , <nl> - . . . <nl> - } , <nl> - horizontal : ? boolean , <nl> - getOutermostParentListRef : Function , <nl> - getNestedChildState : string = > ? ChildListState , <nl> - registerAsNestedChild : ( { <nl> - cellKey : string , <nl> - key : string , <nl> - ref : VirtualizedList , <nl> - parentDebugInfo : ListDebugInfo , <nl> - . . . <nl> - } ) = > ? ChildListState , <nl> - unregisterAsNestedChild : ( { <nl> - key : string , <nl> - state : ChildListState , <nl> - . . . <nl> - } ) = > void , <nl> - debugInfo : ListDebugInfo , <nl> - . . . <nl> - } , <nl> - | } { <nl> - return { <nl> - virtualizedList : { <nl> - getScrollMetrics : this . _getScrollMetrics , <nl> - horizontal : this . props . horizontal , <nl> - getOutermostParentListRef : this . _getOutermostParentListRef , <nl> - getNestedChildState : this . _getNestedChildState , <nl> - registerAsNestedChild : this . _registerAsNestedChild , <nl> - unregisterAsNestedChild : this . _unregisterAsNestedChild , <nl> - debugInfo : this . _getDebugInfo ( ) , <nl> - } , <nl> - } ; <nl> - } <nl> - <nl> - _getCellKey ( ) : string { <nl> - return ( <nl> - ( this . context . virtualizedCell & & this . context . virtualizedCell . cellKey ) | | <nl> - ' rootList ' <nl> - ) ; <nl> - } <nl> - <nl> - _getListKey ( ) : string { <nl> - return this . props . listKey | | this . _getCellKey ( ) ; <nl> - } <nl> - <nl> - _getDebugInfo ( ) : ListDebugInfo { <nl> - return { <nl> - listKey : this . _getListKey ( ) , <nl> - cellKey : this . _getCellKey ( ) , <nl> - horizontal : ! ! this . props . horizontal , <nl> - parent : this . context . virtualizedList <nl> - ? this . context . virtualizedList . debugInfo <nl> - : null , <nl> - } ; <nl> - } <nl> - <nl> - _getScrollMetrics = ( ) = > { <nl> - return this . _scrollMetrics ; <nl> - } ; <nl> - <nl> - hasMore ( ) : boolean { <nl> - return this . _hasMore ; <nl> - } <nl> - <nl> - _getOutermostParentListRef = ( ) = > { <nl> - if ( this . _isNestedWithSameOrientation ( ) ) { <nl> - return this . context . virtualizedList . getOutermostParentListRef ( ) ; <nl> - } else { <nl> - return this ; <nl> - } <nl> - } ; <nl> - <nl> - _getNestedChildState = ( key : string ) : ? ChildListState = > { <nl> - const existingChildData = this . _nestedChildLists . get ( key ) ; <nl> - return existingChildData & & existingChildData . state ; <nl> - } ; <nl> - <nl> - _registerAsNestedChild = ( childList : { <nl> - cellKey : string , <nl> - key : string , <nl> - ref : VirtualizedList , <nl> - parentDebugInfo : ListDebugInfo , <nl> - . . . <nl> - } ) : ? ChildListState = > { <nl> - / / Register the mapping between this child key and the cellKey for its cell <nl> - const childListsInCell = <nl> - this . _cellKeysToChildListKeys . get ( childList . cellKey ) | | new Set ( ) ; <nl> - childListsInCell . add ( childList . key ) ; <nl> - this . _cellKeysToChildListKeys . set ( childList . cellKey , childListsInCell ) ; <nl> - const existingChildData = this . _nestedChildLists . get ( childList . key ) ; <nl> - if ( existingChildData & & existingChildData . ref ! = = null ) { <nl> - console . error ( <nl> - ' A VirtualizedList contains a cell which itself contains ' + <nl> - ' more than one VirtualizedList of the same orientation as the parent ' + <nl> - ' list . You must pass a unique listKey prop to each sibling list . \ n \ n ' + <nl> - describeNestedLists ( { <nl> - . . . childList , <nl> - / / We ' re called from the child ' s componentDidMount , so it ' s safe to <nl> - / / read the child ' s props here ( albeit weird ) . <nl> - horizontal : ! ! childList . ref . props . horizontal , <nl> - } ) , <nl> - ) ; <nl> - } <nl> - this . _nestedChildLists . set ( childList . key , { <nl> - ref : childList . ref , <nl> - state : null , <nl> - } ) ; <nl> - <nl> - if ( this . _hasInteracted ) { <nl> - childList . ref . recordInteraction ( ) ; <nl> - } <nl> - } ; <nl> - <nl> - _unregisterAsNestedChild = ( childList : { <nl> - key : string , <nl> - state : ChildListState , <nl> - . . . <nl> - } ) : void = > { <nl> - this . _nestedChildLists . set ( childList . key , { <nl> - ref : null , <nl> - state : childList . state , <nl> - } ) ; <nl> - } ; <nl> - <nl> - state : State ; <nl> - <nl> - constructor ( props : Props , context : Object ) { <nl> - super ( props , context ) ; <nl> - invariant ( <nl> - / / $ FlowFixMe <nl> - ! props . onScroll | | ! props . onScroll . __isNative , <nl> - ' Components based on VirtualizedList must be wrapped with Animated . createAnimatedComponent ' + <nl> - ' to support native onScroll events with useNativeDriver ' , <nl> - ) ; <nl> - <nl> - invariant ( <nl> - props . windowSize > 0 , <nl> - ' VirtualizedList : The windowSize prop must be present and set to a value greater than 0 . ' , <nl> - ) ; <nl> - <nl> - this . _fillRateHelper = new FillRateHelper ( this . _getFrameMetrics ) ; <nl> - this . _updateCellsToRenderBatcher = new Batchinator ( <nl> - this . _updateCellsToRender , <nl> - this . props . updateCellsBatchingPeriod , <nl> - ) ; <nl> - <nl> - if ( this . props . viewabilityConfigCallbackPairs ) { <nl> - this . _viewabilityTuples = this . props . viewabilityConfigCallbackPairs . map ( <nl> - pair = > ( { <nl> - viewabilityHelper : new ViewabilityHelper ( pair . viewabilityConfig ) , <nl> - onViewableItemsChanged : pair . onViewableItemsChanged , <nl> - } ) , <nl> - ) ; <nl> - } else if ( this . props . onViewableItemsChanged ) { <nl> - this . _viewabilityTuples . push ( { <nl> - viewabilityHelper : new ViewabilityHelper ( this . props . viewabilityConfig ) , <nl> - onViewableItemsChanged : this . props . onViewableItemsChanged , <nl> - } ) ; <nl> - } <nl> - <nl> - let initialState = { <nl> - first : this . props . initialScrollIndex | | 0 , <nl> - last : <nl> - Math . min ( <nl> - this . props . getItemCount ( this . props . data ) , <nl> - ( this . props . initialScrollIndex | | 0 ) + this . props . initialNumToRender , <nl> - ) - 1 , <nl> - } ; <nl> - <nl> - if ( this . _isNestedWithSameOrientation ( ) ) { <nl> - const storedState = this . context . virtualizedList . getNestedChildState ( <nl> - this . _getListKey ( ) , <nl> - ) ; <nl> - if ( storedState ) { <nl> - initialState = storedState ; <nl> - this . state = storedState ; <nl> - this . _frames = storedState . frames ; <nl> - } <nl> - } <nl> - <nl> - this . state = initialState ; <nl> - } <nl> - <nl> - componentDidMount ( ) { <nl> - if ( this . _isNestedWithSameOrientation ( ) ) { <nl> - this . context . virtualizedList . registerAsNestedChild ( { <nl> - cellKey : this . _getCellKey ( ) , <nl> - key : this . _getListKey ( ) , <nl> - ref : this , <nl> - / / NOTE : When the child mounts ( here ) it ' s not necessarily safe to read <nl> - / / the parent ' s props . This is why we explicitly propagate debugInfo <nl> - / / " down " via context and " up " again via this method call on the <nl> - / / parent . <nl> - parentDebugInfo : this . context . virtualizedList . debugInfo , <nl> - } ) ; <nl> - } <nl> - } <nl> - <nl> - componentWillUnmount ( ) { <nl> - if ( this . _isNestedWithSameOrientation ( ) ) { <nl> - this . context . virtualizedList . unregisterAsNestedChild ( { <nl> - key : this . _getListKey ( ) , <nl> - state : { <nl> - first : this . state . first , <nl> - last : this . state . last , <nl> - frames : this . _frames , <nl> - } , <nl> - } ) ; <nl> - } <nl> - this . _updateViewableItems ( null ) ; <nl> - this . _updateCellsToRenderBatcher . dispose ( { abort : true } ) ; <nl> - this . _viewabilityTuples . forEach ( tuple = > { <nl> - tuple . viewabilityHelper . dispose ( ) ; <nl> - } ) ; <nl> - this . _fillRateHelper . deactivateAndFlush ( ) ; <nl> - } <nl> - <nl> - static getDerivedStateFromProps ( newProps : Props , prevState : State ) : State { <nl> - const { data , getItemCount , maxToRenderPerBatch } = newProps ; <nl> - / / first and last could be stale ( e . g . if a new , shorter items props is passed in ) , so we make <nl> - / / sure we ' re rendering a reasonable range here . <nl> - return { <nl> - first : Math . max ( <nl> - 0 , <nl> - Math . min ( prevState . first , getItemCount ( data ) - 1 - maxToRenderPerBatch ) , <nl> - ) , <nl> - last : Math . max ( 0 , Math . min ( prevState . last , getItemCount ( data ) - 1 ) ) , <nl> - } ; <nl> - } <nl> - <nl> - _pushCells ( <nl> - cells : Array < Object > , <nl> - stickyHeaderIndices : Array < number > , <nl> - stickyIndicesFromProps : Set < number > , <nl> - first : number , <nl> - last : number , <nl> - inversionStyle : ViewStyleProp , <nl> - ) { <nl> - const { <nl> - CellRendererComponent , <nl> - ItemSeparatorComponent , <nl> - data , <nl> - getItem , <nl> - getItemCount , <nl> - horizontal , <nl> - keyExtractor , <nl> - } = this . props ; <nl> - const stickyOffset = this . props . ListHeaderComponent ? 1 : 0 ; <nl> - const end = getItemCount ( data ) - 1 ; <nl> - let prevCellKey ; <nl> - last = Math . min ( end , last ) ; <nl> - for ( let ii = first ; ii < = last ; ii + + ) { <nl> - const item = getItem ( data , ii ) ; <nl> - const key = keyExtractor ( item , ii ) ; <nl> - this . _indicesToKeys . set ( ii , key ) ; <nl> - if ( stickyIndicesFromProps . has ( ii + stickyOffset ) ) { <nl> - stickyHeaderIndices . push ( cells . length ) ; <nl> - } <nl> - cells . push ( <nl> - < CellRenderer <nl> - CellRendererComponent = { CellRendererComponent } <nl> - ItemSeparatorComponent = { ii < end ? ItemSeparatorComponent : undefined } <nl> - cellKey = { key } <nl> - fillRateHelper = { this . _fillRateHelper } <nl> - horizontal = { horizontal } <nl> - index = { ii } <nl> - inversionStyle = { inversionStyle } <nl> - item = { item } <nl> - key = { key } <nl> - prevCellKey = { prevCellKey } <nl> - onUpdateSeparators = { this . _onUpdateSeparators } <nl> - onLayout = { e = > this . _onCellLayout ( e , key , ii ) } <nl> - onUnmount = { this . _onCellUnmount } <nl> - parentProps = { this . props } <nl> - ref = { ref = > { <nl> - this . _cellRefs [ key ] = ref ; <nl> - } } <nl> - / > , <nl> - ) ; <nl> - prevCellKey = key ; <nl> - } <nl> - } <nl> - <nl> - _onUpdateSeparators = ( keys : Array < ? string > , newProps : Object ) = > { <nl> - keys . forEach ( key = > { <nl> - const ref = key ! = null & & this . _cellRefs [ key ] ; <nl> - ref & & ref . updateSeparatorProps ( newProps ) ; <nl> - } ) ; <nl> - } ; <nl> - <nl> - _isVirtualizationDisabled ( ) : boolean { <nl> - return this . props . disableVirtualization | | false ; <nl> - } <nl> - <nl> - _isNestedWithSameOrientation ( ) : boolean { <nl> - const nestedContext = this . context . virtualizedList ; <nl> - return ! ! ( <nl> - nestedContext & & ! ! nestedContext . horizontal = = = ! ! this . props . horizontal <nl> - ) ; <nl> - } <nl> - <nl> - render ( ) : React . Node { <nl> - if ( __DEV__ ) { <nl> - const flatStyles = flattenStyle ( this . props . contentContainerStyle ) ; <nl> - warning ( <nl> - flatStyles = = null | | flatStyles . flexWrap ! = = ' wrap ' , <nl> - ' ` flexWrap : ` wrap ` ` is not supported with the ` VirtualizedList ` components . ' + <nl> - ' Consider using ` numColumns ` with ` FlatList ` instead . ' , <nl> - ) ; <nl> - } <nl> - const { <nl> - ListEmptyComponent , <nl> - ListFooterComponent , <nl> - ListHeaderComponent , <nl> - } = this . props ; <nl> - const { data , horizontal } = this . props ; <nl> - const isVirtualizationDisabled = this . _isVirtualizationDisabled ( ) ; <nl> - const inversionStyle = this . props . inverted <nl> - ? this . props . horizontal <nl> - ? styles . horizontallyInverted <nl> - : styles . verticallyInverted <nl> - : null ; <nl> - const cells = [ ] ; <nl> - const stickyIndicesFromProps = new Set ( this . props . stickyHeaderIndices ) ; <nl> - const stickyHeaderIndices = [ ] ; <nl> - if ( ListHeaderComponent ) { <nl> - if ( stickyIndicesFromProps . has ( 0 ) ) { <nl> - stickyHeaderIndices . push ( 0 ) ; <nl> - } <nl> - const element = React . isValidElement ( ListHeaderComponent ) ? ( <nl> - ListHeaderComponent <nl> - ) : ( <nl> - / / $ FlowFixMe <nl> - < ListHeaderComponent / > <nl> - ) ; <nl> - cells . push ( <nl> - < VirtualizedCellWrapper <nl> - cellKey = { this . _getCellKey ( ) + ' - header ' } <nl> - key = " $ header " > <nl> - < View <nl> - onLayout = { this . _onLayoutHeader } <nl> - style = { StyleSheet . compose ( <nl> - inversionStyle , <nl> - this . props . ListHeaderComponentStyle , <nl> - ) } > <nl> - { <nl> - / / $ FlowFixMe - Typing ReactNativeComponent revealed errors <nl> - element <nl> - } <nl> - < / View > <nl> - < / VirtualizedCellWrapper > , <nl> - ) ; <nl> - } <nl> - const itemCount = this . props . getItemCount ( data ) ; <nl> - if ( itemCount > 0 ) { <nl> - _usedIndexForKey = false ; <nl> - _keylessItemComponentName = ' ' ; <nl> - const spacerKey = ! horizontal ? ' height ' : ' width ' ; <nl> - const lastInitialIndex = this . props . initialScrollIndex <nl> - ? - 1 <nl> - : this . props . initialNumToRender - 1 ; <nl> - const { first , last } = this . state ; <nl> - this . _pushCells ( <nl> - cells , <nl> - stickyHeaderIndices , <nl> - stickyIndicesFromProps , <nl> - 0 , <nl> - lastInitialIndex , <nl> - inversionStyle , <nl> - ) ; <nl> - const firstAfterInitial = Math . max ( lastInitialIndex + 1 , first ) ; <nl> - if ( ! isVirtualizationDisabled & & first > lastInitialIndex + 1 ) { <nl> - let insertedStickySpacer = false ; <nl> - if ( stickyIndicesFromProps . size > 0 ) { <nl> - const stickyOffset = ListHeaderComponent ? 1 : 0 ; <nl> - / / See if there are any sticky headers in the virtualized space that we need to render . <nl> - for ( let ii = firstAfterInitial - 1 ; ii > lastInitialIndex ; ii - - ) { <nl> - if ( stickyIndicesFromProps . has ( ii + stickyOffset ) ) { <nl> - const initBlock = this . _getFrameMetricsApprox ( lastInitialIndex ) ; <nl> - const stickyBlock = this . _getFrameMetricsApprox ( ii ) ; <nl> - const leadSpace = <nl> - stickyBlock . offset - <nl> - initBlock . offset - <nl> - ( this . props . initialScrollIndex ? 0 : initBlock . length ) ; <nl> - cells . push ( <nl> - / * $ FlowFixMe ( > = 0 . 111 . 0 site = react_native_fb ) This comment <nl> - * suppresses an error found when Flow v0 . 111 was deployed . To <nl> - * see the error , delete this comment and run Flow . * / <nl> - < View key = " $ sticky_lead " style = { { [ spacerKey ] : leadSpace } } / > , <nl> - ) ; <nl> - this . _pushCells ( <nl> - cells , <nl> - stickyHeaderIndices , <nl> - stickyIndicesFromProps , <nl> - ii , <nl> - ii , <nl> - inversionStyle , <nl> - ) ; <nl> - const trailSpace = <nl> - this . _getFrameMetricsApprox ( first ) . offset - <nl> - ( stickyBlock . offset + stickyBlock . length ) ; <nl> - cells . push ( <nl> - / * $ FlowFixMe ( > = 0 . 111 . 0 site = react_native_fb ) This comment <nl> - * suppresses an error found when Flow v0 . 111 was deployed . To <nl> - * see the error , delete this comment and run Flow . * / <nl> - < View key = " $ sticky_trail " style = { { [ spacerKey ] : trailSpace } } / > , <nl> - ) ; <nl> - insertedStickySpacer = true ; <nl> - break ; <nl> - } <nl> - } <nl> - } <nl> - if ( ! insertedStickySpacer ) { <nl> - const initBlock = this . _getFrameMetricsApprox ( lastInitialIndex ) ; <nl> - const firstSpace = <nl> - this . _getFrameMetricsApprox ( first ) . offset - <nl> - ( initBlock . offset + initBlock . length ) ; <nl> - cells . push ( <nl> - / * $ FlowFixMe ( > = 0 . 111 . 0 site = react_native_fb ) This comment <nl> - * suppresses an error found when Flow v0 . 111 was deployed . To see <nl> - * the error , delete this comment and run Flow . * / <nl> - < View key = " $ lead_spacer " style = { { [ spacerKey ] : firstSpace } } / > , <nl> - ) ; <nl> - } <nl> - } <nl> - this . _pushCells ( <nl> - cells , <nl> - stickyHeaderIndices , <nl> - stickyIndicesFromProps , <nl> - firstAfterInitial , <nl> - last , <nl> - inversionStyle , <nl> - ) ; <nl> - if ( ! this . _hasWarned . keys & & _usedIndexForKey ) { <nl> - console . warn ( <nl> - ' VirtualizedList : missing keys for items , make sure to specify a key or id property on each ' + <nl> - ' item or provide a custom keyExtractor . ' , <nl> - _keylessItemComponentName , <nl> - ) ; <nl> - this . _hasWarned . keys = true ; <nl> - } <nl> - if ( ! isVirtualizationDisabled & & last < itemCount - 1 ) { <nl> - const lastFrame = this . _getFrameMetricsApprox ( last ) ; <nl> - / / Without getItemLayout , we limit our tail spacer to the _highestMeasuredFrameIndex to <nl> - / / prevent the user for hyperscrolling into un - measured area because otherwise content will <nl> - / / likely jump around as it renders in above the viewport . <nl> - const end = this . props . getItemLayout <nl> - ? itemCount - 1 <nl> - : Math . min ( itemCount - 1 , this . _highestMeasuredFrameIndex ) ; <nl> - const endFrame = this . _getFrameMetricsApprox ( end ) ; <nl> - const tailSpacerLength = <nl> - endFrame . offset + <nl> - endFrame . length - <nl> - ( lastFrame . offset + lastFrame . length ) ; <nl> - cells . push ( <nl> - / * $ FlowFixMe ( > = 0 . 111 . 0 site = react_native_fb ) This comment suppresses <nl> - * an error found when Flow v0 . 111 was deployed . To see the error , <nl> - * delete this comment and run Flow . * / <nl> - < View key = " $ tail_spacer " style = { { [ spacerKey ] : tailSpacerLength } } / > , <nl> - ) ; <nl> - } <nl> - } else if ( ListEmptyComponent ) { <nl> - const element : React . Element < any > = ( ( React . isValidElement ( <nl> - ListEmptyComponent , <nl> - ) ? ( <nl> - ListEmptyComponent <nl> - ) : ( <nl> - / / $ FlowFixMe <nl> - < ListEmptyComponent / > <nl> - ) ) : any ) ; <nl> - cells . push ( <nl> - React . cloneElement ( element , { <nl> - key : ' $ empty ' , <nl> - onLayout : event = > { <nl> - this . _onLayoutEmpty ( event ) ; <nl> - if ( element . props . onLayout ) { <nl> - element . props . onLayout ( event ) ; <nl> - } <nl> - } , <nl> - style : StyleSheet . compose ( <nl> - inversionStyle , <nl> - element . props . style , <nl> - ) , <nl> - } ) , <nl> - ) ; <nl> - } <nl> - if ( ListFooterComponent ) { <nl> - const element = React . isValidElement ( ListFooterComponent ) ? ( <nl> - ListFooterComponent <nl> - ) : ( <nl> - / / $ FlowFixMe <nl> - < ListFooterComponent / > <nl> - ) ; <nl> - cells . push ( <nl> - < VirtualizedCellWrapper <nl> - cellKey = { this . _getFooterCellKey ( ) } <nl> - key = " $ footer " > <nl> - < View <nl> - onLayout = { this . _onLayoutFooter } <nl> - style = { StyleSheet . compose ( <nl> - inversionStyle , <nl> - this . props . ListFooterComponentStyle , <nl> - ) } > <nl> - { <nl> - / / $ FlowFixMe - Typing ReactNativeComponent revealed errors <nl> - element <nl> - } <nl> - < / View > <nl> - < / VirtualizedCellWrapper > , <nl> - ) ; <nl> - } <nl> - const scrollProps = { <nl> - . . . this . props , <nl> - onContentSizeChange : this . _onContentSizeChange , <nl> - onLayout : this . _onLayout , <nl> - onScroll : this . _onScroll , <nl> - onScrollBeginDrag : this . _onScrollBeginDrag , <nl> - onScrollEndDrag : this . _onScrollEndDrag , <nl> - onMomentumScrollEnd : this . _onMomentumScrollEnd , <nl> - scrollEventThrottle : this . props . scrollEventThrottle , / / TODO : Android support <nl> - invertStickyHeaders : <nl> - this . props . invertStickyHeaders ! = = undefined <nl> - ? this . props . invertStickyHeaders <nl> - : this . props . inverted , <nl> - stickyHeaderIndices , <nl> - style : inversionStyle <nl> - ? [ inversionStyle , this . props . style ] <nl> - : this . props . style , <nl> - } ; <nl> - <nl> - this . _hasMore = <nl> - this . state . last < this . props . getItemCount ( this . props . data ) - 1 ; <nl> - <nl> - const ret = React . cloneElement ( <nl> - ( this . props . renderScrollComponent | | this . _defaultRenderScrollComponent ) ( <nl> - scrollProps , <nl> - ) , <nl> - { <nl> - ref : this . _captureScrollRef , <nl> - } , <nl> - cells , <nl> - ) ; <nl> - if ( this . props . debug ) { <nl> - return ( <nl> - < View style = { styles . debug } > <nl> - { ret } <nl> - { this . _renderDebugOverlay ( ) } <nl> - < / View > <nl> - ) ; <nl> - } else { <nl> - return ret ; <nl> - } <nl> - } <nl> - <nl> - componentDidUpdate ( prevProps : Props ) { <nl> - const { data , extraData } = this . props ; <nl> - if ( data ! = = prevProps . data | | extraData ! = = prevProps . extraData ) { <nl> - / / clear the viewableIndices cache to also trigger <nl> - / / the onViewableItemsChanged callback with the new data <nl> - this . _viewabilityTuples . forEach ( tuple = > { <nl> - tuple . viewabilityHelper . resetViewableIndices ( ) ; <nl> - } ) ; <nl> - } <nl> - / / The ` this . _hiPriInProgress ` is guaranteeing a hiPri cell update will only happen <nl> - / / once per fiber update . The ` _scheduleCellsToRenderUpdate ` will set it to true <nl> - / / if a hiPri update needs to perform . If ` componentDidUpdate ` is triggered with <nl> - / / ` this . _hiPriInProgress = true ` , means it ' s triggered by the hiPri update . The <nl> - / / ` _scheduleCellsToRenderUpdate ` will check this condition and not perform <nl> - / / another hiPri update . <nl> - const hiPriInProgress = this . _hiPriInProgress ; <nl> - this . _scheduleCellsToRenderUpdate ( ) ; <nl> - / / Make sure setting ` this . _hiPriInProgress ` back to false after ` componentDidUpdate ` <nl> - / / is triggered with ` this . _hiPriInProgress = true ` <nl> - if ( hiPriInProgress ) { <nl> - this . _hiPriInProgress = false ; <nl> - } <nl> - } <nl> - <nl> - _averageCellLength = 0 ; <nl> - / / Maps a cell key to the set of keys for all outermost child lists within that cell <nl> - _cellKeysToChildListKeys : Map < string , Set < string > > = new Map ( ) ; <nl> - _cellRefs = { } ; <nl> - _fillRateHelper : FillRateHelper ; <nl> - _frames = { } ; <nl> - _footerLength = 0 ; <nl> - _hasDoneInitialScroll = false ; <nl> - _hasInteracted = false ; <nl> - _hasMore = false ; <nl> - _hasWarned = { } ; <nl> - _headerLength = 0 ; <nl> - _hiPriInProgress : boolean = false ; / / flag to prevent infinite hiPri cell limit update <nl> - _highestMeasuredFrameIndex = 0 ; <nl> - _indicesToKeys : Map < number , string > = new Map ( ) ; <nl> - _nestedChildLists : Map < <nl> - string , <nl> - { <nl> - ref : ? VirtualizedList , <nl> - state : ? ChildListState , <nl> - . . . <nl> - } , <nl> - > = new Map ( ) ; <nl> - _offsetFromParentVirtualizedList : number = 0 ; <nl> - _prevParentOffset : number = 0 ; <nl> - _scrollMetrics = { <nl> - contentLength : 0 , <nl> - dOffset : 0 , <nl> - dt : 10 , <nl> - offset : 0 , <nl> - timestamp : 0 , <nl> - velocity : 0 , <nl> - visibleLength : 0 , <nl> - } ; <nl> - _scrollRef : ? React . ElementRef < any > = null ; <nl> - _sentEndForContentLength = 0 ; <nl> - _totalCellLength = 0 ; <nl> - _totalCellsMeasured = 0 ; <nl> - _updateCellsToRenderBatcher : Batchinator ; <nl> - _viewabilityTuples : Array < ViewabilityHelperCallbackTuple > = [ ] ; <nl> - <nl> - _captureScrollRef = ref = > { <nl> - this . _scrollRef = ref ; <nl> - } ; <nl> - <nl> - _computeBlankness ( ) { <nl> - this . _fillRateHelper . computeBlankness ( <nl> - this . props , <nl> - this . state , <nl> - this . _scrollMetrics , <nl> - ) ; <nl> - } <nl> - <nl> - _defaultRenderScrollComponent = props = > { <nl> - const onRefresh = props . onRefresh ; <nl> - if ( this . _isNestedWithSameOrientation ( ) ) { <nl> - / / $ FlowFixMe - Typing ReactNativeComponent revealed errors <nl> - return < View { . . . props } / > ; <nl> - } else if ( onRefresh ) { <nl> - invariant ( <nl> - typeof props . refreshing = = = ' boolean ' , <nl> - ' ` refreshing ` prop must be set as a boolean in order to use ` onRefresh ` , but got ` ' + <nl> - / * $ FlowFixMe ( > = 0 . 111 . 0 site = react_native_fb ) This comment suppresses <nl> - * an error found when Flow v0 . 111 was deployed . To see the error , <nl> - * delete this comment and run Flow . * / <nl> - JSON . stringify ( props . refreshing ) + <nl> - ' ` ' , <nl> - ) ; <nl> - return ( <nl> - / / $ FlowFixMe Invalid prop usage <nl> - < ScrollView <nl> - { . . . props } <nl> - refreshControl = { <nl> - props . refreshControl = = null ? ( <nl> - < RefreshControl <nl> - refreshing = { props . refreshing } <nl> - onRefresh = { onRefresh } <nl> - progressViewOffset = { props . progressViewOffset } <nl> - / > <nl> - ) : ( <nl> - props . refreshControl <nl> - ) <nl> - } <nl> - / > <nl> - ) ; <nl> - } else { <nl> - / / $ FlowFixMe Invalid prop usage <nl> - return < ScrollView { . . . props } / > ; <nl> - } <nl> - } ; <nl> - <nl> - _onCellLayout ( e , cellKey , index ) { <nl> - const layout = e . nativeEvent . layout ; <nl> - const next = { <nl> - offset : this . _selectOffset ( layout ) , <nl> - length : this . _selectLength ( layout ) , <nl> - index , <nl> - inLayout : true , <nl> - } ; <nl> - const curr = this . _frames [ cellKey ] ; <nl> - if ( <nl> - ! curr | | <nl> - next . offset ! = = curr . offset | | <nl> - next . length ! = = curr . length | | <nl> - index ! = = curr . index <nl> - ) { <nl> - this . _totalCellLength + = next . length - ( curr ? curr . length : 0 ) ; <nl> - this . _totalCellsMeasured + = curr ? 0 : 1 ; <nl> - this . _averageCellLength = <nl> - this . _totalCellLength / this . _totalCellsMeasured ; <nl> - this . _frames [ cellKey ] = next ; <nl> - this . _highestMeasuredFrameIndex = Math . max ( <nl> - this . _highestMeasuredFrameIndex , <nl> - index , <nl> - ) ; <nl> - this . _scheduleCellsToRenderUpdate ( ) ; <nl> - } else { <nl> - this . _frames [ cellKey ] . inLayout = true ; <nl> - } <nl> - <nl> - this . _triggerRemeasureForChildListsInCell ( cellKey ) ; <nl> - <nl> - this . _computeBlankness ( ) ; <nl> - this . _updateViewableItems ( this . props . data ) ; <nl> - } <nl> - <nl> - _onCellUnmount = ( cellKey : string ) = > { <nl> - const curr = this . _frames [ cellKey ] ; <nl> - if ( curr ) { <nl> - this . _frames [ cellKey ] = { . . . curr , inLayout : false } ; <nl> - } <nl> - } ; <nl> - <nl> - _triggerRemeasureForChildListsInCell ( cellKey : string ) : void { <nl> - const childListKeys = this . _cellKeysToChildListKeys . get ( cellKey ) ; <nl> - if ( childListKeys ) { <nl> - for ( let childKey of childListKeys ) { <nl> - const childList = this . _nestedChildLists . get ( childKey ) ; <nl> - childList & & <nl> - childList . ref & & <nl> - childList . ref . measureLayoutRelativeToContainingList ( ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - measureLayoutRelativeToContainingList ( ) : void { <nl> - / / TODO ( T35574538 ) : findNodeHandle sometimes crashes with " Unable to find <nl> - / / node on an unmounted component " during scrolling <nl> - try { <nl> - if ( ! this . _scrollRef ) { <nl> - return ; <nl> - } <nl> - / / We are assuming that getOutermostParentListRef ( ) . getScrollRef ( ) <nl> - / / is a non - null reference to a ScrollView <nl> - this . _scrollRef . measureLayout ( <nl> - this . context . virtualizedList . getOutermostParentListRef ( ) . getScrollRef ( ) , <nl> - ( x , y , width , height ) = > { <nl> - this . _offsetFromParentVirtualizedList = this . _selectOffset ( { x , y } ) ; <nl> - this . _scrollMetrics . contentLength = this . _selectLength ( { <nl> - width , <nl> - height , <nl> - } ) ; <nl> - const scrollMetrics = this . _convertParentScrollMetrics ( <nl> - this . context . virtualizedList . getScrollMetrics ( ) , <nl> - ) ; <nl> - this . _scrollMetrics . visibleLength = scrollMetrics . visibleLength ; <nl> - this . _scrollMetrics . offset = scrollMetrics . offset ; <nl> - } , <nl> - error = > { <nl> - console . warn ( <nl> - " VirtualizedList : Encountered an error while measuring a list ' s " + <nl> - ' offset from its containing VirtualizedList . ' , <nl> - ) ; <nl> - } , <nl> - ) ; <nl> - } catch ( error ) { <nl> - console . warn ( <nl> - ' measureLayoutRelativeToContainingList threw an error ' , <nl> - error . stack , <nl> - ) ; <nl> - } <nl> - } <nl> - <nl> - _onLayout = ( e : Object ) = > { <nl> - if ( this . _isNestedWithSameOrientation ( ) ) { <nl> - / / Need to adjust our scroll metrics to be relative to our containing <nl> - / / VirtualizedList before we can make claims about list item viewability <nl> - this . measureLayoutRelativeToContainingList ( ) ; <nl> - } else { <nl> - this . _scrollMetrics . visibleLength = this . _selectLength ( <nl> - e . nativeEvent . layout , <nl> - ) ; <nl> - } <nl> - this . props . onLayout & & this . props . onLayout ( e ) ; <nl> - this . _scheduleCellsToRenderUpdate ( ) ; <nl> - this . _maybeCallOnEndReached ( ) ; <nl> - } ; <nl> - <nl> - _onLayoutEmpty = e = > { <nl> - this . props . onLayout & & this . props . onLayout ( e ) ; <nl> - } ; <nl> - <nl> - _getFooterCellKey ( ) : string { <nl> - return this . _getCellKey ( ) + ' - footer ' ; <nl> - } <nl> - <nl> - _onLayoutFooter = e = > { <nl> - this . _triggerRemeasureForChildListsInCell ( this . _getFooterCellKey ( ) ) ; <nl> - this . _footerLength = this . _selectLength ( e . nativeEvent . layout ) ; <nl> - } ; <nl> - <nl> - _onLayoutHeader = e = > { <nl> - this . _headerLength = this . _selectLength ( e . nativeEvent . layout ) ; <nl> - } ; <nl> - <nl> - _renderDebugOverlay ( ) { <nl> - const normalize = <nl> - this . _scrollMetrics . visibleLength / <nl> - ( this . _scrollMetrics . contentLength | | 1 ) ; <nl> - const framesInLayout = [ ] ; <nl> - const itemCount = this . props . getItemCount ( this . props . data ) ; <nl> - for ( let ii = 0 ; ii < itemCount ; ii + + ) { <nl> - const frame = this . _getFrameMetricsApprox ( ii ) ; <nl> - / * $ FlowFixMe ( > = 0 . 68 . 0 site = react_native_fb ) This comment suppresses an <nl> - * error found when Flow v0 . 68 was deployed . To see the error delete this <nl> - * comment and run Flow . * / <nl> - if ( frame . inLayout ) { <nl> - framesInLayout . push ( frame ) ; <nl> - } <nl> - } <nl> - const windowTop = this . _getFrameMetricsApprox ( this . state . first ) . offset ; <nl> - const frameLast = this . _getFrameMetricsApprox ( this . state . last ) ; <nl> - const windowLen = frameLast . offset + frameLast . length - windowTop ; <nl> - const visTop = this . _scrollMetrics . offset ; <nl> - const visLen = this . _scrollMetrics . visibleLength ; <nl> - <nl> - return ( <nl> - < View style = { [ styles . debugOverlayBase , styles . debugOverlay ] } > <nl> - { framesInLayout . map ( ( f , ii ) = > ( <nl> - < View <nl> - key = { ' f ' + ii } <nl> - style = { [ <nl> - styles . debugOverlayBase , <nl> - styles . debugOverlayFrame , <nl> - { <nl> - top : f . offset * normalize , <nl> - height : f . length * normalize , <nl> - } , <nl> - ] } <nl> - / > <nl> - ) ) } <nl> - < View <nl> - style = { [ <nl> - styles . debugOverlayBase , <nl> - styles . debugOverlayFrameLast , <nl> - { <nl> - top : windowTop * normalize , <nl> - height : windowLen * normalize , <nl> - } , <nl> - ] } <nl> - / > <nl> - < View <nl> - style = { [ <nl> - styles . debugOverlayBase , <nl> - styles . debugOverlayFrameVis , <nl> - { <nl> - top : visTop * normalize , <nl> - height : visLen * normalize , <nl> - } , <nl> - ] } <nl> - / > <nl> - < / View > <nl> - ) ; <nl> - } <nl> - <nl> - _selectLength ( <nl> - metrics : $ ReadOnly < { <nl> - height : number , <nl> - width : number , <nl> - . . . <nl> - } > , <nl> - ) : number { <nl> - return ! this . props . horizontal ? metrics . height : metrics . width ; <nl> - } <nl> - <nl> - _selectOffset ( <nl> - metrics : $ ReadOnly < { <nl> - x : number , <nl> - y : number , <nl> - . . . <nl> - } > , <nl> - ) : number { <nl> - return ! this . props . horizontal ? metrics . y : metrics . x ; <nl> - } <nl> - <nl> - _maybeCallOnEndReached ( ) { <nl> - const { <nl> - data , <nl> - getItemCount , <nl> - onEndReached , <nl> - onEndReachedThreshold , <nl> - } = this . props ; <nl> - const { contentLength , visibleLength , offset } = this . _scrollMetrics ; <nl> - const distanceFromEnd = contentLength - visibleLength - offset ; <nl> - const threshold = onEndReachedThreshold <nl> - ? onEndReachedThreshold * visibleLength <nl> - : 0 ; <nl> - if ( <nl> - onEndReached & & <nl> - this . state . last = = = getItemCount ( data ) - 1 & & <nl> - distanceFromEnd < threshold & & <nl> - this . _scrollMetrics . contentLength ! = = this . _sentEndForContentLength <nl> - ) { <nl> - / / Only call onEndReached once for a given content length <nl> - this . _sentEndForContentLength = this . _scrollMetrics . contentLength ; <nl> - onEndReached ( { distanceFromEnd } ) ; <nl> - } else if ( distanceFromEnd > threshold ) { <nl> - / / If the user scrolls away from the end and back again cause <nl> - / / an onEndReached to be triggered again <nl> - this . _sentEndForContentLength = 0 ; <nl> - } <nl> - } <nl> - <nl> - _onContentSizeChange = ( width : number , height : number ) = > { <nl> - if ( <nl> - width > 0 & & <nl> - height > 0 & & <nl> - this . props . initialScrollIndex ! = null & & <nl> - this . props . initialScrollIndex > 0 & & <nl> - ! this . _hasDoneInitialScroll <nl> - ) { <nl> - this . scrollToIndex ( { <nl> - animated : false , <nl> - index : this . props . initialScrollIndex , <nl> - } ) ; <nl> - this . _hasDoneInitialScroll = true ; <nl> - } <nl> - if ( this . props . onContentSizeChange ) { <nl> - this . props . onContentSizeChange ( width , height ) ; <nl> - } <nl> - this . _scrollMetrics . contentLength = this . _selectLength ( { height , width } ) ; <nl> - this . _scheduleCellsToRenderUpdate ( ) ; <nl> - this . _maybeCallOnEndReached ( ) ; <nl> - } ; <nl> - <nl> - / * Translates metrics from a scroll event in a parent VirtualizedList into <nl> - * coordinates relative to the child list . <nl> - * / <nl> - _convertParentScrollMetrics = ( metrics : { <nl> - visibleLength : number , <nl> - offset : number , <nl> - . . . <nl> - } ) = > { <nl> - / / Offset of the top of the nested list relative to the top of its parent ' s viewport <nl> - const offset = metrics . offset - this . _offsetFromParentVirtualizedList ; <nl> - / / Child ' s visible length is the same as its parent ' s <nl> - const visibleLength = metrics . visibleLength ; <nl> - const dOffset = offset - this . _scrollMetrics . offset ; <nl> - const contentLength = this . _scrollMetrics . contentLength ; <nl> - <nl> - return { <nl> - visibleLength , <nl> - contentLength , <nl> - offset , <nl> - dOffset , <nl> - } ; <nl> - } ; <nl> - <nl> - _onScroll = ( e : Object ) = > { <nl> - this . _nestedChildLists . forEach ( childList = > { <nl> - childList . ref & & childList . ref . _onScroll ( e ) ; <nl> - } ) ; <nl> - if ( this . props . onScroll ) { <nl> - this . props . onScroll ( e ) ; <nl> - } <nl> - const timestamp = e . timeStamp ; <nl> - let visibleLength = this . _selectLength ( e . nativeEvent . layoutMeasurement ) ; <nl> - let contentLength = this . _selectLength ( e . nativeEvent . contentSize ) ; <nl> - let offset = this . _selectOffset ( e . nativeEvent . contentOffset ) ; <nl> - let dOffset = offset - this . _scrollMetrics . offset ; <nl> - <nl> - if ( this . _isNestedWithSameOrientation ( ) ) { <nl> - if ( this . _scrollMetrics . contentLength = = = 0 ) { <nl> - / / Ignore scroll events until onLayout has been called and we <nl> - / / know our offset from our offset from our parent <nl> - return ; <nl> - } <nl> - ( { <nl> - visibleLength , <nl> - contentLength , <nl> - offset , <nl> - dOffset , <nl> - } = this . _convertParentScrollMetrics ( { <nl> - visibleLength , <nl> - offset , <nl> - } ) ) ; <nl> - } <nl> - <nl> - const dt = this . _scrollMetrics . timestamp <nl> - ? Math . max ( 1 , timestamp - this . _scrollMetrics . timestamp ) <nl> - : 1 ; <nl> - const velocity = dOffset / dt ; <nl> - <nl> - if ( <nl> - dt > 500 & & <nl> - this . _scrollMetrics . dt > 500 & & <nl> - contentLength > 5 * visibleLength & & <nl> - ! this . _hasWarned . perf <nl> - ) { <nl> - infoLog ( <nl> - ' VirtualizedList : You have a large list that is slow to update - make sure your ' + <nl> - ' renderItem function renders components that follow React performance best practices ' + <nl> - ' like PureComponent , shouldComponentUpdate , etc . ' , <nl> - { dt , prevDt : this . _scrollMetrics . dt , contentLength } , <nl> - ) ; <nl> - this . _hasWarned . perf = true ; <nl> - } <nl> - this . _scrollMetrics = { <nl> - contentLength , <nl> - dt , <nl> - dOffset , <nl> - offset , <nl> - timestamp , <nl> - velocity , <nl> - visibleLength , <nl> - } ; <nl> - this . _updateViewableItems ( this . props . data ) ; <nl> - if ( ! this . props ) { <nl> - return ; <nl> - } <nl> - this . _maybeCallOnEndReached ( ) ; <nl> - if ( velocity ! = = 0 ) { <nl> - this . _fillRateHelper . activate ( ) ; <nl> - } <nl> - this . _computeBlankness ( ) ; <nl> - this . _scheduleCellsToRenderUpdate ( ) ; <nl> - } ; <nl> - <nl> - _scheduleCellsToRenderUpdate ( ) { <nl> - const { first , last } = this . state ; <nl> - const { offset , visibleLength , velocity } = this . _scrollMetrics ; <nl> - const itemCount = this . props . getItemCount ( this . props . data ) ; <nl> - let hiPri = false ; <nl> - const scrollingThreshold = <nl> - / * $ FlowFixMe ( > = 0 . 63 . 0 site = react_native_fb ) This comment suppresses an <nl> - * error found when Flow v0 . 63 was deployed . To see the error delete <nl> - * this comment and run Flow . * / <nl> - ( this . props . onEndReachedThreshold * visibleLength ) / 2 ; <nl> - / / Mark as high priority if we ' re close to the start of the first item <nl> - / / But only if there are items before the first rendered item <nl> - if ( first > 0 ) { <nl> - const distTop = offset - this . _getFrameMetricsApprox ( first ) . offset ; <nl> - hiPri = <nl> - hiPri | | distTop < 0 | | ( velocity < - 2 & & distTop < scrollingThreshold ) ; <nl> - } <nl> - / / Mark as high priority if we ' re close to the end of the last item <nl> - / / But only if there are items after the last rendered item <nl> - if ( last < itemCount - 1 ) { <nl> - const distBottom = <nl> - this . _getFrameMetricsApprox ( last ) . offset - ( offset + visibleLength ) ; <nl> - hiPri = <nl> - hiPri | | <nl> - distBottom < 0 | | <nl> - ( velocity > 2 & & distBottom < scrollingThreshold ) ; <nl> - } <nl> - / / Only trigger high - priority updates if we ' ve actually rendered cells , <nl> - / / and with that size estimate , accurately compute how many cells we should render . <nl> - / / Otherwise , it would just render as many cells as it can ( of zero dimension ) , <nl> - / / each time through attempting to render more ( limited by maxToRenderPerBatch ) , <nl> - / / starving the renderer from actually laying out the objects and computing _averageCellLength . <nl> - / / If this is triggered in an ` componentDidUpdate ` followed by a hiPri cellToRenderUpdate <nl> - / / We shouldn ' t do another hipri cellToRenderUpdate <nl> - if ( <nl> - hiPri & & <nl> - ( this . _averageCellLength | | this . props . getItemLayout ) & & <nl> - ! this . _hiPriInProgress <nl> - ) { <nl> - this . _hiPriInProgress = true ; <nl> - / / Don ' t worry about interactions when scrolling quickly ; focus on filling content as fast <nl> - / / as possible . <nl> - this . _updateCellsToRenderBatcher . dispose ( { abort : true } ) ; <nl> - this . _updateCellsToRender ( ) ; <nl> - return ; <nl> - } else { <nl> - this . _updateCellsToRenderBatcher . schedule ( ) ; <nl> - } <nl> - } <nl> - <nl> - _onScrollBeginDrag = ( e ) : void = > { <nl> - this . _nestedChildLists . forEach ( childList = > { <nl> - childList . ref & & childList . ref . _onScrollBeginDrag ( e ) ; <nl> - } ) ; <nl> - this . _viewabilityTuples . forEach ( tuple = > { <nl> - tuple . viewabilityHelper . recordInteraction ( ) ; <nl> - } ) ; <nl> - this . _hasInteracted = true ; <nl> - this . props . onScrollBeginDrag & & this . props . onScrollBeginDrag ( e ) ; <nl> - } ; <nl> - <nl> - _onScrollEndDrag = ( e ) : void = > { <nl> - const { velocity } = e . nativeEvent ; <nl> - if ( velocity ) { <nl> - this . _scrollMetrics . velocity = this . _selectOffset ( velocity ) ; <nl> - } <nl> - this . _computeBlankness ( ) ; <nl> - this . props . onScrollEndDrag & & this . props . onScrollEndDrag ( e ) ; <nl> - } ; <nl> - <nl> - _onMomentumScrollEnd = ( e ) : void = > { <nl> - this . _scrollMetrics . velocity = 0 ; <nl> - this . _computeBlankness ( ) ; <nl> - this . props . onMomentumScrollEnd & & this . props . onMomentumScrollEnd ( e ) ; <nl> - } ; <nl> - <nl> - _updateCellsToRender = ( ) = > { <nl> - const { data , getItemCount , onEndReachedThreshold } = this . props ; <nl> - const isVirtualizationDisabled = this . _isVirtualizationDisabled ( ) ; <nl> - this . _updateViewableItems ( data ) ; <nl> - if ( ! data ) { <nl> - return ; <nl> - } <nl> - this . setState ( state = > { <nl> - let newState ; <nl> - const { contentLength , offset , visibleLength } = this . _scrollMetrics ; <nl> - if ( ! isVirtualizationDisabled ) { <nl> - / / If we run this with bogus data , we ' ll force - render window { first : 0 , last : 0 } , <nl> - / / and wipe out the initialNumToRender rendered elements . <nl> - / / So let ' s wait until the scroll view metrics have been set up . And until then , <nl> - / / we will trust the initialNumToRender suggestion <nl> - if ( visibleLength > 0 & & contentLength > 0 ) { <nl> - / / If we have a non - zero initialScrollIndex and run this before we ' ve scrolled , <nl> - / / we ' ll wipe out the initialNumToRender rendered elements starting at initialScrollIndex . <nl> - / / So let ' s wait until we ' ve scrolled the view to the right place . And until then , <nl> - / / we will trust the initialScrollIndex suggestion . <nl> - if ( ! this . props . initialScrollIndex | | this . _scrollMetrics . offset ) { <nl> - newState = computeWindowedRenderLimits ( <nl> - this . props , <nl> - state , <nl> - this . _getFrameMetricsApprox , <nl> - this . _scrollMetrics , <nl> - ) ; <nl> - } <nl> - } <nl> - } else { <nl> - const distanceFromEnd = contentLength - visibleLength - offset ; <nl> - const renderAhead = <nl> - / * $ FlowFixMe ( > = 0 . 63 . 0 site = react_native_fb ) This comment suppresses <nl> - * an error found when Flow v0 . 63 was deployed . To see the error <nl> - * delete this comment and run Flow . * / <nl> - distanceFromEnd < onEndReachedThreshold * visibleLength <nl> - ? this . props . maxToRenderPerBatch <nl> - : 0 ; <nl> - newState = { <nl> - first : 0 , <nl> - last : Math . min ( state . last + renderAhead , getItemCount ( data ) - 1 ) , <nl> - } ; <nl> - } <nl> - if ( newState & & this . _nestedChildLists . size > 0 ) { <nl> - const newFirst = newState . first ; <nl> - const newLast = newState . last ; <nl> - / / If some cell in the new state has a child list in it , we should only render <nl> - / / up through that item , so that we give that list a chance to render . <nl> - / / Otherwise there ' s churn from multiple child lists mounting and un - mounting <nl> - / / their items . <nl> - for ( let ii = newFirst ; ii < = newLast ; ii + + ) { <nl> - const cellKeyForIndex = this . _indicesToKeys . get ( ii ) ; <nl> - const childListKeys = <nl> - cellKeyForIndex & & <nl> - this . _cellKeysToChildListKeys . get ( cellKeyForIndex ) ; <nl> - if ( ! childListKeys ) { <nl> - continue ; <nl> - } <nl> - let someChildHasMore = false ; <nl> - / / For each cell , need to check whether any child list in it has more elements to render <nl> - for ( let childKey of childListKeys ) { <nl> - const childList = this . _nestedChildLists . get ( childKey ) ; <nl> - if ( childList & & childList . ref & & childList . ref . hasMore ( ) ) { <nl> - someChildHasMore = true ; <nl> - break ; <nl> - } <nl> - } <nl> - if ( someChildHasMore ) { <nl> - newState . last = ii ; <nl> - break ; <nl> - } <nl> - } <nl> - } <nl> - if ( <nl> - newState ! = null & & <nl> - newState . first = = = state . first & & <nl> - newState . last = = = state . last <nl> - ) { <nl> - newState = null ; <nl> - } <nl> - return newState ; <nl> - } ) ; <nl> - } ; <nl> - <nl> - _createViewToken = ( index : number , isViewable : boolean ) = > { <nl> - const { data , getItem , keyExtractor } = this . props ; <nl> - const item = getItem ( data , index ) ; <nl> - return { index , item , key : keyExtractor ( item , index ) , isViewable } ; <nl> - } ; <nl> - <nl> - _getFrameMetricsApprox = ( <nl> - index : number , <nl> - ) : { <nl> - length : number , <nl> - offset : number , <nl> - . . . <nl> - } = > { <nl> - const frame = this . _getFrameMetrics ( index ) ; <nl> - if ( frame & & frame . index = = = index ) { <nl> - / / check for invalid frames due to row re - ordering <nl> - return frame ; <nl> - } else { <nl> - const { getItemLayout } = this . props ; <nl> - invariant ( <nl> - ! getItemLayout , <nl> - ' Should not have to estimate frames when a measurement metrics function is provided ' , <nl> - ) ; <nl> - return { <nl> - length : this . _averageCellLength , <nl> - offset : this . _averageCellLength * index , <nl> - } ; <nl> - } <nl> - } ; <nl> - <nl> - _getFrameMetrics = ( <nl> - index : number , <nl> - ) : ? { <nl> - length : number , <nl> - offset : number , <nl> - index : number , <nl> - inLayout ? : boolean , <nl> - . . . <nl> - } = > { <nl> - const { <nl> - data , <nl> - getItem , <nl> - getItemCount , <nl> - getItemLayout , <nl> - keyExtractor , <nl> - } = this . props ; <nl> - invariant ( <nl> - getItemCount ( data ) > index , <nl> - ' Tried to get frame for out of range index ' + index , <nl> - ) ; <nl> - const item = getItem ( data , index ) ; <nl> - let frame = item & & this . _frames [ keyExtractor ( item , index ) ] ; <nl> - if ( ! frame | | frame . index ! = = index ) { <nl> - if ( getItemLayout ) { <nl> - frame = getItemLayout ( data , index ) ; <nl> - if ( __DEV__ ) { <nl> - const frameType = PropTypes . shape ( { <nl> - length : PropTypes . number . isRequired , <nl> - offset : PropTypes . number . isRequired , <nl> - index : PropTypes . number . isRequired , <nl> - } ) . isRequired ; <nl> - PropTypes . checkPropTypes ( <nl> - { frame : frameType } , <nl> - { frame } , <nl> - ' frame ' , <nl> - ' VirtualizedList . getItemLayout ' , <nl> - ) ; <nl> - } <nl> - } <nl> - } <nl> - / * $ FlowFixMe ( > = 0 . 63 . 0 site = react_native_fb ) This comment suppresses an <nl> - * error found when Flow v0 . 63 was deployed . To see the error delete this <nl> - * comment and run Flow . * / <nl> - return frame ; <nl> - } ; <nl> - <nl> - _updateViewableItems ( data : any ) { <nl> - const { getItemCount } = this . props ; <nl> - <nl> - this . _viewabilityTuples . forEach ( tuple = > { <nl> - tuple . viewabilityHelper . onUpdate ( <nl> - getItemCount ( data ) , <nl> - this . _scrollMetrics . offset , <nl> - this . _scrollMetrics . visibleLength , <nl> - this . _getFrameMetrics , <nl> - this . _createViewToken , <nl> - tuple . onViewableItemsChanged , <nl> - this . state , <nl> - ) ; <nl> - } ) ; <nl> - } <nl> - } <nl> - <nl> - type CellRendererProps = { <nl> - CellRendererComponent ? : ? React . ComponentType < any > , <nl> - ItemSeparatorComponent : ? React . ComponentType < * > , <nl> - cellKey : string , <nl> - fillRateHelper : FillRateHelper , <nl> - horizontal : ? boolean , <nl> - index : number , <nl> - inversionStyle : ViewStyleProp , <nl> - item : Item , <nl> - / / This is extracted by ScrollViewStickyHeader <nl> - onLayout : ( event : Object ) = > void , <nl> - onUnmount : ( cellKey : string ) = > void , <nl> - onUpdateSeparators : ( cellKeys : Array < ? string > , props : Object ) = > void , <nl> - parentProps : { <nl> - / / e . g . height , y , <nl> - getItemLayout ? : ( <nl> - data : any , <nl> - index : number , <nl> - ) = > { <nl> - length : number , <nl> - offset : number , <nl> - index : number , <nl> - . . . <nl> - } , <nl> - renderItem ? : ? RenderItemType < Item > , <nl> - ListItemComponent ? : ? ( React . ComponentType < any > | React . Element < any > ) , <nl> - . . . <nl> - } , <nl> - prevCellKey : ? string , <nl> - . . . <nl> - } ; <nl> - <nl> - type CellRendererState = { <nl> - separatorProps : $ ReadOnly < { | <nl> - highlighted : boolean , <nl> - leadingItem : ? Item , <nl> - | } > , <nl> - . . . <nl> - } ; <nl> - <nl> - class CellRenderer extends React . Component < <nl> - CellRendererProps , <nl> - CellRendererState , <nl> - > { <nl> - state = { <nl> - separatorProps : { <nl> - highlighted : false , <nl> - leadingItem : this . props . item , <nl> - } , <nl> - } ; <nl> - <nl> - static childContextTypes = { <nl> - virtualizedCell : PropTypes . shape ( { <nl> - cellKey : PropTypes . string , <nl> - } ) , <nl> - } ; <nl> - <nl> - static getDerivedStateFromProps ( <nl> - props : CellRendererProps , <nl> - prevState : CellRendererState , <nl> - ) : ? CellRendererState { <nl> - return { <nl> - separatorProps : { <nl> - . . . prevState . separatorProps , <nl> - leadingItem : props . item , <nl> - } , <nl> - } ; <nl> - } <nl> - <nl> - getChildContext ( ) { <nl> - return { <nl> - virtualizedCell : { <nl> - cellKey : this . props . cellKey , <nl> - } , <nl> - } ; <nl> - } <nl> - <nl> - / / TODO : consider factoring separator stuff out of VirtualizedList into FlatList since it ' s not <nl> - / / reused by SectionList and we can keep VirtualizedList simpler . <nl> - _separators = { <nl> - highlight : ( ) = > { <nl> - const { cellKey , prevCellKey } = this . props ; <nl> - this . props . onUpdateSeparators ( [ cellKey , prevCellKey ] , { <nl> - highlighted : true , <nl> - } ) ; <nl> - } , <nl> - unhighlight : ( ) = > { <nl> - const { cellKey , prevCellKey } = this . props ; <nl> - this . props . onUpdateSeparators ( [ cellKey , prevCellKey ] , { <nl> - highlighted : false , <nl> - } ) ; <nl> - } , <nl> - updateProps : ( select : ' leading ' | ' trailing ' , newProps : Object ) = > { <nl> - const { cellKey , prevCellKey } = this . props ; <nl> - this . props . onUpdateSeparators ( <nl> - [ select = = = ' leading ' ? prevCellKey : cellKey ] , <nl> - newProps , <nl> - ) ; <nl> - } , <nl> - } ; <nl> - <nl> - updateSeparatorProps ( newProps : Object ) { <nl> - this . setState ( state = > ( { <nl> - separatorProps : { . . . state . separatorProps , . . . newProps } , <nl> - } ) ) ; <nl> - } <nl> - <nl> - componentWillUnmount ( ) { <nl> - this . props . onUnmount ( this . props . cellKey ) ; <nl> - } <nl> - <nl> - _renderElement ( renderItem , ListItemComponent , item , index ) { <nl> - if ( renderItem & & ListItemComponent ) { <nl> - console . warn ( <nl> - ' VirtualizedList : Both ListItemComponent and renderItem props are present . ListItemComponent will take ' + <nl> - ' precedence over renderItem . ' , <nl> - ) ; <nl> - } <nl> - <nl> - if ( ListItemComponent ) { <nl> - / * $ FlowFixMe ( > = 0 . 108 . 0 site = react_native_fb ) This comment suppresses an <nl> - * error found when Flow v0 . 108 was deployed . To see the error , delete <nl> - * this comment and run Flow . * / <nl> - return React . createElement ( ListItemComponent , { <nl> - item , <nl> - index , <nl> - separators : this . _separators , <nl> - } ) ; <nl> - } <nl> - <nl> - if ( renderItem ) { <nl> - return renderItem ( { <nl> - item , <nl> - index , <nl> - separators : this . _separators , <nl> - } ) ; <nl> - } <nl> - <nl> - invariant ( <nl> - false , <nl> - ' VirtualizedList : Either ListItemComponent or renderItem props are required but none were found . ' , <nl> - ) ; <nl> - } <nl> - <nl> - render ( ) { <nl> - const { <nl> - CellRendererComponent , <nl> - ItemSeparatorComponent , <nl> - fillRateHelper , <nl> - horizontal , <nl> - item , <nl> - index , <nl> - inversionStyle , <nl> - parentProps , <nl> - } = this . props ; <nl> - const { renderItem , getItemLayout , ListItemComponent } = parentProps ; <nl> - const element = this . _renderElement ( <nl> - renderItem , <nl> - ListItemComponent , <nl> - item , <nl> - index , <nl> - ) ; <nl> - <nl> - const onLayout = <nl> - / * $ FlowFixMe ( > = 0 . 68 . 0 site = react_native_fb ) This comment suppresses an <nl> - * error found when Flow v0 . 68 was deployed . To see the error delete this <nl> - * comment and run Flow . * / <nl> - getItemLayout & & ! parentProps . debug & & ! fillRateHelper . enabled ( ) <nl> - ? undefined <nl> - : this . props . onLayout ; <nl> - / / NOTE : that when this is a sticky header , ` onLayout ` will get automatically extracted and <nl> - / / called explicitly by ` ScrollViewStickyHeader ` . <nl> - const itemSeparator = ItemSeparatorComponent & & ( <nl> - < ItemSeparatorComponent { . . . this . state . separatorProps } / > <nl> - ) ; <nl> - const cellStyle = inversionStyle <nl> - ? horizontal <nl> - ? [ styles . rowReverse , inversionStyle ] <nl> - : [ styles . columnReverse , inversionStyle ] <nl> - : horizontal <nl> - ? [ styles . row , inversionStyle ] <nl> - : inversionStyle ; <nl> - if ( ! CellRendererComponent ) { <nl> - return ( <nl> - / * $ FlowFixMe ( > = 0 . 89 . 0 site = react_native_fb ) This comment suppresses an <nl> - * error found when Flow v0 . 89 was deployed . To see the error , delete <nl> - * this comment and run Flow . * / <nl> - < View style = { cellStyle } onLayout = { onLayout } > <nl> - { element } <nl> - { itemSeparator } <nl> - < / View > <nl> - ) ; <nl> - } <nl> - return ( <nl> - < CellRendererComponent <nl> - { . . . this . props } <nl> - style = { cellStyle } <nl> - onLayout = { onLayout } > <nl> - { element } <nl> - { itemSeparator } <nl> - < / CellRendererComponent > <nl> - ) ; <nl> - } <nl> - } <nl> - <nl> - class VirtualizedCellWrapper extends React . Component < { <nl> - cellKey : string , <nl> - children : React . Node , <nl> - . . . <nl> - } > { <nl> - static childContextTypes = { <nl> - virtualizedCell : PropTypes . shape ( { <nl> - cellKey : PropTypes . string , <nl> - } ) , <nl> - } ; <nl> - <nl> - getChildContext ( ) { <nl> - return { <nl> - virtualizedCell : { <nl> - cellKey : this . props . cellKey , <nl> - } , <nl> - } ; <nl> - } <nl> - <nl> - render ( ) { <nl> - return this . props . children ; <nl> - } <nl> - } <nl> - <nl> - function describeNestedLists ( childList : { <nl> - + cellKey : string , <nl> - + key : string , <nl> - + ref : VirtualizedList , <nl> - + parentDebugInfo : ListDebugInfo , <nl> - + horizontal : boolean , <nl> - . . . <nl> - } ) { <nl> - let trace = <nl> - ' VirtualizedList trace : \ n ' + <nl> - ` Child ( $ { childList . horizontal ? ' horizontal ' : ' vertical ' } ) : \ n ` + <nl> - ` listKey : $ { childList . key } \ n ` + <nl> - ` cellKey : $ { childList . cellKey } ` ; <nl> - <nl> - let debugInfo = childList . parentDebugInfo ; <nl> - while ( debugInfo ) { <nl> - trace + = <nl> - ` \ n Parent ( $ { debugInfo . horizontal ? ' horizontal ' : ' vertical ' } ) : \ n ` + <nl> - ` listKey : $ { debugInfo . listKey } \ n ` + <nl> - ` cellKey : $ { debugInfo . cellKey } ` ; <nl> - debugInfo = debugInfo . parent ; <nl> - } <nl> - return trace ; <nl> - } <nl> - <nl> - const styles = StyleSheet . create ( { <nl> - verticallyInverted : { <nl> - transform : [ { scaleY : - 1 } ] , <nl> - } , <nl> - horizontallyInverted : { <nl> - transform : [ { scaleX : - 1 } ] , <nl> - } , <nl> - row : { <nl> - flexDirection : ' row ' , <nl> - } , <nl> - rowReverse : { <nl> - flexDirection : ' row - reverse ' , <nl> - } , <nl> - columnReverse : { <nl> - flexDirection : ' column - reverse ' , <nl> - } , <nl> - debug : { <nl> - flex : 1 , <nl> - } , <nl> - debugOverlayBase : { <nl> - position : ' absolute ' , <nl> - top : 0 , <nl> - right : 0 , <nl> - } , <nl> - debugOverlay : { <nl> - bottom : 0 , <nl> - width : 20 , <nl> - borderColor : ' blue ' , <nl> - borderWidth : 1 , <nl> - } , <nl> - debugOverlayFrame : { <nl> - left : 0 , <nl> - backgroundColor : ' orange ' , <nl> - } , <nl> - debugOverlayFrameLast : { <nl> - left : 0 , <nl> - borderColor : ' green ' , <nl> - borderWidth : 2 , <nl> - } , <nl> - debugOverlayFrameVis : { <nl> - left : 0 , <nl> - borderColor : ' red ' , <nl> - borderWidth : 2 , <nl> - } , <nl> - } ) ; <nl> - <nl> - module . exports = VirtualizedList ; <nl> mmm a / yarn . lock <nl> ppp b / yarn . lock <nl> <nl> " @ babel / helper - plugin - utils " " ^ 7 . 10 . 4 " <nl> " @ babel / plugin - syntax - logical - assignment - operators " " ^ 7 . 10 . 4 " <nl> <nl> - " @ babel / plugin - proposal - nullish - coalescing - operator @ ^ 7 . 0 . 0 " , " @ babel / plugin - proposal - nullish - coalescing - operator @ ^ 7 . 10 . 4 " : <nl> + " @ babel / plugin - proposal - nullish - coalescing - operator @ ^ 7 . 0 . 0 " , " @ babel / plugin - proposal - nullish - coalescing - operator @ ^ 7 . 1 . 0 " , " @ babel / plugin - proposal - nullish - coalescing - operator @ ^ 7 . 10 . 4 " : <nl> version " 7 . 10 . 4 " <nl> resolved " https : / / registry . yarnpkg . com / @ babel / plugin - proposal - nullish - coalescing - operator / - / plugin - proposal - nullish - coalescing - operator - 7 . 10 . 4 . tgz # 02a7e961fc32e6d5b2db0649e01bf80ddee7e04a " <nl> integrity sha512 - wq5n1M3ZUlHl9sqT2ok1T2 / MTt6AXE0e1Lz4WzWBr95LsAZ5qDXe4KnFuauYyEyLiohvXFMdbsOTMyLZs91Zlw = = <nl> <nl> " @ babel / helper - plugin - utils " " ^ 7 . 10 . 4 " <nl> " @ babel / plugin - syntax - optional - catch - binding " " ^ 7 . 8 . 0 " <nl> <nl> - " @ babel / plugin - proposal - optional - chaining @ ^ 7 . 0 . 0 " , " @ babel / plugin - proposal - optional - chaining @ ^ 7 . 11 . 0 " : <nl> + " @ babel / plugin - proposal - optional - chaining @ ^ 7 . 0 . 0 " , " @ babel / plugin - proposal - optional - chaining @ ^ 7 . 1 . 0 " , " @ babel / plugin - proposal - optional - chaining @ ^ 7 . 11 . 0 " : <nl> version " 7 . 11 . 0 " <nl> resolved " https : / / registry . yarnpkg . com / @ babel / plugin - proposal - optional - chaining / - / plugin - proposal - optional - chaining - 7 . 11 . 0 . tgz # de5866d0646f6afdaab8a566382fe3a221755076 " <nl> integrity sha512 - v9fZIu3Y8562RRwhm1BbMRxtqZNFmFA2EG + pT2diuU8PT3H6T / KXoZ54KgYisfOFZHV6PfvAiBIZ9Rcz + / JCxA = = <nl> <nl> " @ babel / helper - plugin - utils " " ^ 7 . 10 . 4 " <nl> babel - plugin - dynamic - import - node " ^ 2 . 3 . 3 " <nl> <nl> - " @ babel / plugin - transform - modules - commonjs @ ^ 7 . 0 . 0 " , " @ babel / plugin - transform - modules - commonjs @ ^ 7 . 10 . 4 " : <nl> + " @ babel / plugin - transform - modules - commonjs @ ^ 7 . 0 . 0 " , " @ babel / plugin - transform - modules - commonjs @ ^ 7 . 1 . 0 " , " @ babel / plugin - transform - modules - commonjs @ ^ 7 . 10 . 4 " : <nl> version " 7 . 10 . 4 " <nl> resolved " https : / / registry . yarnpkg . com / @ babel / plugin - transform - modules - commonjs / - / plugin - transform - modules - commonjs - 7 . 10 . 4 . tgz # 66667c3eeda1ebf7896d41f1f16b17105a2fbca0 " <nl> integrity sha512 - Xj7Uq5o80HDLlW64rVfDBhao6OX89HKUmb + 9vWYaLXBZOma4gA6tw4Ni1O5qVDoZWUV0fxMYA0aYzOawz0l + 1w = = <nl> jscodeshift @ 0 . 6 . 4 : <nl> temp " ^ 0 . 8 . 1 " <nl> write - file - atomic " ^ 2 . 3 . 0 " <nl> <nl> - jscodeshift @ ^ 0 . 7 . 0 : <nl> - version " 0 . 7 . 1 " <nl> - resolved " https : / / registry . yarnpkg . com / jscodeshift / - / jscodeshift - 0 . 7 . 1 . tgz # 0236ad475d6f0770ca998a0160925d62b57d2507 " <nl> - integrity sha512 - YMkZSyoc8zg5woZL23cmWlnFLPH / mHilonGA7Qbzs7H6M4v4PH0Qsn4jeDyw + CHhVoAnm9UxQyB0Yw1OT + mktA = = <nl> + jscodeshift @ ^ 0 . 9 . 0 : <nl> + version " 0 . 9 . 0 " <nl> + resolved " https : / / registry . yarnpkg . com / jscodeshift / - / jscodeshift - 0 . 9 . 0 . tgz # 672025658e868a63e24d6a6f4c44af9edb6e55f3 " <nl> + integrity sha512 - SUeXq8dJzj5LR8uy71axgG3bmiHoC0IdHy7n89SqKzkzBWpAds5F9IIGE + lqUSZX9J0ZfEzN8fXWIqQV0dIp2w = = <nl> dependencies : <nl> " @ babel / core " " ^ 7 . 1 . 6 " <nl> " @ babel / parser " " ^ 7 . 1 . 6 " <nl> " @ babel / plugin - proposal - class - properties " " ^ 7 . 1 . 0 " <nl> - " @ babel / plugin - proposal - object - rest - spread " " ^ 7 . 0 . 0 " <nl> - " @ babel / preset - env " " ^ 7 . 1 . 6 " <nl> + " @ babel / plugin - proposal - nullish - coalescing - operator " " ^ 7 . 1 . 0 " <nl> + " @ babel / plugin - proposal - optional - chaining " " ^ 7 . 1 . 0 " <nl> + " @ babel / plugin - transform - modules - commonjs " " ^ 7 . 1 . 0 " <nl> " @ babel / preset - flow " " ^ 7 . 0 . 0 " <nl> " @ babel / preset - typescript " " ^ 7 . 1 . 0 " <nl> " @ babel / register " " ^ 7 . 0 . 0 " <nl> react - native - tscodegen @ 0 . 66 . 1 : <nl> nullthrows " 1 . 1 . 1 " <nl> typescript " ^ 3 . 5 . 3 " <nl> <nl> - react - native @ 0 . 0 . 0 - d8e6c4578 : <nl> - version " 0 . 0 . 0 - d8e6c4578 " <nl> - resolved " https : / / registry . yarnpkg . com / react - native / - / react - native - 0 . 0 . 0 - d8e6c4578 . tgz # a6059a57658d8482f7251fa00d3030d68c091a1e " <nl> - integrity sha512 - zCviY + YyJBN6qufYpJKKJggXrOGRvI3863eu0Zs01kuz5tIJ1fhNkp3AnQO8woWqR8GsAyE / gUHCDej8Cy / pKA = = <nl> + react - native @ 0 . 0 . 0 - 30a89f30c : <nl> + version " 0 . 0 . 0 - 30a89f30c " <nl> + resolved " https : / / registry . yarnpkg . com / react - native / - / react - native - 0 . 0 . 0 - 30a89f30c . tgz # 95834cac09f59070d401426d6434755cbeba66f4 " <nl> + integrity sha512 - pX6NuTRup63GFeDOyqnPIjmfFF2Sq9x7qAzIH4m6w2uq + YaQ87UxfO / zrMmq1bAnPqWNH0Ge8jkYc + MLDWz7pg = = <nl> dependencies : <nl> " @ babel / runtime " " ^ 7 . 0 . 0 " <nl> " @ react - native - community / cli " " ^ 4 . 7 . 0 " <nl> | Integrate RN 5 / 4 nightly build . ( ) | microsoft/react-native-windows | 5052b36d138ec845a4382b34b18d2cb45eb977a7 | 2020-08-14T18:58:46Z |
mmm a / cocos / scripting / js - bindings / auto / api / jsb_cocos2dx_auto_api . js <nl> ppp b / cocos / scripting / js - bindings / auto / api / jsb_cocos2dx_auto_api . js <nl> bool <nl> } , <nl> <nl> / * * <nl> - * @ method setKeepScreenOn <nl> - * @ param { bool } arg0 <nl> + * @ method setAccelerometerInterval <nl> + * @ param { float } arg0 <nl> * / <nl> - setKeepScreenOn : function ( <nl> - bool <nl> + setAccelerometerInterval : function ( <nl> + float <nl> ) <nl> { <nl> } , <nl> <nl> - / * * <nl> - * @ method vibrate <nl> - * @ param { float } arg0 <nl> + / * * <nl> + * @ method setKeepScreenOn <nl> + * @ param { bool } arg0 <nl> * / <nl> - vibrate : function ( <nl> - float <nl> + setKeepScreenOn : function ( <nl> + bool <nl> ) <nl> { <nl> } , <nl> <nl> / * * <nl> - * @ method setAccelerometerInterval <nl> + * @ method vibrate <nl> * @ param { float } arg0 <nl> * / <nl> - setAccelerometerInterval : function ( <nl> + vibrate : function ( <nl> float <nl> ) <nl> { <nl> mmm a / cocos / scripting / js - bindings / auto / api / jsb_cocos2dx_ui_auto_api . js <nl> ppp b / cocos / scripting / js - bindings / auto / api / jsb_cocos2dx_ui_auto_api . js <nl> getCurrentFocusedWidget : function ( <nl> / * * <nl> * @ method hitTest <nl> * @ param { vec2_object } arg0 <nl> + * @ param { cc . Camera } arg1 <nl> + * @ param { vec3_object } arg2 <nl> * @ return { bool } <nl> * / <nl> hitTest : function ( <nl> - vec2 <nl> + vec2 , <nl> + camera , <nl> + vec3 <nl> ) <nl> { <nl> return false ; <nl> Button : function ( <nl> } ; <nl> <nl> / * * <nl> - * @ class CheckBox <nl> + * @ class AbstractCheckButton <nl> * / <nl> - ccui . CheckBox = { <nl> + ccui . AbstractCheckButton = { <nl> <nl> / * * <nl> * @ method loadTextureBackGroundSelected <nl> texturerestype <nl> { <nl> } , <nl> <nl> + } ; <nl> + <nl> + / * * <nl> + * @ class CheckBox <nl> + * / <nl> + ccui . CheckBox = { <nl> + <nl> / * * <nl> * @ method create <nl> * @ param { String | String } str <nl> CheckBox : function ( <nl> <nl> } ; <nl> <nl> + / * * <nl> + * @ class RadioButton <nl> + * / <nl> + ccui . RadioButton = { <nl> + <nl> + / * * <nl> + * @ method create <nl> + * @ param { String | String } str <nl> + * @ param { String | String } str <nl> + * @ param { String | ccui . Widget : : TextureResType } str <nl> + * @ param { String } str <nl> + * @ param { String } str <nl> + * @ param { ccui . Widget : : TextureResType } texturerestype <nl> + * @ return { ccui . RadioButton | ccui . RadioButton | ccui . RadioButton } <nl> + * / <nl> + create : function ( <nl> + str , <nl> + str , <nl> + str , <nl> + str , <nl> + str , <nl> + texturerestype <nl> + ) <nl> + { <nl> + return ccui . RadioButton ; <nl> + } , <nl> + <nl> + / * * <nl> + * @ method createInstance <nl> + * @ return { cc . Ref } <nl> + * / <nl> + createInstance : function ( <nl> + ) <nl> + { <nl> + return cc . Ref ; <nl> + } , <nl> + <nl> + / * * <nl> + * @ method RadioButton <nl> + * @ constructor <nl> + * / <nl> + RadioButton : function ( <nl> + ) <nl> + { <nl> + } , <nl> + <nl> + } ; <nl> + <nl> + / * * <nl> + * @ class RadioButtonGroup <nl> + * / <nl> + ccui . RadioButtonGroup = { <nl> + <nl> + / * * <nl> + * @ method removeRadioButton <nl> + * @ param { ccui . RadioButton } arg0 <nl> + * / <nl> + removeRadioButton : function ( <nl> + radiobutton <nl> + ) <nl> + { <nl> + } , <nl> + <nl> + / * * <nl> + * @ method isAllowedNoSelection <nl> + * @ return { bool } <nl> + * / <nl> + isAllowedNoSelection : function ( <nl> + ) <nl> + { <nl> + return false ; <nl> + } , <nl> + <nl> + / * * <nl> + * @ method getSelectedButtonIndex <nl> + * @ return { int } <nl> + * / <nl> + getSelectedButtonIndex : function ( <nl> + ) <nl> + { <nl> + return 0 ; <nl> + } , <nl> + <nl> + / * * <nl> + * @ method setAllowedNoSelection <nl> + * @ param { bool } arg0 <nl> + * / <nl> + setAllowedNoSelection : function ( <nl> + bool <nl> + ) <nl> + { <nl> + } , <nl> + <nl> + / * * <nl> + * @ method getRadioButtonByIndex <nl> + * @ param { int } arg0 <nl> + * @ return { ccui . RadioButton } <nl> + * / <nl> + getRadioButtonByIndex : function ( <nl> + int <nl> + ) <nl> + { <nl> + return ccui . RadioButton ; <nl> + } , <nl> + <nl> + / * * <nl> + * @ method getNumberOfRadioButtons <nl> + * @ return { long } <nl> + * / <nl> + getNumberOfRadioButtons : function ( <nl> + ) <nl> + { <nl> + return 0 ; <nl> + } , <nl> + <nl> + / * * <nl> + * @ method addRadioButton <nl> + * @ param { ccui . RadioButton } arg0 <nl> + * / <nl> + addRadioButton : function ( <nl> + radiobutton <nl> + ) <nl> + { <nl> + } , <nl> + <nl> + / * * <nl> + * @ method setSelectedButton <nl> + * @ param { ccui . RadioButton | int } radiobutton <nl> + * / <nl> + setSelectedButton : function ( <nl> + int <nl> + ) <nl> + { <nl> + } , <nl> + <nl> + / * * <nl> + * @ method create <nl> + * @ return { ccui . RadioButtonGroup } <nl> + * / <nl> + create : function ( <nl> + ) <nl> + { <nl> + return ccui . RadioButtonGroup ; <nl> + } , <nl> + <nl> + / * * <nl> + * @ method RadioButtonGroup <nl> + * @ constructor <nl> + * / <nl> + RadioButtonGroup : function ( <nl> + ) <nl> + { <nl> + } , <nl> + <nl> + } ; <nl> + <nl> / * * <nl> * @ class ImageView <nl> * / <nl> ListView : function ( <nl> * / <nl> ccui . Slider = { <nl> <nl> + / * * <nl> + * @ method setMaxPercent <nl> + * @ param { int } arg0 <nl> + * / <nl> + setMaxPercent : function ( <nl> + int <nl> + ) <nl> + { <nl> + } , <nl> + <nl> / * * <nl> * @ method setPercent <nl> * @ param { int } arg0 <nl> texturerestype <nl> { <nl> } , <nl> <nl> + / * * <nl> + * @ method getMaxPercent <nl> + * @ return { int } <nl> + * / <nl> + getMaxPercent : function ( <nl> + ) <nl> + { <nl> + return 0 ; <nl> + } , <nl> + <nl> / * * <nl> * @ method loadSlidBallTextureNormal <nl> * @ param { String } arg0 <nl> mmm a / cocos / scripting / js - bindings / auto / jsb_cocos2dx_auto . cpp <nl> ppp b / cocos / scripting / js - bindings / auto / jsb_cocos2dx_auto . cpp <nl> bool js_cocos2dx_Device_setAccelerometerEnabled ( JSContext * cx , uint32_t argc , js <nl> return false ; <nl> } <nl> <nl> - bool js_cocos2dx_Device_setKeepScreenOn ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + bool js_cocos2dx_Device_setAccelerometerInterval ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> { <nl> JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> bool ok = true ; <nl> if ( argc = = 1 ) { <nl> - bool arg0 ; <nl> - arg0 = JS : : ToBoolean ( args . get ( 0 ) ) ; <nl> - JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_Device_setKeepScreenOn : Error processing arguments " ) ; <nl> - cocos2d : : Device : : setKeepScreenOn ( arg0 ) ; <nl> + double arg0 ; <nl> + ok & = JS : : ToNumber ( cx , args . get ( 0 ) , & arg0 ) & & ! isnan ( arg0 ) ; <nl> + JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_Device_setAccelerometerInterval : Error processing arguments " ) ; <nl> + cocos2d : : Device : : setAccelerometerInterval ( arg0 ) ; <nl> args . rval ( ) . setUndefined ( ) ; <nl> return true ; <nl> } <nl> - JS_ReportError ( cx , " js_cocos2dx_Device_setKeepScreenOn : wrong number of arguments " ) ; <nl> + JS_ReportError ( cx , " js_cocos2dx_Device_setAccelerometerInterval : wrong number of arguments " ) ; <nl> return false ; <nl> } <nl> <nl> - bool js_cocos2dx_Device_vibrate ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + bool js_cocos2dx_Device_setKeepScreenOn ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> { <nl> JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> bool ok = true ; <nl> if ( argc = = 1 ) { <nl> - double arg0 ; <nl> - ok & = JS : : ToNumber ( cx , args . get ( 0 ) , & arg0 ) & & ! isnan ( arg0 ) ; <nl> - JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_Device_vibrate : Error processing arguments " ) ; <nl> - cocos2d : : Device : : vibrate ( arg0 ) ; <nl> + bool arg0 ; <nl> + arg0 = JS : : ToBoolean ( args . get ( 0 ) ) ; <nl> + JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_Device_setKeepScreenOn : Error processing arguments " ) ; <nl> + cocos2d : : Device : : setKeepScreenOn ( arg0 ) ; <nl> args . rval ( ) . setUndefined ( ) ; <nl> return true ; <nl> } <nl> - JS_ReportError ( cx , " js_cocos2dx_Device_vibrate : wrong number of arguments " ) ; <nl> + JS_ReportError ( cx , " js_cocos2dx_Device_setKeepScreenOn : wrong number of arguments " ) ; <nl> return false ; <nl> } <nl> <nl> - bool js_cocos2dx_Device_setAccelerometerInterval ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + bool js_cocos2dx_Device_vibrate ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> { <nl> JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> bool ok = true ; <nl> if ( argc = = 1 ) { <nl> double arg0 ; <nl> ok & = JS : : ToNumber ( cx , args . get ( 0 ) , & arg0 ) & & ! isnan ( arg0 ) ; <nl> - JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_Device_setAccelerometerInterval : Error processing arguments " ) ; <nl> - cocos2d : : Device : : setAccelerometerInterval ( arg0 ) ; <nl> + JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_Device_vibrate : Error processing arguments " ) ; <nl> + cocos2d : : Device : : vibrate ( arg0 ) ; <nl> args . rval ( ) . setUndefined ( ) ; <nl> return true ; <nl> } <nl> - JS_ReportError ( cx , " js_cocos2dx_Device_setAccelerometerInterval : wrong number of arguments " ) ; <nl> + JS_ReportError ( cx , " js_cocos2dx_Device_vibrate : wrong number of arguments " ) ; <nl> return false ; <nl> } <nl> <nl> void js_register_cocos2dx_Device ( JSContext * cx , JS : : HandleObject global ) { <nl> <nl> static JSFunctionSpec st_funcs [ ] = { <nl> JS_FN ( " setAccelerometerEnabled " , js_cocos2dx_Device_setAccelerometerEnabled , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_FN ( " setAccelerometerInterval " , js_cocos2dx_Device_setAccelerometerInterval , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> JS_FN ( " setKeepScreenOn " , js_cocos2dx_Device_setKeepScreenOn , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> JS_FN ( " vibrate " , js_cocos2dx_Device_vibrate , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> - JS_FN ( " setAccelerometerInterval " , js_cocos2dx_Device_setAccelerometerInterval , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> JS_FN ( " getDPI " , js_cocos2dx_Device_getDPI , 0 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> JS_FS_END <nl> } ; <nl> mmm a / cocos / scripting / js - bindings / auto / jsb_cocos2dx_auto . hpp <nl> ppp b / cocos / scripting / js - bindings / auto / jsb_cocos2dx_auto . hpp <nl> void js_cocos2dx_Device_finalize ( JSContext * cx , JSObject * obj ) ; <nl> void js_register_cocos2dx_Device ( JSContext * cx , JS : : HandleObject global ) ; <nl> void register_all_cocos2dx ( JSContext * cx , JS : : HandleObject obj ) ; <nl> bool js_cocos2dx_Device_setAccelerometerEnabled ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + bool js_cocos2dx_Device_setAccelerometerInterval ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> bool js_cocos2dx_Device_setKeepScreenOn ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> bool js_cocos2dx_Device_vibrate ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> - bool js_cocos2dx_Device_setAccelerometerInterval ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> bool js_cocos2dx_Device_getDPI ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> <nl> extern JSClass * jsb_cocos2d_SAXParser_class ; <nl> mmm a / cocos / scripting / js - bindings / auto / jsb_cocos2dx_ui_auto . cpp <nl> ppp b / cocos / scripting / js - bindings / auto / jsb_cocos2dx_ui_auto . cpp <nl> bool js_cocos2dx_ui_Widget_hitTest ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> js_proxy_t * proxy = jsb_get_js_proxy ( obj ) ; <nl> cocos2d : : ui : : Widget * cobj = ( cocos2d : : ui : : Widget * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_Widget_hitTest : Invalid Native Object " ) ; <nl> - if ( argc = = 1 ) { <nl> + if ( argc = = 3 ) { <nl> cocos2d : : Vec2 arg0 ; <nl> + const cocos2d : : Camera * arg1 ; <nl> + cocos2d : : Vec3 * arg2 ; <nl> ok & = jsval_to_vector2 ( cx , args . get ( 0 ) , & arg0 ) ; <nl> + do { <nl> + if ( args . get ( 1 ) . isNull ( ) ) { arg1 = nullptr ; break ; } <nl> + if ( ! args . get ( 1 ) . isObject ( ) ) { ok = false ; break ; } <nl> + js_proxy_t * jsProxy ; <nl> + JSObject * tmpObj = args . get ( 1 ) . toObjectOrNull ( ) ; <nl> + jsProxy = jsb_get_js_proxy ( tmpObj ) ; <nl> + arg1 = ( const cocos2d : : Camera * ) ( jsProxy ? jsProxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( arg1 , cx , false , " Invalid Native Object " ) ; <nl> + } while ( 0 ) ; <nl> + do { <nl> + if ( args . get ( 2 ) . isNull ( ) ) { arg2 = nullptr ; break ; } <nl> + if ( ! args . get ( 2 ) . isObject ( ) ) { ok = false ; break ; } <nl> + js_proxy_t * jsProxy ; <nl> + JSObject * tmpObj = args . get ( 2 ) . toObjectOrNull ( ) ; <nl> + jsProxy = jsb_get_js_proxy ( tmpObj ) ; <nl> + arg2 = ( cocos2d : : Vec3 * ) ( jsProxy ? jsProxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( arg2 , cx , false , " Invalid Native Object " ) ; <nl> + } while ( 0 ) ; <nl> JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_Widget_hitTest : Error processing arguments " ) ; <nl> - bool ret = cobj - > hitTest ( arg0 ) ; <nl> + bool ret = cobj - > hitTest ( arg0 , arg1 , arg2 ) ; <nl> jsval jsret = JSVAL_NULL ; <nl> jsret = BOOLEAN_TO_JSVAL ( ret ) ; <nl> args . rval ( ) . set ( jsret ) ; <nl> return true ; <nl> } <nl> <nl> - JS_ReportError ( cx , " js_cocos2dx_ui_Widget_hitTest : wrong number of arguments : % d , was expecting % d " , argc , 1 ) ; <nl> + JS_ReportError ( cx , " js_cocos2dx_ui_Widget_hitTest : wrong number of arguments : % d , was expecting % d " , argc , 3 ) ; <nl> return false ; <nl> } <nl> bool js_cocos2dx_ui_Widget_isLayoutComponentEnabled ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> void js_register_cocos2dx_ui_Widget ( JSContext * cx , JS : : HandleObject global ) { <nl> JS_FN ( " setUnifySizeEnabled " , js_cocos2dx_ui_Widget_setUnifySizeEnabled , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> JS_FN ( " isPropagateTouchEvents " , js_cocos2dx_ui_Widget_isPropagateTouchEvents , 0 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> JS_FN ( " getCurrentFocusedWidget " , js_cocos2dx_ui_Widget_getCurrentFocusedWidget , 0 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> - JS_FN ( " hitTest " , js_cocos2dx_ui_Widget_hitTest , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_FN ( " hitTest " , js_cocos2dx_ui_Widget_hitTest , 3 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> JS_FN ( " isLayoutComponentEnabled " , js_cocos2dx_ui_Widget_isLayoutComponentEnabled , 0 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> JS_FN ( " requestFocus " , js_cocos2dx_ui_Widget_requestFocus , 0 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> JS_FN ( " updateSizeAndPosition " , js_cocos2dx_ui_Widget_updateSizeAndPosition , 0 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> void js_register_cocos2dx_ui_Button ( JSContext * cx , JS : : HandleObject global ) { <nl> } <nl> } <nl> <nl> - JSClass * jsb_cocos2d_ui_CheckBox_class ; <nl> - JSObject * jsb_cocos2d_ui_CheckBox_prototype ; <nl> + JSClass * jsb_cocos2d_ui_AbstractCheckButton_class ; <nl> + JSObject * jsb_cocos2d_ui_AbstractCheckButton_prototype ; <nl> <nl> - bool js_cocos2dx_ui_CheckBox_loadTextureBackGroundSelected ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + bool js_cocos2dx_ui_AbstractCheckButton_loadTextureBackGroundSelected ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> { <nl> JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> bool ok = true ; <nl> JS : : RootedObject obj ( cx , args . thisv ( ) . toObjectOrNull ( ) ) ; <nl> js_proxy_t * proxy = jsb_get_js_proxy ( obj ) ; <nl> - cocos2d : : ui : : CheckBox * cobj = ( cocos2d : : ui : : CheckBox * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> - JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_CheckBox_loadTextureBackGroundSelected : Invalid Native Object " ) ; <nl> + cocos2d : : ui : : AbstractCheckButton * cobj = ( cocos2d : : ui : : AbstractCheckButton * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_AbstractCheckButton_loadTextureBackGroundSelected : Invalid Native Object " ) ; <nl> if ( argc = = 1 ) { <nl> std : : string arg0 ; <nl> ok & = jsval_to_std_string ( cx , args . get ( 0 ) , & arg0 ) ; <nl> - JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_CheckBox_loadTextureBackGroundSelected : Error processing arguments " ) ; <nl> + JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_AbstractCheckButton_loadTextureBackGroundSelected : Error processing arguments " ) ; <nl> cobj - > loadTextureBackGroundSelected ( arg0 ) ; <nl> args . rval ( ) . setUndefined ( ) ; <nl> return true ; <nl> bool js_cocos2dx_ui_CheckBox_loadTextureBackGroundSelected ( JSContext * cx , uint32 <nl> cocos2d : : ui : : Widget : : TextureResType arg1 ; <nl> ok & = jsval_to_std_string ( cx , args . get ( 0 ) , & arg0 ) ; <nl> ok & = jsval_to_int32 ( cx , args . get ( 1 ) , ( int32_t * ) & arg1 ) ; <nl> - JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_CheckBox_loadTextureBackGroundSelected : Error processing arguments " ) ; <nl> + JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_AbstractCheckButton_loadTextureBackGroundSelected : Error processing arguments " ) ; <nl> cobj - > loadTextureBackGroundSelected ( arg0 , arg1 ) ; <nl> args . rval ( ) . setUndefined ( ) ; <nl> return true ; <nl> } <nl> <nl> - JS_ReportError ( cx , " js_cocos2dx_ui_CheckBox_loadTextureBackGroundSelected : wrong number of arguments : % d , was expecting % d " , argc , 1 ) ; <nl> + JS_ReportError ( cx , " js_cocos2dx_ui_AbstractCheckButton_loadTextureBackGroundSelected : wrong number of arguments : % d , was expecting % d " , argc , 1 ) ; <nl> return false ; <nl> } <nl> - bool js_cocos2dx_ui_CheckBox_loadTextureBackGroundDisabled ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + bool js_cocos2dx_ui_AbstractCheckButton_loadTextureBackGroundDisabled ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> { <nl> JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> bool ok = true ; <nl> JS : : RootedObject obj ( cx , args . thisv ( ) . toObjectOrNull ( ) ) ; <nl> js_proxy_t * proxy = jsb_get_js_proxy ( obj ) ; <nl> - cocos2d : : ui : : CheckBox * cobj = ( cocos2d : : ui : : CheckBox * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> - JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_CheckBox_loadTextureBackGroundDisabled : Invalid Native Object " ) ; <nl> + cocos2d : : ui : : AbstractCheckButton * cobj = ( cocos2d : : ui : : AbstractCheckButton * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_AbstractCheckButton_loadTextureBackGroundDisabled : Invalid Native Object " ) ; <nl> if ( argc = = 1 ) { <nl> std : : string arg0 ; <nl> ok & = jsval_to_std_string ( cx , args . get ( 0 ) , & arg0 ) ; <nl> - JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_CheckBox_loadTextureBackGroundDisabled : Error processing arguments " ) ; <nl> + JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_AbstractCheckButton_loadTextureBackGroundDisabled : Error processing arguments " ) ; <nl> cobj - > loadTextureBackGroundDisabled ( arg0 ) ; <nl> args . rval ( ) . setUndefined ( ) ; <nl> return true ; <nl> bool js_cocos2dx_ui_CheckBox_loadTextureBackGroundDisabled ( JSContext * cx , uint32 <nl> cocos2d : : ui : : Widget : : TextureResType arg1 ; <nl> ok & = jsval_to_std_string ( cx , args . get ( 0 ) , & arg0 ) ; <nl> ok & = jsval_to_int32 ( cx , args . get ( 1 ) , ( int32_t * ) & arg1 ) ; <nl> - JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_CheckBox_loadTextureBackGroundDisabled : Error processing arguments " ) ; <nl> + JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_AbstractCheckButton_loadTextureBackGroundDisabled : Error processing arguments " ) ; <nl> cobj - > loadTextureBackGroundDisabled ( arg0 , arg1 ) ; <nl> args . rval ( ) . setUndefined ( ) ; <nl> return true ; <nl> } <nl> <nl> - JS_ReportError ( cx , " js_cocos2dx_ui_CheckBox_loadTextureBackGroundDisabled : wrong number of arguments : % d , was expecting % d " , argc , 1 ) ; <nl> + JS_ReportError ( cx , " js_cocos2dx_ui_AbstractCheckButton_loadTextureBackGroundDisabled : wrong number of arguments : % d , was expecting % d " , argc , 1 ) ; <nl> return false ; <nl> } <nl> - bool js_cocos2dx_ui_CheckBox_setSelected ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + bool js_cocos2dx_ui_AbstractCheckButton_setSelected ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> { <nl> JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> bool ok = true ; <nl> JS : : RootedObject obj ( cx , args . thisv ( ) . toObjectOrNull ( ) ) ; <nl> js_proxy_t * proxy = jsb_get_js_proxy ( obj ) ; <nl> - cocos2d : : ui : : CheckBox * cobj = ( cocos2d : : ui : : CheckBox * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> - JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_CheckBox_setSelected : Invalid Native Object " ) ; <nl> + cocos2d : : ui : : AbstractCheckButton * cobj = ( cocos2d : : ui : : AbstractCheckButton * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_AbstractCheckButton_setSelected : Invalid Native Object " ) ; <nl> if ( argc = = 1 ) { <nl> bool arg0 ; <nl> arg0 = JS : : ToBoolean ( args . get ( 0 ) ) ; <nl> - JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_CheckBox_setSelected : Error processing arguments " ) ; <nl> + JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_AbstractCheckButton_setSelected : Error processing arguments " ) ; <nl> cobj - > setSelected ( arg0 ) ; <nl> args . rval ( ) . setUndefined ( ) ; <nl> return true ; <nl> } <nl> <nl> - JS_ReportError ( cx , " js_cocos2dx_ui_CheckBox_setSelected : wrong number of arguments : % d , was expecting % d " , argc , 1 ) ; <nl> + JS_ReportError ( cx , " js_cocos2dx_ui_AbstractCheckButton_setSelected : wrong number of arguments : % d , was expecting % d " , argc , 1 ) ; <nl> return false ; <nl> } <nl> - bool js_cocos2dx_ui_CheckBox_loadTextureFrontCross ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + bool js_cocos2dx_ui_AbstractCheckButton_loadTextureFrontCross ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> { <nl> JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> bool ok = true ; <nl> JS : : RootedObject obj ( cx , args . thisv ( ) . toObjectOrNull ( ) ) ; <nl> js_proxy_t * proxy = jsb_get_js_proxy ( obj ) ; <nl> - cocos2d : : ui : : CheckBox * cobj = ( cocos2d : : ui : : CheckBox * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> - JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_CheckBox_loadTextureFrontCross : Invalid Native Object " ) ; <nl> + cocos2d : : ui : : AbstractCheckButton * cobj = ( cocos2d : : ui : : AbstractCheckButton * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_AbstractCheckButton_loadTextureFrontCross : Invalid Native Object " ) ; <nl> if ( argc = = 1 ) { <nl> std : : string arg0 ; <nl> ok & = jsval_to_std_string ( cx , args . get ( 0 ) , & arg0 ) ; <nl> - JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_CheckBox_loadTextureFrontCross : Error processing arguments " ) ; <nl> + JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_AbstractCheckButton_loadTextureFrontCross : Error processing arguments " ) ; <nl> cobj - > loadTextureFrontCross ( arg0 ) ; <nl> args . rval ( ) . setUndefined ( ) ; <nl> return true ; <nl> bool js_cocos2dx_ui_CheckBox_loadTextureFrontCross ( JSContext * cx , uint32_t argc , <nl> cocos2d : : ui : : Widget : : TextureResType arg1 ; <nl> ok & = jsval_to_std_string ( cx , args . get ( 0 ) , & arg0 ) ; <nl> ok & = jsval_to_int32 ( cx , args . get ( 1 ) , ( int32_t * ) & arg1 ) ; <nl> - JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_CheckBox_loadTextureFrontCross : Error processing arguments " ) ; <nl> + JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_AbstractCheckButton_loadTextureFrontCross : Error processing arguments " ) ; <nl> cobj - > loadTextureFrontCross ( arg0 , arg1 ) ; <nl> args . rval ( ) . setUndefined ( ) ; <nl> return true ; <nl> } <nl> <nl> - JS_ReportError ( cx , " js_cocos2dx_ui_CheckBox_loadTextureFrontCross : wrong number of arguments : % d , was expecting % d " , argc , 1 ) ; <nl> + JS_ReportError ( cx , " js_cocos2dx_ui_AbstractCheckButton_loadTextureFrontCross : wrong number of arguments : % d , was expecting % d " , argc , 1 ) ; <nl> return false ; <nl> } <nl> - bool js_cocos2dx_ui_CheckBox_isSelected ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + bool js_cocos2dx_ui_AbstractCheckButton_isSelected ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> { <nl> JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> JS : : RootedObject obj ( cx , args . thisv ( ) . toObjectOrNull ( ) ) ; <nl> js_proxy_t * proxy = jsb_get_js_proxy ( obj ) ; <nl> - cocos2d : : ui : : CheckBox * cobj = ( cocos2d : : ui : : CheckBox * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> - JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_CheckBox_isSelected : Invalid Native Object " ) ; <nl> + cocos2d : : ui : : AbstractCheckButton * cobj = ( cocos2d : : ui : : AbstractCheckButton * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_AbstractCheckButton_isSelected : Invalid Native Object " ) ; <nl> if ( argc = = 0 ) { <nl> bool ret = cobj - > isSelected ( ) ; <nl> jsval jsret = JSVAL_NULL ; <nl> bool js_cocos2dx_ui_CheckBox_isSelected ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> return true ; <nl> } <nl> <nl> - JS_ReportError ( cx , " js_cocos2dx_ui_CheckBox_isSelected : wrong number of arguments : % d , was expecting % d " , argc , 0 ) ; <nl> + JS_ReportError ( cx , " js_cocos2dx_ui_AbstractCheckButton_isSelected : wrong number of arguments : % d , was expecting % d " , argc , 0 ) ; <nl> return false ; <nl> } <nl> - bool js_cocos2dx_ui_CheckBox_init ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + bool js_cocos2dx_ui_AbstractCheckButton_init ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> { <nl> JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> bool ok = true ; <nl> JS : : RootedObject obj ( cx , args . thisv ( ) . toObjectOrNull ( ) ) ; <nl> js_proxy_t * proxy = jsb_get_js_proxy ( obj ) ; <nl> - cocos2d : : ui : : CheckBox * cobj = ( cocos2d : : ui : : CheckBox * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> - JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_CheckBox_init : Invalid Native Object " ) ; <nl> + cocos2d : : ui : : AbstractCheckButton * cobj = ( cocos2d : : ui : : AbstractCheckButton * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_AbstractCheckButton_init : Invalid Native Object " ) ; <nl> if ( argc = = 5 ) { <nl> std : : string arg0 ; <nl> std : : string arg1 ; <nl> bool js_cocos2dx_ui_CheckBox_init ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> ok & = jsval_to_std_string ( cx , args . get ( 2 ) , & arg2 ) ; <nl> ok & = jsval_to_std_string ( cx , args . get ( 3 ) , & arg3 ) ; <nl> ok & = jsval_to_std_string ( cx , args . get ( 4 ) , & arg4 ) ; <nl> - JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_CheckBox_init : Error processing arguments " ) ; <nl> + JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_AbstractCheckButton_init : Error processing arguments " ) ; <nl> bool ret = cobj - > init ( arg0 , arg1 , arg2 , arg3 , arg4 ) ; <nl> jsval jsret = JSVAL_NULL ; <nl> jsret = BOOLEAN_TO_JSVAL ( ret ) ; <nl> bool js_cocos2dx_ui_CheckBox_init ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> ok & = jsval_to_std_string ( cx , args . get ( 3 ) , & arg3 ) ; <nl> ok & = jsval_to_std_string ( cx , args . get ( 4 ) , & arg4 ) ; <nl> ok & = jsval_to_int32 ( cx , args . get ( 5 ) , ( int32_t * ) & arg5 ) ; <nl> - JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_CheckBox_init : Error processing arguments " ) ; <nl> + JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_AbstractCheckButton_init : Error processing arguments " ) ; <nl> bool ret = cobj - > init ( arg0 , arg1 , arg2 , arg3 , arg4 , arg5 ) ; <nl> jsval jsret = JSVAL_NULL ; <nl> jsret = BOOLEAN_TO_JSVAL ( ret ) ; <nl> bool js_cocos2dx_ui_CheckBox_init ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> return true ; <nl> } <nl> <nl> - JS_ReportError ( cx , " js_cocos2dx_ui_CheckBox_init : wrong number of arguments : % d , was expecting % d " , argc , 5 ) ; <nl> + JS_ReportError ( cx , " js_cocos2dx_ui_AbstractCheckButton_init : wrong number of arguments : % d , was expecting % d " , argc , 5 ) ; <nl> return false ; <nl> } <nl> - bool js_cocos2dx_ui_CheckBox_loadTextures ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + bool js_cocos2dx_ui_AbstractCheckButton_loadTextures ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> { <nl> JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> bool ok = true ; <nl> JS : : RootedObject obj ( cx , args . thisv ( ) . toObjectOrNull ( ) ) ; <nl> js_proxy_t * proxy = jsb_get_js_proxy ( obj ) ; <nl> - cocos2d : : ui : : CheckBox * cobj = ( cocos2d : : ui : : CheckBox * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> - JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_CheckBox_loadTextures : Invalid Native Object " ) ; <nl> + cocos2d : : ui : : AbstractCheckButton * cobj = ( cocos2d : : ui : : AbstractCheckButton * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_AbstractCheckButton_loadTextures : Invalid Native Object " ) ; <nl> if ( argc = = 5 ) { <nl> std : : string arg0 ; <nl> std : : string arg1 ; <nl> bool js_cocos2dx_ui_CheckBox_loadTextures ( JSContext * cx , uint32_t argc , jsval * v <nl> ok & = jsval_to_std_string ( cx , args . get ( 2 ) , & arg2 ) ; <nl> ok & = jsval_to_std_string ( cx , args . get ( 3 ) , & arg3 ) ; <nl> ok & = jsval_to_std_string ( cx , args . get ( 4 ) , & arg4 ) ; <nl> - JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_CheckBox_loadTextures : Error processing arguments " ) ; <nl> + JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_AbstractCheckButton_loadTextures : Error processing arguments " ) ; <nl> cobj - > loadTextures ( arg0 , arg1 , arg2 , arg3 , arg4 ) ; <nl> args . rval ( ) . setUndefined ( ) ; <nl> return true ; <nl> bool js_cocos2dx_ui_CheckBox_loadTextures ( JSContext * cx , uint32_t argc , jsval * v <nl> ok & = jsval_to_std_string ( cx , args . get ( 3 ) , & arg3 ) ; <nl> ok & = jsval_to_std_string ( cx , args . get ( 4 ) , & arg4 ) ; <nl> ok & = jsval_to_int32 ( cx , args . get ( 5 ) , ( int32_t * ) & arg5 ) ; <nl> - JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_CheckBox_loadTextures : Error processing arguments " ) ; <nl> + JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_AbstractCheckButton_loadTextures : Error processing arguments " ) ; <nl> cobj - > loadTextures ( arg0 , arg1 , arg2 , arg3 , arg4 , arg5 ) ; <nl> args . rval ( ) . setUndefined ( ) ; <nl> return true ; <nl> } <nl> <nl> - JS_ReportError ( cx , " js_cocos2dx_ui_CheckBox_loadTextures : wrong number of arguments : % d , was expecting % d " , argc , 5 ) ; <nl> + JS_ReportError ( cx , " js_cocos2dx_ui_AbstractCheckButton_loadTextures : wrong number of arguments : % d , was expecting % d " , argc , 5 ) ; <nl> return false ; <nl> } <nl> - bool js_cocos2dx_ui_CheckBox_getZoomScale ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + bool js_cocos2dx_ui_AbstractCheckButton_getZoomScale ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> { <nl> JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> JS : : RootedObject obj ( cx , args . thisv ( ) . toObjectOrNull ( ) ) ; <nl> js_proxy_t * proxy = jsb_get_js_proxy ( obj ) ; <nl> - cocos2d : : ui : : CheckBox * cobj = ( cocos2d : : ui : : CheckBox * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> - JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_CheckBox_getZoomScale : Invalid Native Object " ) ; <nl> + cocos2d : : ui : : AbstractCheckButton * cobj = ( cocos2d : : ui : : AbstractCheckButton * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_AbstractCheckButton_getZoomScale : Invalid Native Object " ) ; <nl> if ( argc = = 0 ) { <nl> double ret = cobj - > getZoomScale ( ) ; <nl> jsval jsret = JSVAL_NULL ; <nl> bool js_cocos2dx_ui_CheckBox_getZoomScale ( JSContext * cx , uint32_t argc , jsval * v <nl> return true ; <nl> } <nl> <nl> - JS_ReportError ( cx , " js_cocos2dx_ui_CheckBox_getZoomScale : wrong number of arguments : % d , was expecting % d " , argc , 0 ) ; <nl> + JS_ReportError ( cx , " js_cocos2dx_ui_AbstractCheckButton_getZoomScale : wrong number of arguments : % d , was expecting % d " , argc , 0 ) ; <nl> return false ; <nl> } <nl> - bool js_cocos2dx_ui_CheckBox_loadTextureBackGround ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + bool js_cocos2dx_ui_AbstractCheckButton_loadTextureBackGround ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> { <nl> JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> bool ok = true ; <nl> JS : : RootedObject obj ( cx , args . thisv ( ) . toObjectOrNull ( ) ) ; <nl> js_proxy_t * proxy = jsb_get_js_proxy ( obj ) ; <nl> - cocos2d : : ui : : CheckBox * cobj = ( cocos2d : : ui : : CheckBox * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> - JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_CheckBox_loadTextureBackGround : Invalid Native Object " ) ; <nl> + cocos2d : : ui : : AbstractCheckButton * cobj = ( cocos2d : : ui : : AbstractCheckButton * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_AbstractCheckButton_loadTextureBackGround : Invalid Native Object " ) ; <nl> if ( argc = = 1 ) { <nl> std : : string arg0 ; <nl> ok & = jsval_to_std_string ( cx , args . get ( 0 ) , & arg0 ) ; <nl> - JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_CheckBox_loadTextureBackGround : Error processing arguments " ) ; <nl> + JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_AbstractCheckButton_loadTextureBackGround : Error processing arguments " ) ; <nl> cobj - > loadTextureBackGround ( arg0 ) ; <nl> args . rval ( ) . setUndefined ( ) ; <nl> return true ; <nl> bool js_cocos2dx_ui_CheckBox_loadTextureBackGround ( JSContext * cx , uint32_t argc , <nl> cocos2d : : ui : : Widget : : TextureResType arg1 ; <nl> ok & = jsval_to_std_string ( cx , args . get ( 0 ) , & arg0 ) ; <nl> ok & = jsval_to_int32 ( cx , args . get ( 1 ) , ( int32_t * ) & arg1 ) ; <nl> - JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_CheckBox_loadTextureBackGround : Error processing arguments " ) ; <nl> + JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_AbstractCheckButton_loadTextureBackGround : Error processing arguments " ) ; <nl> cobj - > loadTextureBackGround ( arg0 , arg1 ) ; <nl> args . rval ( ) . setUndefined ( ) ; <nl> return true ; <nl> } <nl> <nl> - JS_ReportError ( cx , " js_cocos2dx_ui_CheckBox_loadTextureBackGround : wrong number of arguments : % d , was expecting % d " , argc , 1 ) ; <nl> + JS_ReportError ( cx , " js_cocos2dx_ui_AbstractCheckButton_loadTextureBackGround : wrong number of arguments : % d , was expecting % d " , argc , 1 ) ; <nl> + return false ; <nl> + } <nl> + bool js_cocos2dx_ui_AbstractCheckButton_setZoomScale ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + { <nl> + JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> + bool ok = true ; <nl> + JS : : RootedObject obj ( cx , args . thisv ( ) . toObjectOrNull ( ) ) ; <nl> + js_proxy_t * proxy = jsb_get_js_proxy ( obj ) ; <nl> + cocos2d : : ui : : AbstractCheckButton * cobj = ( cocos2d : : ui : : AbstractCheckButton * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_AbstractCheckButton_setZoomScale : Invalid Native Object " ) ; <nl> + if ( argc = = 1 ) { <nl> + double arg0 ; <nl> + ok & = JS : : ToNumber ( cx , args . get ( 0 ) , & arg0 ) & & ! isnan ( arg0 ) ; <nl> + JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_AbstractCheckButton_setZoomScale : Error processing arguments " ) ; <nl> + cobj - > setZoomScale ( arg0 ) ; <nl> + args . rval ( ) . setUndefined ( ) ; <nl> + return true ; <nl> + } <nl> + <nl> + JS_ReportError ( cx , " js_cocos2dx_ui_AbstractCheckButton_setZoomScale : wrong number of arguments : % d , was expecting % d " , argc , 1 ) ; <nl> + return false ; <nl> + } <nl> + bool js_cocos2dx_ui_AbstractCheckButton_loadTextureFrontCrossDisabled ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + { <nl> + JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> + bool ok = true ; <nl> + JS : : RootedObject obj ( cx , args . thisv ( ) . toObjectOrNull ( ) ) ; <nl> + js_proxy_t * proxy = jsb_get_js_proxy ( obj ) ; <nl> + cocos2d : : ui : : AbstractCheckButton * cobj = ( cocos2d : : ui : : AbstractCheckButton * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_AbstractCheckButton_loadTextureFrontCrossDisabled : Invalid Native Object " ) ; <nl> + if ( argc = = 1 ) { <nl> + std : : string arg0 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 0 ) , & arg0 ) ; <nl> + JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_AbstractCheckButton_loadTextureFrontCrossDisabled : Error processing arguments " ) ; <nl> + cobj - > loadTextureFrontCrossDisabled ( arg0 ) ; <nl> + args . rval ( ) . setUndefined ( ) ; <nl> + return true ; <nl> + } <nl> + if ( argc = = 2 ) { <nl> + std : : string arg0 ; <nl> + cocos2d : : ui : : Widget : : TextureResType arg1 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 0 ) , & arg0 ) ; <nl> + ok & = jsval_to_int32 ( cx , args . get ( 1 ) , ( int32_t * ) & arg1 ) ; <nl> + JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_AbstractCheckButton_loadTextureFrontCrossDisabled : Error processing arguments " ) ; <nl> + cobj - > loadTextureFrontCrossDisabled ( arg0 , arg1 ) ; <nl> + args . rval ( ) . setUndefined ( ) ; <nl> + return true ; <nl> + } <nl> + <nl> + JS_ReportError ( cx , " js_cocos2dx_ui_AbstractCheckButton_loadTextureFrontCrossDisabled : wrong number of arguments : % d , was expecting % d " , argc , 1 ) ; <nl> + return false ; <nl> + } <nl> + <nl> + extern JSObject * jsb_cocos2d_ui_Widget_prototype ; <nl> + <nl> + void js_cocos2d_ui_AbstractCheckButton_finalize ( JSFreeOp * fop , JSObject * obj ) { <nl> + CCLOGINFO ( " jsbindings : finalizing JS object % p ( AbstractCheckButton ) " , obj ) ; <nl> + } <nl> + <nl> + void js_register_cocos2dx_ui_AbstractCheckButton ( JSContext * cx , JS : : HandleObject global ) { <nl> + jsb_cocos2d_ui_AbstractCheckButton_class = ( JSClass * ) calloc ( 1 , sizeof ( JSClass ) ) ; <nl> + jsb_cocos2d_ui_AbstractCheckButton_class - > name = " AbstractCheckButton " ; <nl> + jsb_cocos2d_ui_AbstractCheckButton_class - > addProperty = JS_PropertyStub ; <nl> + jsb_cocos2d_ui_AbstractCheckButton_class - > delProperty = JS_DeletePropertyStub ; <nl> + jsb_cocos2d_ui_AbstractCheckButton_class - > getProperty = JS_PropertyStub ; <nl> + jsb_cocos2d_ui_AbstractCheckButton_class - > setProperty = JS_StrictPropertyStub ; <nl> + jsb_cocos2d_ui_AbstractCheckButton_class - > enumerate = JS_EnumerateStub ; <nl> + jsb_cocos2d_ui_AbstractCheckButton_class - > resolve = JS_ResolveStub ; <nl> + jsb_cocos2d_ui_AbstractCheckButton_class - > convert = JS_ConvertStub ; <nl> + jsb_cocos2d_ui_AbstractCheckButton_class - > finalize = js_cocos2d_ui_AbstractCheckButton_finalize ; <nl> + jsb_cocos2d_ui_AbstractCheckButton_class - > flags = JSCLASS_HAS_RESERVED_SLOTS ( 2 ) ; <nl> + <nl> + static JSPropertySpec properties [ ] = { <nl> + JS_PSG ( " __nativeObj " , js_is_native_obj , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_PS_END <nl> + } ; <nl> + <nl> + static JSFunctionSpec funcs [ ] = { <nl> + JS_FN ( " loadTextureBackGroundSelected " , js_cocos2dx_ui_AbstractCheckButton_loadTextureBackGroundSelected , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_FN ( " loadTextureBackGroundDisabled " , js_cocos2dx_ui_AbstractCheckButton_loadTextureBackGroundDisabled , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_FN ( " setSelected " , js_cocos2dx_ui_AbstractCheckButton_setSelected , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_FN ( " loadTextureFrontCross " , js_cocos2dx_ui_AbstractCheckButton_loadTextureFrontCross , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_FN ( " isSelected " , js_cocos2dx_ui_AbstractCheckButton_isSelected , 0 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_FN ( " init " , js_cocos2dx_ui_AbstractCheckButton_init , 5 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_FN ( " loadTextures " , js_cocos2dx_ui_AbstractCheckButton_loadTextures , 5 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_FN ( " getZoomScale " , js_cocos2dx_ui_AbstractCheckButton_getZoomScale , 0 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_FN ( " loadTextureBackGround " , js_cocos2dx_ui_AbstractCheckButton_loadTextureBackGround , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_FN ( " setZoomScale " , js_cocos2dx_ui_AbstractCheckButton_setZoomScale , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_FN ( " loadTextureFrontCrossDisabled " , js_cocos2dx_ui_AbstractCheckButton_loadTextureFrontCrossDisabled , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_FS_END <nl> + } ; <nl> + <nl> + JSFunctionSpec * st_funcs = NULL ; <nl> + <nl> + jsb_cocos2d_ui_AbstractCheckButton_prototype = JS_InitClass ( <nl> + cx , global , <nl> + JS : : RootedObject ( cx , jsb_cocos2d_ui_Widget_prototype ) , <nl> + jsb_cocos2d_ui_AbstractCheckButton_class , <nl> + empty_constructor , 0 , <nl> + properties , <nl> + funcs , <nl> + NULL , / / no static properties <nl> + st_funcs ) ; <nl> + / / make the class enumerable in the registered namespace <nl> + / / bool found ; <nl> + / / FIXME : Removed in Firefox v27 <nl> + / / JS_SetPropertyAttributes ( cx , global , " AbstractCheckButton " , JSPROP_ENUMERATE | JSPROP_READONLY , & found ) ; <nl> + <nl> + / / add the proto and JSClass to the type - > js info hash table <nl> + TypeTest < cocos2d : : ui : : AbstractCheckButton > t ; <nl> + js_type_class_t * p ; <nl> + std : : string typeName = t . s_name ( ) ; <nl> + if ( _js_global_type_map . find ( typeName ) = = _js_global_type_map . end ( ) ) <nl> + { <nl> + p = ( js_type_class_t * ) malloc ( sizeof ( js_type_class_t ) ) ; <nl> + p - > jsclass = jsb_cocos2d_ui_AbstractCheckButton_class ; <nl> + p - > proto = jsb_cocos2d_ui_AbstractCheckButton_prototype ; <nl> + p - > parentProto = jsb_cocos2d_ui_Widget_prototype ; <nl> + _js_global_type_map . insert ( std : : make_pair ( typeName , p ) ) ; <nl> + } <nl> + } <nl> + <nl> + JSClass * jsb_cocos2d_ui_CheckBox_class ; <nl> + JSObject * jsb_cocos2d_ui_CheckBox_prototype ; <nl> + <nl> + bool js_cocos2dx_ui_CheckBox_create ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + { <nl> + JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> + bool ok = true ; <nl> + <nl> + do { <nl> + if ( argc = = 5 ) { <nl> + std : : string arg0 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 0 ) , & arg0 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + std : : string arg1 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 1 ) , & arg1 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + std : : string arg2 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 2 ) , & arg2 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + std : : string arg3 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 3 ) , & arg3 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + std : : string arg4 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 4 ) , & arg4 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + cocos2d : : ui : : CheckBox * ret = cocos2d : : ui : : CheckBox : : create ( arg0 , arg1 , arg2 , arg3 , arg4 ) ; <nl> + jsval jsret = JSVAL_NULL ; <nl> + do { <nl> + if ( ret ) { <nl> + js_proxy_t * jsProxy = js_get_or_create_proxy < cocos2d : : ui : : CheckBox > ( cx , ( cocos2d : : ui : : CheckBox * ) ret ) ; <nl> + jsret = OBJECT_TO_JSVAL ( jsProxy - > obj ) ; <nl> + } else { <nl> + jsret = JSVAL_NULL ; <nl> + } <nl> + } while ( 0 ) ; <nl> + args . rval ( ) . set ( jsret ) ; <nl> + return true ; <nl> + } <nl> + } while ( 0 ) ; <nl> + do { <nl> + if ( argc = = 6 ) { <nl> + std : : string arg0 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 0 ) , & arg0 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + std : : string arg1 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 1 ) , & arg1 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + std : : string arg2 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 2 ) , & arg2 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + std : : string arg3 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 3 ) , & arg3 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + std : : string arg4 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 4 ) , & arg4 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + cocos2d : : ui : : Widget : : TextureResType arg5 ; <nl> + ok & = jsval_to_int32 ( cx , args . get ( 5 ) , ( int32_t * ) & arg5 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + cocos2d : : ui : : CheckBox * ret = cocos2d : : ui : : CheckBox : : create ( arg0 , arg1 , arg2 , arg3 , arg4 , arg5 ) ; <nl> + jsval jsret = JSVAL_NULL ; <nl> + do { <nl> + if ( ret ) { <nl> + js_proxy_t * jsProxy = js_get_or_create_proxy < cocos2d : : ui : : CheckBox > ( cx , ( cocos2d : : ui : : CheckBox * ) ret ) ; <nl> + jsret = OBJECT_TO_JSVAL ( jsProxy - > obj ) ; <nl> + } else { <nl> + jsret = JSVAL_NULL ; <nl> + } <nl> + } while ( 0 ) ; <nl> + args . rval ( ) . set ( jsret ) ; <nl> + return true ; <nl> + } <nl> + } while ( 0 ) ; <nl> + <nl> + do { <nl> + if ( argc = = 0 ) { <nl> + cocos2d : : ui : : CheckBox * ret = cocos2d : : ui : : CheckBox : : create ( ) ; <nl> + jsval jsret = JSVAL_NULL ; <nl> + do { <nl> + if ( ret ) { <nl> + js_proxy_t * jsProxy = js_get_or_create_proxy < cocos2d : : ui : : CheckBox > ( cx , ( cocos2d : : ui : : CheckBox * ) ret ) ; <nl> + jsret = OBJECT_TO_JSVAL ( jsProxy - > obj ) ; <nl> + } else { <nl> + jsret = JSVAL_NULL ; <nl> + } <nl> + } while ( 0 ) ; <nl> + args . rval ( ) . set ( jsret ) ; <nl> + return true ; <nl> + } <nl> + } while ( 0 ) ; <nl> + <nl> + do { <nl> + if ( argc = = 2 ) { <nl> + std : : string arg0 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 0 ) , & arg0 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + std : : string arg1 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 1 ) , & arg1 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + cocos2d : : ui : : CheckBox * ret = cocos2d : : ui : : CheckBox : : create ( arg0 , arg1 ) ; <nl> + jsval jsret = JSVAL_NULL ; <nl> + do { <nl> + if ( ret ) { <nl> + js_proxy_t * jsProxy = js_get_or_create_proxy < cocos2d : : ui : : CheckBox > ( cx , ( cocos2d : : ui : : CheckBox * ) ret ) ; <nl> + jsret = OBJECT_TO_JSVAL ( jsProxy - > obj ) ; <nl> + } else { <nl> + jsret = JSVAL_NULL ; <nl> + } <nl> + } while ( 0 ) ; <nl> + args . rval ( ) . set ( jsret ) ; <nl> + return true ; <nl> + } <nl> + } while ( 0 ) ; <nl> + do { <nl> + if ( argc = = 3 ) { <nl> + std : : string arg0 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 0 ) , & arg0 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + std : : string arg1 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 1 ) , & arg1 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + cocos2d : : ui : : Widget : : TextureResType arg2 ; <nl> + ok & = jsval_to_int32 ( cx , args . get ( 2 ) , ( int32_t * ) & arg2 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + cocos2d : : ui : : CheckBox * ret = cocos2d : : ui : : CheckBox : : create ( arg0 , arg1 , arg2 ) ; <nl> + jsval jsret = JSVAL_NULL ; <nl> + do { <nl> + if ( ret ) { <nl> + js_proxy_t * jsProxy = js_get_or_create_proxy < cocos2d : : ui : : CheckBox > ( cx , ( cocos2d : : ui : : CheckBox * ) ret ) ; <nl> + jsret = OBJECT_TO_JSVAL ( jsProxy - > obj ) ; <nl> + } else { <nl> + jsret = JSVAL_NULL ; <nl> + } <nl> + } while ( 0 ) ; <nl> + args . rval ( ) . set ( jsret ) ; <nl> + return true ; <nl> + } <nl> + } while ( 0 ) ; <nl> + JS_ReportError ( cx , " js_cocos2dx_ui_CheckBox_create : wrong number of arguments " ) ; <nl> + return false ; <nl> + } <nl> + bool js_cocos2dx_ui_CheckBox_createInstance ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + { <nl> + JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> + if ( argc = = 0 ) { <nl> + cocos2d : : Ref * ret = cocos2d : : ui : : CheckBox : : createInstance ( ) ; <nl> + jsval jsret = JSVAL_NULL ; <nl> + do { <nl> + if ( ret ) { <nl> + js_proxy_t * jsProxy = js_get_or_create_proxy < cocos2d : : Ref > ( cx , ( cocos2d : : Ref * ) ret ) ; <nl> + jsret = OBJECT_TO_JSVAL ( jsProxy - > obj ) ; <nl> + } else { <nl> + jsret = JSVAL_NULL ; <nl> + } <nl> + } while ( 0 ) ; <nl> + args . rval ( ) . set ( jsret ) ; <nl> + return true ; <nl> + } <nl> + JS_ReportError ( cx , " js_cocos2dx_ui_CheckBox_createInstance : wrong number of arguments " ) ; <nl> + return false ; <nl> + } <nl> + <nl> + bool js_cocos2dx_ui_CheckBox_constructor ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + { <nl> + JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> + bool ok = true ; <nl> + cocos2d : : ui : : CheckBox * cobj = new ( std : : nothrow ) cocos2d : : ui : : CheckBox ( ) ; <nl> + cocos2d : : Ref * _ccobj = dynamic_cast < cocos2d : : Ref * > ( cobj ) ; <nl> + if ( _ccobj ) { <nl> + _ccobj - > autorelease ( ) ; <nl> + } <nl> + TypeTest < cocos2d : : ui : : CheckBox > t ; <nl> + js_type_class_t * typeClass = nullptr ; <nl> + std : : string typeName = t . s_name ( ) ; <nl> + auto typeMapIter = _js_global_type_map . find ( typeName ) ; <nl> + CCASSERT ( typeMapIter ! = _js_global_type_map . end ( ) , " Can ' t find the class type ! " ) ; <nl> + typeClass = typeMapIter - > second ; <nl> + CCASSERT ( typeClass , " The value is null . " ) ; <nl> + / / JSObject * obj = JS_NewObject ( cx , typeClass - > jsclass , typeClass - > proto , typeClass - > parentProto ) ; <nl> + JS : : RootedObject proto ( cx , typeClass - > proto . get ( ) ) ; <nl> + JS : : RootedObject parent ( cx , typeClass - > parentProto . get ( ) ) ; <nl> + JS : : RootedObject obj ( cx , JS_NewObject ( cx , typeClass - > jsclass , proto , parent ) ) ; <nl> + args . rval ( ) . set ( OBJECT_TO_JSVAL ( obj ) ) ; <nl> + / / link the native object with the javascript object <nl> + js_proxy_t * p = jsb_new_proxy ( cobj , obj ) ; <nl> + AddNamedObjectRoot ( cx , & p - > obj , " cocos2d : : ui : : CheckBox " ) ; <nl> + if ( JS_HasProperty ( cx , obj , " _ctor " , & ok ) & & ok ) <nl> + ScriptingCore : : getInstance ( ) - > executeFunctionWithOwner ( OBJECT_TO_JSVAL ( obj ) , " _ctor " , args ) ; <nl> + return true ; <nl> + } <nl> + <nl> + <nl> + extern JSObject * jsb_cocos2d_ui_AbstractCheckButton_prototype ; <nl> + <nl> + void js_cocos2d_ui_CheckBox_finalize ( JSFreeOp * fop , JSObject * obj ) { <nl> + CCLOGINFO ( " jsbindings : finalizing JS object % p ( CheckBox ) " , obj ) ; <nl> + } <nl> + <nl> + static bool js_cocos2d_ui_CheckBox_ctor ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + { <nl> + JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> + JS : : RootedObject obj ( cx , args . thisv ( ) . toObjectOrNull ( ) ) ; <nl> + cocos2d : : ui : : CheckBox * nobj = new ( std : : nothrow ) cocos2d : : ui : : CheckBox ( ) ; <nl> + if ( nobj ) { <nl> + nobj - > autorelease ( ) ; <nl> + } <nl> + js_proxy_t * p = jsb_new_proxy ( nobj , obj ) ; <nl> + AddNamedObjectRoot ( cx , & p - > obj , " cocos2d : : ui : : CheckBox " ) ; <nl> + bool isFound = false ; <nl> + if ( JS_HasProperty ( cx , obj , " _ctor " , & isFound ) & & isFound ) <nl> + ScriptingCore : : getInstance ( ) - > executeFunctionWithOwner ( OBJECT_TO_JSVAL ( obj ) , " _ctor " , args ) ; <nl> + args . rval ( ) . setUndefined ( ) ; <nl> + return true ; <nl> + } <nl> + void js_register_cocos2dx_ui_CheckBox ( JSContext * cx , JS : : HandleObject global ) { <nl> + jsb_cocos2d_ui_CheckBox_class = ( JSClass * ) calloc ( 1 , sizeof ( JSClass ) ) ; <nl> + jsb_cocos2d_ui_CheckBox_class - > name = " CheckBox " ; <nl> + jsb_cocos2d_ui_CheckBox_class - > addProperty = JS_PropertyStub ; <nl> + jsb_cocos2d_ui_CheckBox_class - > delProperty = JS_DeletePropertyStub ; <nl> + jsb_cocos2d_ui_CheckBox_class - > getProperty = JS_PropertyStub ; <nl> + jsb_cocos2d_ui_CheckBox_class - > setProperty = JS_StrictPropertyStub ; <nl> + jsb_cocos2d_ui_CheckBox_class - > enumerate = JS_EnumerateStub ; <nl> + jsb_cocos2d_ui_CheckBox_class - > resolve = JS_ResolveStub ; <nl> + jsb_cocos2d_ui_CheckBox_class - > convert = JS_ConvertStub ; <nl> + jsb_cocos2d_ui_CheckBox_class - > finalize = js_cocos2d_ui_CheckBox_finalize ; <nl> + jsb_cocos2d_ui_CheckBox_class - > flags = JSCLASS_HAS_RESERVED_SLOTS ( 2 ) ; <nl> + <nl> + static JSPropertySpec properties [ ] = { <nl> + JS_PSG ( " __nativeObj " , js_is_native_obj , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_PS_END <nl> + } ; <nl> + <nl> + static JSFunctionSpec funcs [ ] = { <nl> + JS_FN ( " ctor " , js_cocos2d_ui_CheckBox_ctor , 0 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_FS_END <nl> + } ; <nl> + <nl> + static JSFunctionSpec st_funcs [ ] = { <nl> + JS_FN ( " create " , js_cocos2dx_ui_CheckBox_create , 0 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_FN ( " createInstance " , js_cocos2dx_ui_CheckBox_createInstance , 0 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_FS_END <nl> + } ; <nl> + <nl> + jsb_cocos2d_ui_CheckBox_prototype = JS_InitClass ( <nl> + cx , global , <nl> + JS : : RootedObject ( cx , jsb_cocos2d_ui_AbstractCheckButton_prototype ) , <nl> + jsb_cocos2d_ui_CheckBox_class , <nl> + js_cocos2dx_ui_CheckBox_constructor , 0 , / / constructor <nl> + properties , <nl> + funcs , <nl> + NULL , / / no static properties <nl> + st_funcs ) ; <nl> + / / make the class enumerable in the registered namespace <nl> + / / bool found ; <nl> + / / FIXME : Removed in Firefox v27 <nl> + / / JS_SetPropertyAttributes ( cx , global , " CheckBox " , JSPROP_ENUMERATE | JSPROP_READONLY , & found ) ; <nl> + <nl> + / / add the proto and JSClass to the type - > js info hash table <nl> + TypeTest < cocos2d : : ui : : CheckBox > t ; <nl> + js_type_class_t * p ; <nl> + std : : string typeName = t . s_name ( ) ; <nl> + if ( _js_global_type_map . find ( typeName ) = = _js_global_type_map . end ( ) ) <nl> + { <nl> + p = ( js_type_class_t * ) malloc ( sizeof ( js_type_class_t ) ) ; <nl> + p - > jsclass = jsb_cocos2d_ui_CheckBox_class ; <nl> + p - > proto = jsb_cocos2d_ui_CheckBox_prototype ; <nl> + p - > parentProto = jsb_cocos2d_ui_AbstractCheckButton_prototype ; <nl> + _js_global_type_map . insert ( std : : make_pair ( typeName , p ) ) ; <nl> + } <nl> + } <nl> + <nl> + JSClass * jsb_cocos2d_ui_RadioButton_class ; <nl> + JSObject * jsb_cocos2d_ui_RadioButton_prototype ; <nl> + <nl> + bool js_cocos2dx_ui_RadioButton_create ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + { <nl> + JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> + bool ok = true ; <nl> + <nl> + do { <nl> + if ( argc = = 5 ) { <nl> + std : : string arg0 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 0 ) , & arg0 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + std : : string arg1 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 1 ) , & arg1 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + std : : string arg2 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 2 ) , & arg2 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + std : : string arg3 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 3 ) , & arg3 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + std : : string arg4 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 4 ) , & arg4 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + cocos2d : : ui : : RadioButton * ret = cocos2d : : ui : : RadioButton : : create ( arg0 , arg1 , arg2 , arg3 , arg4 ) ; <nl> + jsval jsret = JSVAL_NULL ; <nl> + do { <nl> + if ( ret ) { <nl> + js_proxy_t * jsProxy = js_get_or_create_proxy < cocos2d : : ui : : RadioButton > ( cx , ( cocos2d : : ui : : RadioButton * ) ret ) ; <nl> + jsret = OBJECT_TO_JSVAL ( jsProxy - > obj ) ; <nl> + } else { <nl> + jsret = JSVAL_NULL ; <nl> + } <nl> + } while ( 0 ) ; <nl> + args . rval ( ) . set ( jsret ) ; <nl> + return true ; <nl> + } <nl> + } while ( 0 ) ; <nl> + do { <nl> + if ( argc = = 6 ) { <nl> + std : : string arg0 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 0 ) , & arg0 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + std : : string arg1 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 1 ) , & arg1 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + std : : string arg2 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 2 ) , & arg2 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + std : : string arg3 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 3 ) , & arg3 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + std : : string arg4 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 4 ) , & arg4 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + cocos2d : : ui : : Widget : : TextureResType arg5 ; <nl> + ok & = jsval_to_int32 ( cx , args . get ( 5 ) , ( int32_t * ) & arg5 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + cocos2d : : ui : : RadioButton * ret = cocos2d : : ui : : RadioButton : : create ( arg0 , arg1 , arg2 , arg3 , arg4 , arg5 ) ; <nl> + jsval jsret = JSVAL_NULL ; <nl> + do { <nl> + if ( ret ) { <nl> + js_proxy_t * jsProxy = js_get_or_create_proxy < cocos2d : : ui : : RadioButton > ( cx , ( cocos2d : : ui : : RadioButton * ) ret ) ; <nl> + jsret = OBJECT_TO_JSVAL ( jsProxy - > obj ) ; <nl> + } else { <nl> + jsret = JSVAL_NULL ; <nl> + } <nl> + } while ( 0 ) ; <nl> + args . rval ( ) . set ( jsret ) ; <nl> + return true ; <nl> + } <nl> + } while ( 0 ) ; <nl> + <nl> + do { <nl> + if ( argc = = 0 ) { <nl> + cocos2d : : ui : : RadioButton * ret = cocos2d : : ui : : RadioButton : : create ( ) ; <nl> + jsval jsret = JSVAL_NULL ; <nl> + do { <nl> + if ( ret ) { <nl> + js_proxy_t * jsProxy = js_get_or_create_proxy < cocos2d : : ui : : RadioButton > ( cx , ( cocos2d : : ui : : RadioButton * ) ret ) ; <nl> + jsret = OBJECT_TO_JSVAL ( jsProxy - > obj ) ; <nl> + } else { <nl> + jsret = JSVAL_NULL ; <nl> + } <nl> + } while ( 0 ) ; <nl> + args . rval ( ) . set ( jsret ) ; <nl> + return true ; <nl> + } <nl> + } while ( 0 ) ; <nl> + <nl> + do { <nl> + if ( argc = = 2 ) { <nl> + std : : string arg0 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 0 ) , & arg0 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + std : : string arg1 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 1 ) , & arg1 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + cocos2d : : ui : : RadioButton * ret = cocos2d : : ui : : RadioButton : : create ( arg0 , arg1 ) ; <nl> + jsval jsret = JSVAL_NULL ; <nl> + do { <nl> + if ( ret ) { <nl> + js_proxy_t * jsProxy = js_get_or_create_proxy < cocos2d : : ui : : RadioButton > ( cx , ( cocos2d : : ui : : RadioButton * ) ret ) ; <nl> + jsret = OBJECT_TO_JSVAL ( jsProxy - > obj ) ; <nl> + } else { <nl> + jsret = JSVAL_NULL ; <nl> + } <nl> + } while ( 0 ) ; <nl> + args . rval ( ) . set ( jsret ) ; <nl> + return true ; <nl> + } <nl> + } while ( 0 ) ; <nl> + do { <nl> + if ( argc = = 3 ) { <nl> + std : : string arg0 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 0 ) , & arg0 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + std : : string arg1 ; <nl> + ok & = jsval_to_std_string ( cx , args . get ( 1 ) , & arg1 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + cocos2d : : ui : : Widget : : TextureResType arg2 ; <nl> + ok & = jsval_to_int32 ( cx , args . get ( 2 ) , ( int32_t * ) & arg2 ) ; <nl> + if ( ! ok ) { ok = true ; break ; } <nl> + cocos2d : : ui : : RadioButton * ret = cocos2d : : ui : : RadioButton : : create ( arg0 , arg1 , arg2 ) ; <nl> + jsval jsret = JSVAL_NULL ; <nl> + do { <nl> + if ( ret ) { <nl> + js_proxy_t * jsProxy = js_get_or_create_proxy < cocos2d : : ui : : RadioButton > ( cx , ( cocos2d : : ui : : RadioButton * ) ret ) ; <nl> + jsret = OBJECT_TO_JSVAL ( jsProxy - > obj ) ; <nl> + } else { <nl> + jsret = JSVAL_NULL ; <nl> + } <nl> + } while ( 0 ) ; <nl> + args . rval ( ) . set ( jsret ) ; <nl> + return true ; <nl> + } <nl> + } while ( 0 ) ; <nl> + JS_ReportError ( cx , " js_cocos2dx_ui_RadioButton_create : wrong number of arguments " ) ; <nl> + return false ; <nl> + } <nl> + bool js_cocos2dx_ui_RadioButton_createInstance ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + { <nl> + JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> + if ( argc = = 0 ) { <nl> + cocos2d : : Ref * ret = cocos2d : : ui : : RadioButton : : createInstance ( ) ; <nl> + jsval jsret = JSVAL_NULL ; <nl> + do { <nl> + if ( ret ) { <nl> + js_proxy_t * jsProxy = js_get_or_create_proxy < cocos2d : : Ref > ( cx , ( cocos2d : : Ref * ) ret ) ; <nl> + jsret = OBJECT_TO_JSVAL ( jsProxy - > obj ) ; <nl> + } else { <nl> + jsret = JSVAL_NULL ; <nl> + } <nl> + } while ( 0 ) ; <nl> + args . rval ( ) . set ( jsret ) ; <nl> + return true ; <nl> + } <nl> + JS_ReportError ( cx , " js_cocos2dx_ui_RadioButton_createInstance : wrong number of arguments " ) ; <nl> + return false ; <nl> + } <nl> + <nl> + bool js_cocos2dx_ui_RadioButton_constructor ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + { <nl> + JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> + bool ok = true ; <nl> + cocos2d : : ui : : RadioButton * cobj = new ( std : : nothrow ) cocos2d : : ui : : RadioButton ( ) ; <nl> + cocos2d : : Ref * _ccobj = dynamic_cast < cocos2d : : Ref * > ( cobj ) ; <nl> + if ( _ccobj ) { <nl> + _ccobj - > autorelease ( ) ; <nl> + } <nl> + TypeTest < cocos2d : : ui : : RadioButton > t ; <nl> + js_type_class_t * typeClass = nullptr ; <nl> + std : : string typeName = t . s_name ( ) ; <nl> + auto typeMapIter = _js_global_type_map . find ( typeName ) ; <nl> + CCASSERT ( typeMapIter ! = _js_global_type_map . end ( ) , " Can ' t find the class type ! " ) ; <nl> + typeClass = typeMapIter - > second ; <nl> + CCASSERT ( typeClass , " The value is null . " ) ; <nl> + / / JSObject * obj = JS_NewObject ( cx , typeClass - > jsclass , typeClass - > proto , typeClass - > parentProto ) ; <nl> + JS : : RootedObject proto ( cx , typeClass - > proto . get ( ) ) ; <nl> + JS : : RootedObject parent ( cx , typeClass - > parentProto . get ( ) ) ; <nl> + JS : : RootedObject obj ( cx , JS_NewObject ( cx , typeClass - > jsclass , proto , parent ) ) ; <nl> + args . rval ( ) . set ( OBJECT_TO_JSVAL ( obj ) ) ; <nl> + / / link the native object with the javascript object <nl> + js_proxy_t * p = jsb_new_proxy ( cobj , obj ) ; <nl> + AddNamedObjectRoot ( cx , & p - > obj , " cocos2d : : ui : : RadioButton " ) ; <nl> + if ( JS_HasProperty ( cx , obj , " _ctor " , & ok ) & & ok ) <nl> + ScriptingCore : : getInstance ( ) - > executeFunctionWithOwner ( OBJECT_TO_JSVAL ( obj ) , " _ctor " , args ) ; <nl> + return true ; <nl> + } <nl> + <nl> + <nl> + extern JSObject * jsb_cocos2d_ui_AbstractCheckButton_prototype ; <nl> + <nl> + void js_cocos2d_ui_RadioButton_finalize ( JSFreeOp * fop , JSObject * obj ) { <nl> + CCLOGINFO ( " jsbindings : finalizing JS object % p ( RadioButton ) " , obj ) ; <nl> + } <nl> + <nl> + void js_register_cocos2dx_ui_RadioButton ( JSContext * cx , JS : : HandleObject global ) { <nl> + jsb_cocos2d_ui_RadioButton_class = ( JSClass * ) calloc ( 1 , sizeof ( JSClass ) ) ; <nl> + jsb_cocos2d_ui_RadioButton_class - > name = " RadioButton " ; <nl> + jsb_cocos2d_ui_RadioButton_class - > addProperty = JS_PropertyStub ; <nl> + jsb_cocos2d_ui_RadioButton_class - > delProperty = JS_DeletePropertyStub ; <nl> + jsb_cocos2d_ui_RadioButton_class - > getProperty = JS_PropertyStub ; <nl> + jsb_cocos2d_ui_RadioButton_class - > setProperty = JS_StrictPropertyStub ; <nl> + jsb_cocos2d_ui_RadioButton_class - > enumerate = JS_EnumerateStub ; <nl> + jsb_cocos2d_ui_RadioButton_class - > resolve = JS_ResolveStub ; <nl> + jsb_cocos2d_ui_RadioButton_class - > convert = JS_ConvertStub ; <nl> + jsb_cocos2d_ui_RadioButton_class - > finalize = js_cocos2d_ui_RadioButton_finalize ; <nl> + jsb_cocos2d_ui_RadioButton_class - > flags = JSCLASS_HAS_RESERVED_SLOTS ( 2 ) ; <nl> + <nl> + static JSPropertySpec properties [ ] = { <nl> + JS_PSG ( " __nativeObj " , js_is_native_obj , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_PS_END <nl> + } ; <nl> + <nl> + static JSFunctionSpec funcs [ ] = { <nl> + JS_FS_END <nl> + } ; <nl> + <nl> + static JSFunctionSpec st_funcs [ ] = { <nl> + JS_FN ( " create " , js_cocos2dx_ui_RadioButton_create , 0 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_FN ( " createInstance " , js_cocos2dx_ui_RadioButton_createInstance , 0 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_FS_END <nl> + } ; <nl> + <nl> + jsb_cocos2d_ui_RadioButton_prototype = JS_InitClass ( <nl> + cx , global , <nl> + JS : : RootedObject ( cx , jsb_cocos2d_ui_AbstractCheckButton_prototype ) , <nl> + jsb_cocos2d_ui_RadioButton_class , <nl> + js_cocos2dx_ui_RadioButton_constructor , 0 , / / constructor <nl> + properties , <nl> + funcs , <nl> + NULL , / / no static properties <nl> + st_funcs ) ; <nl> + / / make the class enumerable in the registered namespace <nl> + / / bool found ; <nl> + / / FIXME : Removed in Firefox v27 <nl> + / / JS_SetPropertyAttributes ( cx , global , " RadioButton " , JSPROP_ENUMERATE | JSPROP_READONLY , & found ) ; <nl> + <nl> + / / add the proto and JSClass to the type - > js info hash table <nl> + TypeTest < cocos2d : : ui : : RadioButton > t ; <nl> + js_type_class_t * p ; <nl> + std : : string typeName = t . s_name ( ) ; <nl> + if ( _js_global_type_map . find ( typeName ) = = _js_global_type_map . end ( ) ) <nl> + { <nl> + p = ( js_type_class_t * ) malloc ( sizeof ( js_type_class_t ) ) ; <nl> + p - > jsclass = jsb_cocos2d_ui_RadioButton_class ; <nl> + p - > proto = jsb_cocos2d_ui_RadioButton_prototype ; <nl> + p - > parentProto = jsb_cocos2d_ui_AbstractCheckButton_prototype ; <nl> + _js_global_type_map . insert ( std : : make_pair ( typeName , p ) ) ; <nl> + } <nl> + } <nl> + <nl> + JSClass * jsb_cocos2d_ui_RadioButtonGroup_class ; <nl> + JSObject * jsb_cocos2d_ui_RadioButtonGroup_prototype ; <nl> + <nl> + bool js_cocos2dx_ui_RadioButtonGroup_removeRadioButton ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + { <nl> + JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> + bool ok = true ; <nl> + JS : : RootedObject obj ( cx , args . thisv ( ) . toObjectOrNull ( ) ) ; <nl> + js_proxy_t * proxy = jsb_get_js_proxy ( obj ) ; <nl> + cocos2d : : ui : : RadioButtonGroup * cobj = ( cocos2d : : ui : : RadioButtonGroup * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_RadioButtonGroup_removeRadioButton : Invalid Native Object " ) ; <nl> + if ( argc = = 1 ) { <nl> + cocos2d : : ui : : RadioButton * arg0 ; <nl> + do { <nl> + if ( args . get ( 0 ) . isNull ( ) ) { arg0 = nullptr ; break ; } <nl> + if ( ! args . get ( 0 ) . isObject ( ) ) { ok = false ; break ; } <nl> + js_proxy_t * jsProxy ; <nl> + JSObject * tmpObj = args . get ( 0 ) . toObjectOrNull ( ) ; <nl> + jsProxy = jsb_get_js_proxy ( tmpObj ) ; <nl> + arg0 = ( cocos2d : : ui : : RadioButton * ) ( jsProxy ? jsProxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( arg0 , cx , false , " Invalid Native Object " ) ; <nl> + } while ( 0 ) ; <nl> + JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_RadioButtonGroup_removeRadioButton : Error processing arguments " ) ; <nl> + cobj - > removeRadioButton ( arg0 ) ; <nl> + args . rval ( ) . setUndefined ( ) ; <nl> + return true ; <nl> + } <nl> + <nl> + JS_ReportError ( cx , " js_cocos2dx_ui_RadioButtonGroup_removeRadioButton : wrong number of arguments : % d , was expecting % d " , argc , 1 ) ; <nl> + return false ; <nl> + } <nl> + bool js_cocos2dx_ui_RadioButtonGroup_isAllowedNoSelection ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + { <nl> + JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> + JS : : RootedObject obj ( cx , args . thisv ( ) . toObjectOrNull ( ) ) ; <nl> + js_proxy_t * proxy = jsb_get_js_proxy ( obj ) ; <nl> + cocos2d : : ui : : RadioButtonGroup * cobj = ( cocos2d : : ui : : RadioButtonGroup * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_RadioButtonGroup_isAllowedNoSelection : Invalid Native Object " ) ; <nl> + if ( argc = = 0 ) { <nl> + bool ret = cobj - > isAllowedNoSelection ( ) ; <nl> + jsval jsret = JSVAL_NULL ; <nl> + jsret = BOOLEAN_TO_JSVAL ( ret ) ; <nl> + args . rval ( ) . set ( jsret ) ; <nl> + return true ; <nl> + } <nl> + <nl> + JS_ReportError ( cx , " js_cocos2dx_ui_RadioButtonGroup_isAllowedNoSelection : wrong number of arguments : % d , was expecting % d " , argc , 0 ) ; <nl> + return false ; <nl> + } <nl> + bool js_cocos2dx_ui_RadioButtonGroup_getSelectedButtonIndex ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + { <nl> + JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> + JS : : RootedObject obj ( cx , args . thisv ( ) . toObjectOrNull ( ) ) ; <nl> + js_proxy_t * proxy = jsb_get_js_proxy ( obj ) ; <nl> + cocos2d : : ui : : RadioButtonGroup * cobj = ( cocos2d : : ui : : RadioButtonGroup * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_RadioButtonGroup_getSelectedButtonIndex : Invalid Native Object " ) ; <nl> + if ( argc = = 0 ) { <nl> + int ret = cobj - > getSelectedButtonIndex ( ) ; <nl> + jsval jsret = JSVAL_NULL ; <nl> + jsret = int32_to_jsval ( cx , ret ) ; <nl> + args . rval ( ) . set ( jsret ) ; <nl> + return true ; <nl> + } <nl> + <nl> + JS_ReportError ( cx , " js_cocos2dx_ui_RadioButtonGroup_getSelectedButtonIndex : wrong number of arguments : % d , was expecting % d " , argc , 0 ) ; <nl> + return false ; <nl> + } <nl> + bool js_cocos2dx_ui_RadioButtonGroup_setAllowedNoSelection ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + { <nl> + JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> + bool ok = true ; <nl> + JS : : RootedObject obj ( cx , args . thisv ( ) . toObjectOrNull ( ) ) ; <nl> + js_proxy_t * proxy = jsb_get_js_proxy ( obj ) ; <nl> + cocos2d : : ui : : RadioButtonGroup * cobj = ( cocos2d : : ui : : RadioButtonGroup * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_RadioButtonGroup_setAllowedNoSelection : Invalid Native Object " ) ; <nl> + if ( argc = = 1 ) { <nl> + bool arg0 ; <nl> + arg0 = JS : : ToBoolean ( args . get ( 0 ) ) ; <nl> + JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_RadioButtonGroup_setAllowedNoSelection : Error processing arguments " ) ; <nl> + cobj - > setAllowedNoSelection ( arg0 ) ; <nl> + args . rval ( ) . setUndefined ( ) ; <nl> + return true ; <nl> + } <nl> + <nl> + JS_ReportError ( cx , " js_cocos2dx_ui_RadioButtonGroup_setAllowedNoSelection : wrong number of arguments : % d , was expecting % d " , argc , 1 ) ; <nl> + return false ; <nl> + } <nl> + bool js_cocos2dx_ui_RadioButtonGroup_getRadioButtonByIndex ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + { <nl> + JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> + bool ok = true ; <nl> + JS : : RootedObject obj ( cx , args . thisv ( ) . toObjectOrNull ( ) ) ; <nl> + js_proxy_t * proxy = jsb_get_js_proxy ( obj ) ; <nl> + cocos2d : : ui : : RadioButtonGroup * cobj = ( cocos2d : : ui : : RadioButtonGroup * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_RadioButtonGroup_getRadioButtonByIndex : Invalid Native Object " ) ; <nl> + if ( argc = = 1 ) { <nl> + int arg0 ; <nl> + ok & = jsval_to_int32 ( cx , args . get ( 0 ) , ( int32_t * ) & arg0 ) ; <nl> + JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_RadioButtonGroup_getRadioButtonByIndex : Error processing arguments " ) ; <nl> + cocos2d : : ui : : RadioButton * ret = cobj - > getRadioButtonByIndex ( arg0 ) ; <nl> + jsval jsret = JSVAL_NULL ; <nl> + do { <nl> + if ( ret ) { <nl> + js_proxy_t * jsProxy = js_get_or_create_proxy < cocos2d : : ui : : RadioButton > ( cx , ( cocos2d : : ui : : RadioButton * ) ret ) ; <nl> + jsret = OBJECT_TO_JSVAL ( jsProxy - > obj ) ; <nl> + } else { <nl> + jsret = JSVAL_NULL ; <nl> + } <nl> + } while ( 0 ) ; <nl> + args . rval ( ) . set ( jsret ) ; <nl> + return true ; <nl> + } <nl> + <nl> + JS_ReportError ( cx , " js_cocos2dx_ui_RadioButtonGroup_getRadioButtonByIndex : wrong number of arguments : % d , was expecting % d " , argc , 1 ) ; <nl> return false ; <nl> } <nl> - bool js_cocos2dx_ui_CheckBox_setZoomScale ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + bool js_cocos2dx_ui_RadioButtonGroup_getNumberOfRadioButtons ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> { <nl> JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> - bool ok = true ; <nl> JS : : RootedObject obj ( cx , args . thisv ( ) . toObjectOrNull ( ) ) ; <nl> js_proxy_t * proxy = jsb_get_js_proxy ( obj ) ; <nl> - cocos2d : : ui : : CheckBox * cobj = ( cocos2d : : ui : : CheckBox * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> - JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_CheckBox_setZoomScale : Invalid Native Object " ) ; <nl> - if ( argc = = 1 ) { <nl> - double arg0 ; <nl> - ok & = JS : : ToNumber ( cx , args . get ( 0 ) , & arg0 ) & & ! isnan ( arg0 ) ; <nl> - JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_CheckBox_setZoomScale : Error processing arguments " ) ; <nl> - cobj - > setZoomScale ( arg0 ) ; <nl> - args . rval ( ) . setUndefined ( ) ; <nl> + cocos2d : : ui : : RadioButtonGroup * cobj = ( cocos2d : : ui : : RadioButtonGroup * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_RadioButtonGroup_getNumberOfRadioButtons : Invalid Native Object " ) ; <nl> + if ( argc = = 0 ) { <nl> + ssize_t ret = cobj - > getNumberOfRadioButtons ( ) ; <nl> + jsval jsret = JSVAL_NULL ; <nl> + jsret = ssize_to_jsval ( cx , ret ) ; <nl> + args . rval ( ) . set ( jsret ) ; <nl> return true ; <nl> } <nl> <nl> - JS_ReportError ( cx , " js_cocos2dx_ui_CheckBox_setZoomScale : wrong number of arguments : % d , was expecting % d " , argc , 1 ) ; <nl> + JS_ReportError ( cx , " js_cocos2dx_ui_RadioButtonGroup_getNumberOfRadioButtons : wrong number of arguments : % d , was expecting % d " , argc , 0 ) ; <nl> return false ; <nl> } <nl> - bool js_cocos2dx_ui_CheckBox_loadTextureFrontCrossDisabled ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + bool js_cocos2dx_ui_RadioButtonGroup_addRadioButton ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> { <nl> JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> bool ok = true ; <nl> JS : : RootedObject obj ( cx , args . thisv ( ) . toObjectOrNull ( ) ) ; <nl> js_proxy_t * proxy = jsb_get_js_proxy ( obj ) ; <nl> - cocos2d : : ui : : CheckBox * cobj = ( cocos2d : : ui : : CheckBox * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> - JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_CheckBox_loadTextureFrontCrossDisabled : Invalid Native Object " ) ; <nl> + cocos2d : : ui : : RadioButtonGroup * cobj = ( cocos2d : : ui : : RadioButtonGroup * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_RadioButtonGroup_addRadioButton : Invalid Native Object " ) ; <nl> if ( argc = = 1 ) { <nl> - std : : string arg0 ; <nl> - ok & = jsval_to_std_string ( cx , args . get ( 0 ) , & arg0 ) ; <nl> - JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_CheckBox_loadTextureFrontCrossDisabled : Error processing arguments " ) ; <nl> - cobj - > loadTextureFrontCrossDisabled ( arg0 ) ; <nl> - args . rval ( ) . setUndefined ( ) ; <nl> - return true ; <nl> - } <nl> - if ( argc = = 2 ) { <nl> - std : : string arg0 ; <nl> - cocos2d : : ui : : Widget : : TextureResType arg1 ; <nl> - ok & = jsval_to_std_string ( cx , args . get ( 0 ) , & arg0 ) ; <nl> - ok & = jsval_to_int32 ( cx , args . get ( 1 ) , ( int32_t * ) & arg1 ) ; <nl> - JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_CheckBox_loadTextureFrontCrossDisabled : Error processing arguments " ) ; <nl> - cobj - > loadTextureFrontCrossDisabled ( arg0 , arg1 ) ; <nl> + cocos2d : : ui : : RadioButton * arg0 ; <nl> + do { <nl> + if ( args . get ( 0 ) . isNull ( ) ) { arg0 = nullptr ; break ; } <nl> + if ( ! args . get ( 0 ) . isObject ( ) ) { ok = false ; break ; } <nl> + js_proxy_t * jsProxy ; <nl> + JSObject * tmpObj = args . get ( 0 ) . toObjectOrNull ( ) ; <nl> + jsProxy = jsb_get_js_proxy ( tmpObj ) ; <nl> + arg0 = ( cocos2d : : ui : : RadioButton * ) ( jsProxy ? jsProxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( arg0 , cx , false , " Invalid Native Object " ) ; <nl> + } while ( 0 ) ; <nl> + JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_RadioButtonGroup_addRadioButton : Error processing arguments " ) ; <nl> + cobj - > addRadioButton ( arg0 ) ; <nl> args . rval ( ) . setUndefined ( ) ; <nl> return true ; <nl> } <nl> <nl> - JS_ReportError ( cx , " js_cocos2dx_ui_CheckBox_loadTextureFrontCrossDisabled : wrong number of arguments : % d , was expecting % d " , argc , 1 ) ; <nl> + JS_ReportError ( cx , " js_cocos2dx_ui_RadioButtonGroup_addRadioButton : wrong number of arguments : % d , was expecting % d " , argc , 1 ) ; <nl> return false ; <nl> } <nl> - bool js_cocos2dx_ui_CheckBox_create ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + bool js_cocos2dx_ui_RadioButtonGroup_setSelectedButton ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> { <nl> JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> bool ok = true ; <nl> - <nl> - do { <nl> - if ( argc = = 5 ) { <nl> - std : : string arg0 ; <nl> - ok & = jsval_to_std_string ( cx , args . get ( 0 ) , & arg0 ) ; <nl> - if ( ! ok ) { ok = true ; break ; } <nl> - std : : string arg1 ; <nl> - ok & = jsval_to_std_string ( cx , args . get ( 1 ) , & arg1 ) ; <nl> - if ( ! ok ) { ok = true ; break ; } <nl> - std : : string arg2 ; <nl> - ok & = jsval_to_std_string ( cx , args . get ( 2 ) , & arg2 ) ; <nl> - if ( ! ok ) { ok = true ; break ; } <nl> - std : : string arg3 ; <nl> - ok & = jsval_to_std_string ( cx , args . get ( 3 ) , & arg3 ) ; <nl> - if ( ! ok ) { ok = true ; break ; } <nl> - std : : string arg4 ; <nl> - ok & = jsval_to_std_string ( cx , args . get ( 4 ) , & arg4 ) ; <nl> - if ( ! ok ) { ok = true ; break ; } <nl> - cocos2d : : ui : : CheckBox * ret = cocos2d : : ui : : CheckBox : : create ( arg0 , arg1 , arg2 , arg3 , arg4 ) ; <nl> - jsval jsret = JSVAL_NULL ; <nl> - do { <nl> - if ( ret ) { <nl> - js_proxy_t * jsProxy = js_get_or_create_proxy < cocos2d : : ui : : CheckBox > ( cx , ( cocos2d : : ui : : CheckBox * ) ret ) ; <nl> - jsret = OBJECT_TO_JSVAL ( jsProxy - > obj ) ; <nl> - } else { <nl> - jsret = JSVAL_NULL ; <nl> - } <nl> - } while ( 0 ) ; <nl> - args . rval ( ) . set ( jsret ) ; <nl> - return true ; <nl> - } <nl> - } while ( 0 ) ; <nl> - do { <nl> - if ( argc = = 6 ) { <nl> - std : : string arg0 ; <nl> - ok & = jsval_to_std_string ( cx , args . get ( 0 ) , & arg0 ) ; <nl> - if ( ! ok ) { ok = true ; break ; } <nl> - std : : string arg1 ; <nl> - ok & = jsval_to_std_string ( cx , args . get ( 1 ) , & arg1 ) ; <nl> - if ( ! ok ) { ok = true ; break ; } <nl> - std : : string arg2 ; <nl> - ok & = jsval_to_std_string ( cx , args . get ( 2 ) , & arg2 ) ; <nl> - if ( ! ok ) { ok = true ; break ; } <nl> - std : : string arg3 ; <nl> - ok & = jsval_to_std_string ( cx , args . get ( 3 ) , & arg3 ) ; <nl> - if ( ! ok ) { ok = true ; break ; } <nl> - std : : string arg4 ; <nl> - ok & = jsval_to_std_string ( cx , args . get ( 4 ) , & arg4 ) ; <nl> - if ( ! ok ) { ok = true ; break ; } <nl> - cocos2d : : ui : : Widget : : TextureResType arg5 ; <nl> - ok & = jsval_to_int32 ( cx , args . get ( 5 ) , ( int32_t * ) & arg5 ) ; <nl> - if ( ! ok ) { ok = true ; break ; } <nl> - cocos2d : : ui : : CheckBox * ret = cocos2d : : ui : : CheckBox : : create ( arg0 , arg1 , arg2 , arg3 , arg4 , arg5 ) ; <nl> - jsval jsret = JSVAL_NULL ; <nl> - do { <nl> - if ( ret ) { <nl> - js_proxy_t * jsProxy = js_get_or_create_proxy < cocos2d : : ui : : CheckBox > ( cx , ( cocos2d : : ui : : CheckBox * ) ret ) ; <nl> - jsret = OBJECT_TO_JSVAL ( jsProxy - > obj ) ; <nl> - } else { <nl> - jsret = JSVAL_NULL ; <nl> - } <nl> - } while ( 0 ) ; <nl> - args . rval ( ) . set ( jsret ) ; <nl> - return true ; <nl> - } <nl> - } while ( 0 ) ; <nl> - <nl> + <nl> + JS : : RootedObject obj ( cx ) ; <nl> + cocos2d : : ui : : RadioButtonGroup * cobj = NULL ; <nl> + obj = args . thisv ( ) . toObjectOrNull ( ) ; <nl> + js_proxy_t * proxy = jsb_get_js_proxy ( obj ) ; <nl> + cobj = ( cocos2d : : ui : : RadioButtonGroup * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_RadioButtonGroup_setSelectedButton : Invalid Native Object " ) ; <nl> do { <nl> - if ( argc = = 0 ) { <nl> - cocos2d : : ui : : CheckBox * ret = cocos2d : : ui : : CheckBox : : create ( ) ; <nl> - jsval jsret = JSVAL_NULL ; <nl> + if ( argc = = 1 ) { <nl> + cocos2d : : ui : : RadioButton * arg0 ; <nl> do { <nl> - if ( ret ) { <nl> - js_proxy_t * jsProxy = js_get_or_create_proxy < cocos2d : : ui : : CheckBox > ( cx , ( cocos2d : : ui : : CheckBox * ) ret ) ; <nl> - jsret = OBJECT_TO_JSVAL ( jsProxy - > obj ) ; <nl> - } else { <nl> - jsret = JSVAL_NULL ; <nl> - } <nl> + if ( args . get ( 0 ) . isNull ( ) ) { arg0 = nullptr ; break ; } <nl> + if ( ! args . get ( 0 ) . isObject ( ) ) { ok = false ; break ; } <nl> + js_proxy_t * jsProxy ; <nl> + JSObject * tmpObj = args . get ( 0 ) . toObjectOrNull ( ) ; <nl> + jsProxy = jsb_get_js_proxy ( tmpObj ) ; <nl> + arg0 = ( cocos2d : : ui : : RadioButton * ) ( jsProxy ? jsProxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( arg0 , cx , false , " Invalid Native Object " ) ; <nl> } while ( 0 ) ; <nl> - args . rval ( ) . set ( jsret ) ; <nl> - return true ; <nl> - } <nl> - } while ( 0 ) ; <nl> - <nl> - do { <nl> - if ( argc = = 2 ) { <nl> - std : : string arg0 ; <nl> - ok & = jsval_to_std_string ( cx , args . get ( 0 ) , & arg0 ) ; <nl> - if ( ! ok ) { ok = true ; break ; } <nl> - std : : string arg1 ; <nl> - ok & = jsval_to_std_string ( cx , args . get ( 1 ) , & arg1 ) ; <nl> if ( ! ok ) { ok = true ; break ; } <nl> - cocos2d : : ui : : CheckBox * ret = cocos2d : : ui : : CheckBox : : create ( arg0 , arg1 ) ; <nl> - jsval jsret = JSVAL_NULL ; <nl> - do { <nl> - if ( ret ) { <nl> - js_proxy_t * jsProxy = js_get_or_create_proxy < cocos2d : : ui : : CheckBox > ( cx , ( cocos2d : : ui : : CheckBox * ) ret ) ; <nl> - jsret = OBJECT_TO_JSVAL ( jsProxy - > obj ) ; <nl> - } else { <nl> - jsret = JSVAL_NULL ; <nl> - } <nl> - } while ( 0 ) ; <nl> - args . rval ( ) . set ( jsret ) ; <nl> + cobj - > setSelectedButton ( arg0 ) ; <nl> + args . rval ( ) . setUndefined ( ) ; <nl> return true ; <nl> } <nl> - } while ( 0 ) ; <nl> + } while ( 0 ) ; <nl> + <nl> do { <nl> - if ( argc = = 3 ) { <nl> - std : : string arg0 ; <nl> - ok & = jsval_to_std_string ( cx , args . get ( 0 ) , & arg0 ) ; <nl> - if ( ! ok ) { ok = true ; break ; } <nl> - std : : string arg1 ; <nl> - ok & = jsval_to_std_string ( cx , args . get ( 1 ) , & arg1 ) ; <nl> - if ( ! ok ) { ok = true ; break ; } <nl> - cocos2d : : ui : : Widget : : TextureResType arg2 ; <nl> - ok & = jsval_to_int32 ( cx , args . get ( 2 ) , ( int32_t * ) & arg2 ) ; <nl> + if ( argc = = 1 ) { <nl> + int arg0 ; <nl> + ok & = jsval_to_int32 ( cx , args . get ( 0 ) , ( int32_t * ) & arg0 ) ; <nl> if ( ! ok ) { ok = true ; break ; } <nl> - cocos2d : : ui : : CheckBox * ret = cocos2d : : ui : : CheckBox : : create ( arg0 , arg1 , arg2 ) ; <nl> - jsval jsret = JSVAL_NULL ; <nl> - do { <nl> - if ( ret ) { <nl> - js_proxy_t * jsProxy = js_get_or_create_proxy < cocos2d : : ui : : CheckBox > ( cx , ( cocos2d : : ui : : CheckBox * ) ret ) ; <nl> - jsret = OBJECT_TO_JSVAL ( jsProxy - > obj ) ; <nl> - } else { <nl> - jsret = JSVAL_NULL ; <nl> - } <nl> - } while ( 0 ) ; <nl> - args . rval ( ) . set ( jsret ) ; <nl> + cobj - > setSelectedButton ( arg0 ) ; <nl> + args . rval ( ) . setUndefined ( ) ; <nl> return true ; <nl> } <nl> - } while ( 0 ) ; <nl> - JS_ReportError ( cx , " js_cocos2dx_ui_CheckBox_create : wrong number of arguments " ) ; <nl> + } while ( 0 ) ; <nl> + <nl> + JS_ReportError ( cx , " js_cocos2dx_ui_RadioButtonGroup_setSelectedButton : wrong number of arguments " ) ; <nl> return false ; <nl> } <nl> - bool js_cocos2dx_ui_CheckBox_createInstance ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + bool js_cocos2dx_ui_RadioButtonGroup_create ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> { <nl> JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> if ( argc = = 0 ) { <nl> - cocos2d : : Ref * ret = cocos2d : : ui : : CheckBox : : createInstance ( ) ; <nl> + cocos2d : : ui : : RadioButtonGroup * ret = cocos2d : : ui : : RadioButtonGroup : : create ( ) ; <nl> jsval jsret = JSVAL_NULL ; <nl> do { <nl> if ( ret ) { <nl> - js_proxy_t * jsProxy = js_get_or_create_proxy < cocos2d : : Ref > ( cx , ( cocos2d : : Ref * ) ret ) ; <nl> + js_proxy_t * jsProxy = js_get_or_create_proxy < cocos2d : : ui : : RadioButtonGroup > ( cx , ( cocos2d : : ui : : RadioButtonGroup * ) ret ) ; <nl> jsret = OBJECT_TO_JSVAL ( jsProxy - > obj ) ; <nl> } else { <nl> jsret = JSVAL_NULL ; <nl> bool js_cocos2dx_ui_CheckBox_createInstance ( JSContext * cx , uint32_t argc , jsval <nl> args . rval ( ) . set ( jsret ) ; <nl> return true ; <nl> } <nl> - JS_ReportError ( cx , " js_cocos2dx_ui_CheckBox_createInstance : wrong number of arguments " ) ; <nl> + JS_ReportError ( cx , " js_cocos2dx_ui_RadioButtonGroup_create : wrong number of arguments " ) ; <nl> return false ; <nl> } <nl> <nl> - bool js_cocos2dx_ui_CheckBox_constructor ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + bool js_cocos2dx_ui_RadioButtonGroup_constructor ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> { <nl> JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> bool ok = true ; <nl> - cocos2d : : ui : : CheckBox * cobj = new ( std : : nothrow ) cocos2d : : ui : : CheckBox ( ) ; <nl> + cocos2d : : ui : : RadioButtonGroup * cobj = new ( std : : nothrow ) cocos2d : : ui : : RadioButtonGroup ( ) ; <nl> cocos2d : : Ref * _ccobj = dynamic_cast < cocos2d : : Ref * > ( cobj ) ; <nl> if ( _ccobj ) { <nl> _ccobj - > autorelease ( ) ; <nl> } <nl> - TypeTest < cocos2d : : ui : : CheckBox > t ; <nl> + TypeTest < cocos2d : : ui : : RadioButtonGroup > t ; <nl> js_type_class_t * typeClass = nullptr ; <nl> std : : string typeName = t . s_name ( ) ; <nl> auto typeMapIter = _js_global_type_map . find ( typeName ) ; <nl> bool js_cocos2dx_ui_CheckBox_constructor ( JSContext * cx , uint32_t argc , jsval * vp <nl> args . rval ( ) . set ( OBJECT_TO_JSVAL ( obj ) ) ; <nl> / / link the native object with the javascript object <nl> js_proxy_t * p = jsb_new_proxy ( cobj , obj ) ; <nl> - AddNamedObjectRoot ( cx , & p - > obj , " cocos2d : : ui : : CheckBox " ) ; <nl> + AddNamedObjectRoot ( cx , & p - > obj , " cocos2d : : ui : : RadioButtonGroup " ) ; <nl> if ( JS_HasProperty ( cx , obj , " _ctor " , & ok ) & & ok ) <nl> ScriptingCore : : getInstance ( ) - > executeFunctionWithOwner ( OBJECT_TO_JSVAL ( obj ) , " _ctor " , args ) ; <nl> return true ; <nl> bool js_cocos2dx_ui_CheckBox_constructor ( JSContext * cx , uint32_t argc , jsval * vp <nl> <nl> extern JSObject * jsb_cocos2d_ui_Widget_prototype ; <nl> <nl> - void js_cocos2d_ui_CheckBox_finalize ( JSFreeOp * fop , JSObject * obj ) { <nl> - CCLOGINFO ( " jsbindings : finalizing JS object % p ( CheckBox ) " , obj ) ; <nl> + void js_cocos2d_ui_RadioButtonGroup_finalize ( JSFreeOp * fop , JSObject * obj ) { <nl> + CCLOGINFO ( " jsbindings : finalizing JS object % p ( RadioButtonGroup ) " , obj ) ; <nl> } <nl> <nl> - static bool js_cocos2d_ui_CheckBox_ctor ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> - { <nl> - JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> - JS : : RootedObject obj ( cx , args . thisv ( ) . toObjectOrNull ( ) ) ; <nl> - cocos2d : : ui : : CheckBox * nobj = new ( std : : nothrow ) cocos2d : : ui : : CheckBox ( ) ; <nl> - if ( nobj ) { <nl> - nobj - > autorelease ( ) ; <nl> - } <nl> - js_proxy_t * p = jsb_new_proxy ( nobj , obj ) ; <nl> - AddNamedObjectRoot ( cx , & p - > obj , " cocos2d : : ui : : CheckBox " ) ; <nl> - bool isFound = false ; <nl> - if ( JS_HasProperty ( cx , obj , " _ctor " , & isFound ) & & isFound ) <nl> - ScriptingCore : : getInstance ( ) - > executeFunctionWithOwner ( OBJECT_TO_JSVAL ( obj ) , " _ctor " , args ) ; <nl> - args . rval ( ) . setUndefined ( ) ; <nl> - return true ; <nl> - } <nl> - void js_register_cocos2dx_ui_CheckBox ( JSContext * cx , JS : : HandleObject global ) { <nl> - jsb_cocos2d_ui_CheckBox_class = ( JSClass * ) calloc ( 1 , sizeof ( JSClass ) ) ; <nl> - jsb_cocos2d_ui_CheckBox_class - > name = " CheckBox " ; <nl> - jsb_cocos2d_ui_CheckBox_class - > addProperty = JS_PropertyStub ; <nl> - jsb_cocos2d_ui_CheckBox_class - > delProperty = JS_DeletePropertyStub ; <nl> - jsb_cocos2d_ui_CheckBox_class - > getProperty = JS_PropertyStub ; <nl> - jsb_cocos2d_ui_CheckBox_class - > setProperty = JS_StrictPropertyStub ; <nl> - jsb_cocos2d_ui_CheckBox_class - > enumerate = JS_EnumerateStub ; <nl> - jsb_cocos2d_ui_CheckBox_class - > resolve = JS_ResolveStub ; <nl> - jsb_cocos2d_ui_CheckBox_class - > convert = JS_ConvertStub ; <nl> - jsb_cocos2d_ui_CheckBox_class - > finalize = js_cocos2d_ui_CheckBox_finalize ; <nl> - jsb_cocos2d_ui_CheckBox_class - > flags = JSCLASS_HAS_RESERVED_SLOTS ( 2 ) ; <nl> + void js_register_cocos2dx_ui_RadioButtonGroup ( JSContext * cx , JS : : HandleObject global ) { <nl> + jsb_cocos2d_ui_RadioButtonGroup_class = ( JSClass * ) calloc ( 1 , sizeof ( JSClass ) ) ; <nl> + jsb_cocos2d_ui_RadioButtonGroup_class - > name = " RadioButtonGroup " ; <nl> + jsb_cocos2d_ui_RadioButtonGroup_class - > addProperty = JS_PropertyStub ; <nl> + jsb_cocos2d_ui_RadioButtonGroup_class - > delProperty = JS_DeletePropertyStub ; <nl> + jsb_cocos2d_ui_RadioButtonGroup_class - > getProperty = JS_PropertyStub ; <nl> + jsb_cocos2d_ui_RadioButtonGroup_class - > setProperty = JS_StrictPropertyStub ; <nl> + jsb_cocos2d_ui_RadioButtonGroup_class - > enumerate = JS_EnumerateStub ; <nl> + jsb_cocos2d_ui_RadioButtonGroup_class - > resolve = JS_ResolveStub ; <nl> + jsb_cocos2d_ui_RadioButtonGroup_class - > convert = JS_ConvertStub ; <nl> + jsb_cocos2d_ui_RadioButtonGroup_class - > finalize = js_cocos2d_ui_RadioButtonGroup_finalize ; <nl> + jsb_cocos2d_ui_RadioButtonGroup_class - > flags = JSCLASS_HAS_RESERVED_SLOTS ( 2 ) ; <nl> <nl> static JSPropertySpec properties [ ] = { <nl> JS_PSG ( " __nativeObj " , js_is_native_obj , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> void js_register_cocos2dx_ui_CheckBox ( JSContext * cx , JS : : HandleObject global ) { <nl> } ; <nl> <nl> static JSFunctionSpec funcs [ ] = { <nl> - JS_FN ( " loadTextureBackGroundSelected " , js_cocos2dx_ui_CheckBox_loadTextureBackGroundSelected , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> - JS_FN ( " loadTextureBackGroundDisabled " , js_cocos2dx_ui_CheckBox_loadTextureBackGroundDisabled , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> - JS_FN ( " setSelected " , js_cocos2dx_ui_CheckBox_setSelected , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> - JS_FN ( " loadTextureFrontCross " , js_cocos2dx_ui_CheckBox_loadTextureFrontCross , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> - JS_FN ( " isSelected " , js_cocos2dx_ui_CheckBox_isSelected , 0 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> - JS_FN ( " init " , js_cocos2dx_ui_CheckBox_init , 5 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> - JS_FN ( " loadTextures " , js_cocos2dx_ui_CheckBox_loadTextures , 5 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> - JS_FN ( " getZoomScale " , js_cocos2dx_ui_CheckBox_getZoomScale , 0 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> - JS_FN ( " loadTextureBackGround " , js_cocos2dx_ui_CheckBox_loadTextureBackGround , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> - JS_FN ( " setZoomScale " , js_cocos2dx_ui_CheckBox_setZoomScale , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> - JS_FN ( " loadTextureFrontCrossDisabled " , js_cocos2dx_ui_CheckBox_loadTextureFrontCrossDisabled , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> - JS_FN ( " ctor " , js_cocos2d_ui_CheckBox_ctor , 0 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_FN ( " removeRadioButton " , js_cocos2dx_ui_RadioButtonGroup_removeRadioButton , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_FN ( " isAllowedNoSelection " , js_cocos2dx_ui_RadioButtonGroup_isAllowedNoSelection , 0 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_FN ( " getSelectedButtonIndex " , js_cocos2dx_ui_RadioButtonGroup_getSelectedButtonIndex , 0 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_FN ( " setAllowedNoSelection " , js_cocos2dx_ui_RadioButtonGroup_setAllowedNoSelection , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_FN ( " getRadioButtonByIndex " , js_cocos2dx_ui_RadioButtonGroup_getRadioButtonByIndex , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_FN ( " getNumberOfRadioButtons " , js_cocos2dx_ui_RadioButtonGroup_getNumberOfRadioButtons , 0 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_FN ( " addRadioButton " , js_cocos2dx_ui_RadioButtonGroup_addRadioButton , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_FN ( " setSelectedButton " , js_cocos2dx_ui_RadioButtonGroup_setSelectedButton , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> JS_FS_END <nl> } ; <nl> <nl> static JSFunctionSpec st_funcs [ ] = { <nl> - JS_FN ( " create " , js_cocos2dx_ui_CheckBox_create , 0 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> - JS_FN ( " createInstance " , js_cocos2dx_ui_CheckBox_createInstance , 0 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_FN ( " create " , js_cocos2dx_ui_RadioButtonGroup_create , 0 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> JS_FS_END <nl> } ; <nl> <nl> - jsb_cocos2d_ui_CheckBox_prototype = JS_InitClass ( <nl> + jsb_cocos2d_ui_RadioButtonGroup_prototype = JS_InitClass ( <nl> cx , global , <nl> JS : : RootedObject ( cx , jsb_cocos2d_ui_Widget_prototype ) , <nl> - jsb_cocos2d_ui_CheckBox_class , <nl> - js_cocos2dx_ui_CheckBox_constructor , 0 , / / constructor <nl> + jsb_cocos2d_ui_RadioButtonGroup_class , <nl> + js_cocos2dx_ui_RadioButtonGroup_constructor , 0 , / / constructor <nl> properties , <nl> funcs , <nl> NULL , / / no static properties <nl> void js_register_cocos2dx_ui_CheckBox ( JSContext * cx , JS : : HandleObject global ) { <nl> / / make the class enumerable in the registered namespace <nl> / / bool found ; <nl> / / FIXME : Removed in Firefox v27 <nl> - / / JS_SetPropertyAttributes ( cx , global , " CheckBox " , JSPROP_ENUMERATE | JSPROP_READONLY , & found ) ; <nl> + / / JS_SetPropertyAttributes ( cx , global , " RadioButtonGroup " , JSPROP_ENUMERATE | JSPROP_READONLY , & found ) ; <nl> <nl> / / add the proto and JSClass to the type - > js info hash table <nl> - TypeTest < cocos2d : : ui : : CheckBox > t ; <nl> + TypeTest < cocos2d : : ui : : RadioButtonGroup > t ; <nl> js_type_class_t * p ; <nl> std : : string typeName = t . s_name ( ) ; <nl> if ( _js_global_type_map . find ( typeName ) = = _js_global_type_map . end ( ) ) <nl> { <nl> p = ( js_type_class_t * ) malloc ( sizeof ( js_type_class_t ) ) ; <nl> - p - > jsclass = jsb_cocos2d_ui_CheckBox_class ; <nl> - p - > proto = jsb_cocos2d_ui_CheckBox_prototype ; <nl> + p - > jsclass = jsb_cocos2d_ui_RadioButtonGroup_class ; <nl> + p - > proto = jsb_cocos2d_ui_RadioButtonGroup_prototype ; <nl> p - > parentProto = jsb_cocos2d_ui_Widget_prototype ; <nl> _js_global_type_map . insert ( std : : make_pair ( typeName , p ) ) ; <nl> } <nl> void js_register_cocos2dx_ui_ListView ( JSContext * cx , JS : : HandleObject global ) { <nl> JSClass * jsb_cocos2d_ui_Slider_class ; <nl> JSObject * jsb_cocos2d_ui_Slider_prototype ; <nl> <nl> + bool js_cocos2dx_ui_Slider_setMaxPercent ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + { <nl> + JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> + bool ok = true ; <nl> + JS : : RootedObject obj ( cx , args . thisv ( ) . toObjectOrNull ( ) ) ; <nl> + js_proxy_t * proxy = jsb_get_js_proxy ( obj ) ; <nl> + cocos2d : : ui : : Slider * cobj = ( cocos2d : : ui : : Slider * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_Slider_setMaxPercent : Invalid Native Object " ) ; <nl> + if ( argc = = 1 ) { <nl> + int arg0 ; <nl> + ok & = jsval_to_int32 ( cx , args . get ( 0 ) , ( int32_t * ) & arg0 ) ; <nl> + JSB_PRECONDITION2 ( ok , cx , false , " js_cocos2dx_ui_Slider_setMaxPercent : Error processing arguments " ) ; <nl> + cobj - > setMaxPercent ( arg0 ) ; <nl> + args . rval ( ) . setUndefined ( ) ; <nl> + return true ; <nl> + } <nl> + <nl> + JS_ReportError ( cx , " js_cocos2dx_ui_Slider_setMaxPercent : wrong number of arguments : % d , was expecting % d " , argc , 1 ) ; <nl> + return false ; <nl> + } <nl> bool js_cocos2dx_ui_Slider_setPercent ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> { <nl> JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> bool js_cocos2dx_ui_Slider_loadSlidBallTextureDisabled ( JSContext * cx , uint32_t a <nl> JS_ReportError ( cx , " js_cocos2dx_ui_Slider_loadSlidBallTextureDisabled : wrong number of arguments : % d , was expecting % d " , argc , 1 ) ; <nl> return false ; <nl> } <nl> + bool js_cocos2dx_ui_Slider_getMaxPercent ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> + { <nl> + JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> + JS : : RootedObject obj ( cx , args . thisv ( ) . toObjectOrNull ( ) ) ; <nl> + js_proxy_t * proxy = jsb_get_js_proxy ( obj ) ; <nl> + cocos2d : : ui : : Slider * cobj = ( cocos2d : : ui : : Slider * ) ( proxy ? proxy - > ptr : NULL ) ; <nl> + JSB_PRECONDITION2 ( cobj , cx , false , " js_cocos2dx_ui_Slider_getMaxPercent : Invalid Native Object " ) ; <nl> + if ( argc = = 0 ) { <nl> + int ret = cobj - > getMaxPercent ( ) ; <nl> + jsval jsret = JSVAL_NULL ; <nl> + jsret = int32_to_jsval ( cx , ret ) ; <nl> + args . rval ( ) . set ( jsret ) ; <nl> + return true ; <nl> + } <nl> + <nl> + JS_ReportError ( cx , " js_cocos2dx_ui_Slider_getMaxPercent : wrong number of arguments : % d , was expecting % d " , argc , 0 ) ; <nl> + return false ; <nl> + } <nl> bool js_cocos2dx_ui_Slider_loadSlidBallTextureNormal ( JSContext * cx , uint32_t argc , jsval * vp ) <nl> { <nl> JS : : CallArgs args = JS : : CallArgsFromVp ( argc , vp ) ; <nl> void js_register_cocos2dx_ui_Slider ( JSContext * cx , JS : : HandleObject global ) { <nl> } ; <nl> <nl> static JSFunctionSpec funcs [ ] = { <nl> + JS_FN ( " setMaxPercent " , js_cocos2dx_ui_Slider_setMaxPercent , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> JS_FN ( " setPercent " , js_cocos2dx_ui_Slider_setPercent , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> JS_FN ( " loadSlidBallTextureDisabled " , js_cocos2dx_ui_Slider_loadSlidBallTextureDisabled , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> + JS_FN ( " getMaxPercent " , js_cocos2dx_ui_Slider_getMaxPercent , 0 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> JS_FN ( " loadSlidBallTextureNormal " , js_cocos2dx_ui_Slider_loadSlidBallTextureNormal , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> JS_FN ( " loadBarTexture " , js_cocos2dx_ui_Slider_loadBarTexture , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> JS_FN ( " loadProgressBarTexture " , js_cocos2dx_ui_Slider_loadProgressBarTexture , 1 , JSPROP_PERMANENT | JSPROP_ENUMERATE ) , <nl> void register_all_cocos2dx_ui ( JSContext * cx , JS : : HandleObject obj ) { <nl> js_register_cocos2dx_ui_Widget ( cx , ns ) ; <nl> js_register_cocos2dx_ui_Layout ( cx , ns ) ; <nl> js_register_cocos2dx_ui_RelativeBox ( cx , ns ) ; <nl> + js_register_cocos2dx_ui_AbstractCheckButton ( cx , ns ) ; <nl> js_register_cocos2dx_ui_CheckBox ( cx , ns ) ; <nl> js_register_cocos2dx_ui_TextAtlas ( cx , ns ) ; <nl> js_register_cocos2dx_ui_TextBMFont ( cx , ns ) ; <nl> void register_all_cocos2dx_ui ( JSContext * cx , JS : : HandleObject obj ) { <nl> js_register_cocos2dx_ui_TextField ( cx , ns ) ; <nl> js_register_cocos2dx_ui_RichText ( cx , ns ) ; <nl> js_register_cocos2dx_ui_Scale9Sprite ( cx , ns ) ; <nl> - js_register_cocos2dx_ui_VBox ( cx , ns ) ; <nl> js_register_cocos2dx_ui_RichElement ( cx , ns ) ; <nl> js_register_cocos2dx_ui_RichElementCustomNode ( cx , ns ) ; <nl> + js_register_cocos2dx_ui_VBox ( cx , ns ) ; <nl> js_register_cocos2dx_ui_Slider ( cx , ns ) ; <nl> + js_register_cocos2dx_ui_RadioButtonGroup ( cx , ns ) ; <nl> js_register_cocos2dx_ui_ScrollView ( cx , ns ) ; <nl> js_register_cocos2dx_ui_ListView ( cx , ns ) ; <nl> js_register_cocos2dx_ui_LayoutComponent ( cx , ns ) ; <nl> js_register_cocos2dx_ui_Button ( cx , ns ) ; <nl> js_register_cocos2dx_ui_LayoutParameter ( cx , ns ) ; <nl> js_register_cocos2dx_ui_LinearLayoutParameter ( cx , ns ) ; <nl> + js_register_cocos2dx_ui_RadioButton ( cx , ns ) ; <nl> js_register_cocos2dx_ui_ImageView ( cx , ns ) ; <nl> js_register_cocos2dx_ui_HBox ( cx , ns ) ; <nl> js_register_cocos2dx_ui_RichElementText ( cx , ns ) ; <nl> mmm a / cocos / scripting / js - bindings / auto / jsb_cocos2dx_ui_auto . hpp <nl> ppp b / cocos / scripting / js - bindings / auto / jsb_cocos2dx_ui_auto . hpp <nl> bool js_cocos2dx_ui_Button_create ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> bool js_cocos2dx_ui_Button_createInstance ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> bool js_cocos2dx_ui_Button_Button ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> <nl> + extern JSClass * jsb_cocos2d_ui_AbstractCheckButton_class ; <nl> + extern JSObject * jsb_cocos2d_ui_AbstractCheckButton_prototype ; <nl> + <nl> + bool js_cocos2dx_ui_AbstractCheckButton_constructor ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + void js_cocos2dx_ui_AbstractCheckButton_finalize ( JSContext * cx , JSObject * obj ) ; <nl> + void js_register_cocos2dx_ui_AbstractCheckButton ( JSContext * cx , JS : : HandleObject global ) ; <nl> + void register_all_cocos2dx_ui ( JSContext * cx , JS : : HandleObject obj ) ; <nl> + bool js_cocos2dx_ui_AbstractCheckButton_loadTextureBackGroundSelected ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + bool js_cocos2dx_ui_AbstractCheckButton_loadTextureBackGroundDisabled ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + bool js_cocos2dx_ui_AbstractCheckButton_setSelected ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + bool js_cocos2dx_ui_AbstractCheckButton_loadTextureFrontCross ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + bool js_cocos2dx_ui_AbstractCheckButton_isSelected ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + bool js_cocos2dx_ui_AbstractCheckButton_init ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + bool js_cocos2dx_ui_AbstractCheckButton_loadTextures ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + bool js_cocos2dx_ui_AbstractCheckButton_getZoomScale ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + bool js_cocos2dx_ui_AbstractCheckButton_loadTextureBackGround ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + bool js_cocos2dx_ui_AbstractCheckButton_setZoomScale ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + bool js_cocos2dx_ui_AbstractCheckButton_loadTextureFrontCrossDisabled ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + <nl> extern JSClass * jsb_cocos2d_ui_CheckBox_class ; <nl> extern JSObject * jsb_cocos2d_ui_CheckBox_prototype ; <nl> <nl> bool js_cocos2dx_ui_CheckBox_constructor ( JSContext * cx , uint32_t argc , jsval * vp <nl> void js_cocos2dx_ui_CheckBox_finalize ( JSContext * cx , JSObject * obj ) ; <nl> void js_register_cocos2dx_ui_CheckBox ( JSContext * cx , JS : : HandleObject global ) ; <nl> void register_all_cocos2dx_ui ( JSContext * cx , JS : : HandleObject obj ) ; <nl> - bool js_cocos2dx_ui_CheckBox_loadTextureBackGroundSelected ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> - bool js_cocos2dx_ui_CheckBox_loadTextureBackGroundDisabled ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> - bool js_cocos2dx_ui_CheckBox_setSelected ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> - bool js_cocos2dx_ui_CheckBox_loadTextureFrontCross ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> - bool js_cocos2dx_ui_CheckBox_isSelected ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> - bool js_cocos2dx_ui_CheckBox_init ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> - bool js_cocos2dx_ui_CheckBox_loadTextures ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> - bool js_cocos2dx_ui_CheckBox_getZoomScale ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> - bool js_cocos2dx_ui_CheckBox_loadTextureBackGround ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> - bool js_cocos2dx_ui_CheckBox_setZoomScale ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> - bool js_cocos2dx_ui_CheckBox_loadTextureFrontCrossDisabled ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> bool js_cocos2dx_ui_CheckBox_create ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> bool js_cocos2dx_ui_CheckBox_createInstance ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> bool js_cocos2dx_ui_CheckBox_CheckBox ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> <nl> + extern JSClass * jsb_cocos2d_ui_RadioButton_class ; <nl> + extern JSObject * jsb_cocos2d_ui_RadioButton_prototype ; <nl> + <nl> + bool js_cocos2dx_ui_RadioButton_constructor ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + void js_cocos2dx_ui_RadioButton_finalize ( JSContext * cx , JSObject * obj ) ; <nl> + void js_register_cocos2dx_ui_RadioButton ( JSContext * cx , JS : : HandleObject global ) ; <nl> + void register_all_cocos2dx_ui ( JSContext * cx , JS : : HandleObject obj ) ; <nl> + bool js_cocos2dx_ui_RadioButton_create ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + bool js_cocos2dx_ui_RadioButton_createInstance ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + bool js_cocos2dx_ui_RadioButton_RadioButton ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + <nl> + extern JSClass * jsb_cocos2d_ui_RadioButtonGroup_class ; <nl> + extern JSObject * jsb_cocos2d_ui_RadioButtonGroup_prototype ; <nl> + <nl> + bool js_cocos2dx_ui_RadioButtonGroup_constructor ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + void js_cocos2dx_ui_RadioButtonGroup_finalize ( JSContext * cx , JSObject * obj ) ; <nl> + void js_register_cocos2dx_ui_RadioButtonGroup ( JSContext * cx , JS : : HandleObject global ) ; <nl> + void register_all_cocos2dx_ui ( JSContext * cx , JS : : HandleObject obj ) ; <nl> + bool js_cocos2dx_ui_RadioButtonGroup_removeRadioButton ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + bool js_cocos2dx_ui_RadioButtonGroup_isAllowedNoSelection ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + bool js_cocos2dx_ui_RadioButtonGroup_getSelectedButtonIndex ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + bool js_cocos2dx_ui_RadioButtonGroup_setAllowedNoSelection ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + bool js_cocos2dx_ui_RadioButtonGroup_getRadioButtonByIndex ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + bool js_cocos2dx_ui_RadioButtonGroup_getNumberOfRadioButtons ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + bool js_cocos2dx_ui_RadioButtonGroup_addRadioButton ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + bool js_cocos2dx_ui_RadioButtonGroup_setSelectedButton ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + bool js_cocos2dx_ui_RadioButtonGroup_create ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + bool js_cocos2dx_ui_RadioButtonGroup_RadioButtonGroup ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + <nl> extern JSClass * jsb_cocos2d_ui_ImageView_class ; <nl> extern JSObject * jsb_cocos2d_ui_ImageView_prototype ; <nl> <nl> bool js_cocos2dx_ui_Slider_constructor ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> void js_cocos2dx_ui_Slider_finalize ( JSContext * cx , JSObject * obj ) ; <nl> void js_register_cocos2dx_ui_Slider ( JSContext * cx , JS : : HandleObject global ) ; <nl> void register_all_cocos2dx_ui ( JSContext * cx , JS : : HandleObject obj ) ; <nl> + bool js_cocos2dx_ui_Slider_setMaxPercent ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> bool js_cocos2dx_ui_Slider_setPercent ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> bool js_cocos2dx_ui_Slider_loadSlidBallTextureDisabled ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> + bool js_cocos2dx_ui_Slider_getMaxPercent ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> bool js_cocos2dx_ui_Slider_loadSlidBallTextureNormal ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> bool js_cocos2dx_ui_Slider_loadBarTexture ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> bool js_cocos2dx_ui_Slider_loadProgressBarTexture ( JSContext * cx , uint32_t argc , jsval * vp ) ; <nl> mmm a / cocos / scripting / lua - bindings / auto / api / CheckBox . lua <nl> ppp b / cocos / scripting / lua - bindings / auto / api / CheckBox . lua <nl> <nl> <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - - @ module CheckBox <nl> mmm @ extend Widget <nl> + - - @ extend AbstractCheckButton <nl> - - @ parent_module ccui <nl> <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> mmm Load background selected state texture for checkbox . < br > <nl> mmm param backGroundSelected The background selected state image name . < br > <nl> mmm param texType @ see ` Widget : : TextureResType ` <nl> mmm @ function [ parent = # CheckBox ] loadTextureBackGroundSelected <nl> mmm @ param self <nl> mmm @ param # string backGroundSelected <nl> mmm @ param # int texType <nl> mmm @ return CheckBox # CheckBox self ( return value : ccui . CheckBox ) <nl> - <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> mmm Load background disabled state texture for checkbox . < br > <nl> mmm param backGroundDisabled The background disabled state texture name . < br > <nl> mmm param texType @ see ` Widget : : TextureResType ` <nl> mmm @ function [ parent = # CheckBox ] loadTextureBackGroundDisabled <nl> mmm @ param self <nl> mmm @ param # string backGroundDisabled <nl> mmm @ param # int texType <nl> mmm @ return CheckBox # CheckBox self ( return value : ccui . CheckBox ) <nl> - <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> mmm Change CheckBox state . < br > <nl> mmm Set to true will cause the CheckBox ' s state to " selected " , false otherwise . < br > <nl> mmm param selected Set to true will change CheckBox to selected state , false otherwise . <nl> mmm @ function [ parent = # CheckBox ] setSelected <nl> mmm @ param self <nl> mmm @ param # bool selected <nl> mmm @ return CheckBox # CheckBox self ( return value : ccui . CheckBox ) <nl> - <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - - Add a callback function which would be called when checkbox is selected or unselected . < br > <nl> - - param callback A std : : function with type @ see ` ccCheckBoxCallback ` <nl> <nl> - - @ param # function callback <nl> - - @ return CheckBox # CheckBox self ( return value : ccui . CheckBox ) <nl> <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> mmm Load cross texture for checkbox . < br > <nl> mmm param crossTextureName The cross texture name . < br > <nl> mmm param texType @ see ` Widget : : TextureResType ` <nl> mmm @ function [ parent = # CheckBox ] loadTextureFrontCross <nl> mmm @ param self <nl> mmm @ param # string crossTextureName <nl> mmm @ param # int texType <nl> mmm @ return CheckBox # CheckBox self ( return value : ccui . CheckBox ) <nl> - <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> mmm Query whether CheckBox is selected or not . < br > <nl> mmm return true means " selected " , false otherwise . <nl> mmm @ function [ parent = # CheckBox ] isSelected <nl> mmm @ param self <nl> mmm @ return bool # bool ret ( return value : bool ) <nl> - <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> mmm <nl> mmm @ function [ parent = # CheckBox ] init <nl> mmm @ param self <nl> mmm @ param # string backGround <nl> mmm @ param # string backGroundSeleted <nl> mmm @ param # string cross <nl> mmm @ param # string backGroundDisabled <nl> mmm @ param # string frontCrossDisabled <nl> mmm @ param # int texType <nl> mmm @ return bool # bool ret ( return value : bool ) <nl> - <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> mmm Load all textures for initializing a checkbox . < br > <nl> mmm param background The background image name . < br > <nl> mmm param backgroundSelected The background selected image name . < br > <nl> mmm param cross The cross image name . < br > <nl> mmm param backgroundDisabled The background disabled state texture . < br > <nl> mmm param frontCrossDisabled The front cross disabled state image name . < br > <nl> mmm param texType @ see ` Widget : : TextureResType ` <nl> mmm @ function [ parent = # CheckBox ] loadTextures <nl> mmm @ param self <nl> mmm @ param # string background <nl> mmm @ param # string backgroundSelected <nl> mmm @ param # string cross <nl> mmm @ param # string backgroundDisabled <nl> mmm @ param # string frontCrossDisabled <nl> mmm @ param # int texType <nl> mmm @ return CheckBox # CheckBox self ( return value : ccui . CheckBox ) <nl> - <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> mmm brief Return a zoom scale < br > <nl> mmm return A zoom scale of Checkbox . < br > <nl> mmm since v3 . 3 <nl> mmm @ function [ parent = # CheckBox ] getZoomScale <nl> mmm @ param self <nl> mmm @ return float # float ret ( return value : float ) <nl> - <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> mmm Load background texture for checkbox . < br > <nl> mmm param backGround The background image name . < br > <nl> mmm param type @ see ` Widget : : TextureResType ` <nl> mmm @ function [ parent = # CheckBox ] loadTextureBackGround <nl> mmm @ param self <nl> mmm @ param # string backGround <nl> mmm @ param # int type <nl> mmm @ return CheckBox # CheckBox self ( return value : ccui . CheckBox ) <nl> - <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> mmm When user pressed the CheckBox , the button will zoom to a scale . < br > <nl> mmm The final scale of the CheckBox equals ( CheckBox original scale + _zoomScale ) < br > <nl> mmm since v3 . 3 <nl> mmm @ function [ parent = # CheckBox ] setZoomScale <nl> mmm @ param self <nl> mmm @ param # float scale <nl> mmm @ return CheckBox # CheckBox self ( return value : ccui . CheckBox ) <nl> - <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> mmm Load frontcross disabled texture for checkbox . < br > <nl> mmm param frontCrossDisabled The front cross disabled state texture name . < br > <nl> mmm param texType @ see ` Widget : : TextureResType ` <nl> mmm @ function [ parent = # CheckBox ] loadTextureFrontCrossDisabled <nl> mmm @ param self <nl> mmm @ param # string frontCrossDisabled <nl> mmm @ param # int texType <nl> mmm @ return CheckBox # CheckBox self ( return value : ccui . CheckBox ) <nl> - <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - - @ overload self , string , string , string , string , string , int <nl> - - @ overload self <nl> <nl> - - @ param self <nl> - - @ return Ref # Ref ret ( return value : cc . Ref ) <nl> <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> mmm <nl> mmm @ function [ parent = # CheckBox ] getVirtualRenderer <nl> mmm @ param self <nl> mmm @ return Node # Node ret ( return value : cc . Node ) <nl> - <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> mmm <nl> mmm @ function [ parent = # CheckBox ] init <nl> mmm @ param self <nl> mmm @ return bool # bool ret ( return value : bool ) <nl> - <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - - <nl> - - @ function [ parent = # CheckBox ] getDescription <nl> - - @ param self <nl> - - @ return string # string ret ( return value : string ) <nl> <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> mmm <nl> mmm @ function [ parent = # CheckBox ] getVirtualRendererSize <nl> mmm @ param self <nl> mmm @ return size_table # size_table ret ( return value : size_table ) <nl> - <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - - Default constructor . < br > <nl> - - lua new <nl> mmm a / cocos / scripting / lua - bindings / auto / api / Device . lua <nl> ppp b / cocos / scripting / lua - bindings / auto / api / Device . lua <nl> <nl> - - @ param # bool isEnabled <nl> - - @ return Device # Device self ( return value : cc . Device ) <nl> <nl> + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + - - Sets the interval of accelerometer . <nl> + - - @ function [ parent = # Device ] setAccelerometerInterval <nl> + - - @ param self <nl> + - - @ param # float interval <nl> + - - @ return Device # Device self ( return value : cc . Device ) <nl> + <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - - Controls whether the screen should remain on . < br > <nl> - - param keepScreenOn One flag indicating that the screen should remain on . <nl> <nl> - - @ return Device # Device self ( return value : cc . Device ) <nl> <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> mmm Sets the interval of accelerometer . <nl> mmm @ function [ parent = # Device ] setAccelerometerInterval <nl> + - - Vibrate for the specified amount of time . < br > <nl> + - - If vibrate is not supported , then invoking this method has no effect . < br > <nl> + - - Some platforms limit to a maximum duration of 5 seconds . < br > <nl> + - - Duration is ignored on iOS due to API limitations . < br > <nl> + - - param duration The duration in seconds . <nl> + - - @ function [ parent = # Device ] vibrate <nl> - - @ param self <nl> mmm @ param # float interval <nl> + - - @ param # float duration <nl> - - @ return Device # Device self ( return value : cc . Device ) <nl> <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> mmm a / cocos / scripting / lua - bindings / auto / api / Layout . lua <nl> ppp b / cocos / scripting / lua - bindings / auto / api / Layout . lua <nl> <nl> - - @ param self <nl> - - @ return bool # bool ret ( return value : bool ) <nl> <nl> + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + - - Override function . Set camera mask , the node is visible by the camera whose camera flag & node ' s camera mask is true . < br > <nl> + - - param mask Mask being set < br > <nl> + - - param applyChildren If true call this function recursively from this node to its children . <nl> + - - @ function [ parent = # Layout ] setCameraMask <nl> + - - @ param self <nl> + - - @ param # unsigned short mask <nl> + - - @ param # bool applyChildren <nl> + - - @ return Layout # Layout self ( return value : ccui . Layout ) <nl> + <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - - Default constructor < br > <nl> - - js ctor < br > <nl> mmm a / cocos / scripting / lua - bindings / auto / api / Slider . lua <nl> ppp b / cocos / scripting / lua - bindings / auto / api / Slider . lua <nl> <nl> - - @ extend Widget <nl> - - @ parent_module ccui <nl> <nl> + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + - - Set a large value could give more control to the precision . < br > <nl> + - - since v3 . 7 < br > <nl> + - - param percent The max percent of Slider . <nl> + - - @ function [ parent = # Slider ] setMaxPercent <nl> + - - @ param self <nl> + - - @ param # int percent <nl> + - - @ return Slider # Slider self ( return value : ccui . Slider ) <nl> + <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - - Changes the progress direction of slider . < br > <nl> - - param percent Percent value from 1 to 100 . <nl> <nl> - - @ param # int resType <nl> - - @ return Slider # Slider self ( return value : ccui . Slider ) <nl> <nl> + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + - - Query the maximum percent of Slider . The default value is 100 . < br > <nl> + - - since v3 . 7 < br > <nl> + - - return The maximum percent of the Slider . <nl> + - - @ function [ parent = # Slider ] getMaxPercent <nl> + - - @ param self <nl> + - - @ return int # int ret ( return value : int ) <nl> + <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - - Load normal state texture for slider ball . < br > <nl> - - param normal Normal state texture . < br > <nl> <nl> - - @ function [ parent = # Slider ] hitTest <nl> - - @ param self <nl> - - @ param # vec2_table pt <nl> + - - @ param # cc . Camera camera <nl> + - - @ param # vec3_table p <nl> - - @ return bool # bool ret ( return value : bool ) <nl> <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> mmm a / cocos / scripting / lua - bindings / auto / api / TextField . lua <nl> ppp b / cocos / scripting / lua - bindings / auto / api / TextField . lua <nl> <nl> - - @ function [ parent = # TextField ] hitTest <nl> - - @ param self <nl> - - @ param # vec2_table pt <nl> + - - @ param # cc . Camera camera <nl> + - - @ param # vec3_table p <nl> - - @ return bool # bool ret ( return value : bool ) <nl> <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> mmm a / cocos / scripting / lua - bindings / auto / api / Widget . lua <nl> ppp b / cocos / scripting / lua - bindings / auto / api / Widget . lua <nl> <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - - Checks a point is in widget ' s content space . < br > <nl> - - This function is used for determining touch area of widget . < br > <nl> mmm param pt The point in ` Vec2 ` . < br > <nl> + - - param pt The point in ` Vec2 ` . < br > <nl> + - - param camera The camera look at widget , used to convert GL screen point to near / far plane . < br > <nl> + - - param p Point to a Vec3 for store the intersect point , if don ' t need them set to nullptr . < br > <nl> - - return true if the point is in widget ' s content space , flase otherwise . <nl> - - @ function [ parent = # Widget ] hitTest <nl> - - @ param self <nl> - - @ param # vec2_table pt <nl> + - - @ param # cc . Camera camera <nl> + - - @ param # vec3_table p <nl> - - @ return bool # bool ret ( return value : bool ) <nl> <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> mmm a / cocos / scripting / lua - bindings / auto / lua_cocos2dx_auto . cpp <nl> ppp b / cocos / scripting / lua - bindings / auto / lua_cocos2dx_auto . cpp <nl> int lua_cocos2dx_Device_setAccelerometerEnabled ( lua_State * tolua_S ) <nl> # endif <nl> return 0 ; <nl> } <nl> - <nl> - int lua_cocos2dx_Device_setKeepScreenOn ( lua_State * tolua_S ) <nl> + int lua_cocos2dx_Device_setAccelerometerInterval ( lua_State * tolua_S ) <nl> { <nl> int argc = 0 ; <nl> bool ok = true ; <nl> int lua_cocos2dx_Device_setKeepScreenOn ( lua_State * tolua_S ) <nl> <nl> if ( argc = = 1 ) <nl> { <nl> - bool arg0 ; <nl> - ok & = luaval_to_boolean ( tolua_S , 2 , & arg0 , " cc . Device : setKeepScreenOn " ) ; <nl> + double arg0 ; <nl> + ok & = luaval_to_number ( tolua_S , 2 , & arg0 , " cc . Device : setAccelerometerInterval " ) ; <nl> if ( ! ok ) <nl> { <nl> - tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_Device_setKeepScreenOn ' " , nullptr ) ; <nl> + tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_Device_setAccelerometerInterval ' " , nullptr ) ; <nl> return 0 ; <nl> } <nl> - cocos2d : : Device : : setKeepScreenOn ( arg0 ) ; <nl> + cocos2d : : Device : : setAccelerometerInterval ( arg0 ) ; <nl> lua_settop ( tolua_S , 1 ) ; <nl> return 1 ; <nl> } <nl> - luaL_error ( tolua_S , " % s has wrong number of arguments : % d , was expecting % d \ n " , " cc . Device : setKeepScreenOn " , argc , 1 ) ; <nl> + luaL_error ( tolua_S , " % s has wrong number of arguments : % d , was expecting % d \ n " , " cc . Device : setAccelerometerInterval " , argc , 1 ) ; <nl> return 0 ; <nl> # if COCOS2D_DEBUG > = 1 <nl> tolua_lerror : <nl> - tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_Device_setKeepScreenOn ' . " , & tolua_err ) ; <nl> + tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_Device_setAccelerometerInterval ' . " , & tolua_err ) ; <nl> # endif <nl> return 0 ; <nl> } <nl> - <nl> - int lua_cocos2dx_Device_vibrate ( lua_State * tolua_S ) <nl> + int lua_cocos2dx_Device_setKeepScreenOn ( lua_State * tolua_S ) <nl> { <nl> int argc = 0 ; <nl> bool ok = true ; <nl> int lua_cocos2dx_Device_vibrate ( lua_State * tolua_S ) <nl> <nl> if ( argc = = 1 ) <nl> { <nl> - double arg0 ; <nl> - ok & = luaval_to_number ( tolua_S , 2 , & arg0 , " cc . Device : vibrate " ) ; <nl> + bool arg0 ; <nl> + ok & = luaval_to_boolean ( tolua_S , 2 , & arg0 , " cc . Device : setKeepScreenOn " ) ; <nl> if ( ! ok ) <nl> { <nl> - tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_Device_vibrate ' " , nullptr ) ; <nl> + tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_Device_setKeepScreenOn ' " , nullptr ) ; <nl> return 0 ; <nl> } <nl> - cocos2d : : Device : : vibrate ( arg0 ) ; <nl> + cocos2d : : Device : : setKeepScreenOn ( arg0 ) ; <nl> lua_settop ( tolua_S , 1 ) ; <nl> return 1 ; <nl> } <nl> - luaL_error ( tolua_S , " % s has wrong number of arguments : % d , was expecting % d \ n " , " cc . Device : vibrate " , argc , 1 ) ; <nl> + luaL_error ( tolua_S , " % s has wrong number of arguments : % d , was expecting % d \ n " , " cc . Device : setKeepScreenOn " , argc , 1 ) ; <nl> return 0 ; <nl> # if COCOS2D_DEBUG > = 1 <nl> tolua_lerror : <nl> - tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_Device_vibrate ' . " , & tolua_err ) ; <nl> + tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_Device_setKeepScreenOn ' . " , & tolua_err ) ; <nl> # endif <nl> return 0 ; <nl> } <nl> - <nl> - int lua_cocos2dx_Device_setAccelerometerInterval ( lua_State * tolua_S ) <nl> + int lua_cocos2dx_Device_vibrate ( lua_State * tolua_S ) <nl> { <nl> int argc = 0 ; <nl> bool ok = true ; <nl> int lua_cocos2dx_Device_setAccelerometerInterval ( lua_State * tolua_S ) <nl> if ( argc = = 1 ) <nl> { <nl> double arg0 ; <nl> - ok & = luaval_to_number ( tolua_S , 2 , & arg0 , " cc . Device : setAccelerometerInterval " ) ; <nl> + ok & = luaval_to_number ( tolua_S , 2 , & arg0 , " cc . Device : vibrate " ) ; <nl> if ( ! ok ) <nl> { <nl> - tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_Device_setAccelerometerInterval ' " , nullptr ) ; <nl> + tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_Device_vibrate ' " , nullptr ) ; <nl> return 0 ; <nl> } <nl> - cocos2d : : Device : : setAccelerometerInterval ( arg0 ) ; <nl> + cocos2d : : Device : : vibrate ( arg0 ) ; <nl> lua_settop ( tolua_S , 1 ) ; <nl> return 1 ; <nl> } <nl> - luaL_error ( tolua_S , " % s has wrong number of arguments : % d , was expecting % d \ n " , " cc . Device : setAccelerometerInterval " , argc , 1 ) ; <nl> + luaL_error ( tolua_S , " % s has wrong number of arguments : % d , was expecting % d \ n " , " cc . Device : vibrate " , argc , 1 ) ; <nl> return 0 ; <nl> # if COCOS2D_DEBUG > = 1 <nl> tolua_lerror : <nl> - tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_Device_setAccelerometerInterval ' . " , & tolua_err ) ; <nl> + tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_Device_vibrate ' . " , & tolua_err ) ; <nl> # endif <nl> return 0 ; <nl> } <nl> - <nl> int lua_cocos2dx_Device_getDPI ( lua_State * tolua_S ) <nl> { <nl> int argc = 0 ; <nl> int lua_cocos2dx_Device_getDPI ( lua_State * tolua_S ) <nl> # endif <nl> return 0 ; <nl> } <nl> - <nl> static int lua_cocos2dx_Device_finalize ( lua_State * tolua_S ) <nl> { <nl> printf ( " luabindings : finalizing LUA object ( Device ) " ) ; <nl> int lua_register_cocos2dx_Device ( lua_State * tolua_S ) <nl> <nl> tolua_beginmodule ( tolua_S , " Device " ) ; <nl> tolua_function ( tolua_S , " setAccelerometerEnabled " , lua_cocos2dx_Device_setAccelerometerEnabled ) ; <nl> + tolua_function ( tolua_S , " setAccelerometerInterval " , lua_cocos2dx_Device_setAccelerometerInterval ) ; <nl> tolua_function ( tolua_S , " setKeepScreenOn " , lua_cocos2dx_Device_setKeepScreenOn ) ; <nl> tolua_function ( tolua_S , " vibrate " , lua_cocos2dx_Device_vibrate ) ; <nl> - tolua_function ( tolua_S , " setAccelerometerInterval " , lua_cocos2dx_Device_setAccelerometerInterval ) ; <nl> tolua_function ( tolua_S , " getDPI " , lua_cocos2dx_Device_getDPI ) ; <nl> tolua_endmodule ( tolua_S ) ; <nl> std : : string typeName = typeid ( cocos2d : : Device ) . name ( ) ; <nl> mmm a / cocos / scripting / lua - bindings / auto / lua_cocos2dx_auto . hpp <nl> ppp b / cocos / scripting / lua - bindings / auto / lua_cocos2dx_auto . hpp <nl> int register_all_cocos2dx ( lua_State * tolua_S ) ; <nl> <nl> <nl> <nl> + <nl> <nl> <nl> # endif / / __cocos2dx_h__ <nl> mmm a / cocos / scripting / lua - bindings / auto / lua_cocos2dx_ui_auto . cpp <nl> ppp b / cocos / scripting / lua - bindings / auto / lua_cocos2dx_ui_auto . cpp <nl> int lua_cocos2dx_ui_Widget_hitTest ( lua_State * tolua_S ) <nl> # endif <nl> <nl> argc = lua_gettop ( tolua_S ) - 1 ; <nl> - if ( argc = = 1 ) <nl> + if ( argc = = 3 ) <nl> { <nl> cocos2d : : Vec2 arg0 ; <nl> + const cocos2d : : Camera * arg1 ; <nl> + cocos2d : : Vec3 * arg2 ; <nl> <nl> ok & = luaval_to_vec2 ( tolua_S , 2 , & arg0 , " ccui . Widget : hitTest " ) ; <nl> + <nl> + ok & = luaval_to_object < const cocos2d : : Camera > ( tolua_S , 3 , " cc . Camera " , & arg1 , " ccui . Widget : hitTest " ) ; <nl> + <nl> + ok & = luaval_to_object < cocos2d : : Vec3 > ( tolua_S , 4 , " cc . Vec3 " , & arg2 , " ccui . Widget : hitTest " ) ; <nl> if ( ! ok ) <nl> { <nl> tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_ui_Widget_hitTest ' " , nullptr ) ; <nl> return 0 ; <nl> } <nl> - bool ret = cobj - > hitTest ( arg0 ) ; <nl> + bool ret = cobj - > hitTest ( arg0 , arg1 , arg2 ) ; <nl> tolua_pushboolean ( tolua_S , ( bool ) ret ) ; <nl> return 1 ; <nl> } <nl> - luaL_error ( tolua_S , " % s has wrong number of arguments : % d , was expecting % d \ n " , " ccui . Widget : hitTest " , argc , 1 ) ; <nl> + luaL_error ( tolua_S , " % s has wrong number of arguments : % d , was expecting % d \ n " , " ccui . Widget : hitTest " , argc , 3 ) ; <nl> return 0 ; <nl> <nl> # if COCOS2D_DEBUG > = 1 <nl> int lua_cocos2dx_ui_Button_create ( lua_State * tolua_S ) <nl> cocos2d : : ui : : Widget : : TextureResType arg3 ; <nl> ok & = luaval_to_int32 ( tolua_S , 5 , ( int * ) & arg3 , " ccui . Button : create " ) ; <nl> if ( ! ok ) { break ; } <nl> - cocos2d : : ui : : Button * ret = cocos2d : : ui : : Button : : create ( arg0 , arg1 , arg2 , arg3 ) ; <nl> - object_to_luaval < cocos2d : : ui : : Button > ( tolua_S , " ccui . Button " , ( cocos2d : : ui : : Button * ) ret ) ; <nl> - return 1 ; <nl> - } <nl> - } while ( 0 ) ; <nl> - ok = true ; <nl> - do <nl> - { <nl> - if ( argc = = 0 ) <nl> - { <nl> - cocos2d : : ui : : Button * ret = cocos2d : : ui : : Button : : create ( ) ; <nl> - object_to_luaval < cocos2d : : ui : : Button > ( tolua_S , " ccui . Button " , ( cocos2d : : ui : : Button * ) ret ) ; <nl> - return 1 ; <nl> - } <nl> - } while ( 0 ) ; <nl> - ok = true ; <nl> - luaL_error ( tolua_S , " % s has wrong number of arguments : % d , was expecting % d " , " ccui . Button : create " , argc , 0 ) ; <nl> - return 0 ; <nl> - # if COCOS2D_DEBUG > = 1 <nl> - tolua_lerror : <nl> - tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_Button_create ' . " , & tolua_err ) ; <nl> - # endif <nl> - return 0 ; <nl> - } <nl> - int lua_cocos2dx_ui_Button_createInstance ( lua_State * tolua_S ) <nl> - { <nl> - int argc = 0 ; <nl> - bool ok = true ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - tolua_Error tolua_err ; <nl> - # endif <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - if ( ! tolua_isusertable ( tolua_S , 1 , " ccui . Button " , 0 , & tolua_err ) ) goto tolua_lerror ; <nl> - # endif <nl> - <nl> - argc = lua_gettop ( tolua_S ) - 1 ; <nl> - <nl> - if ( argc = = 0 ) <nl> - { <nl> - if ( ! ok ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_ui_Button_createInstance ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - cocos2d : : Ref * ret = cocos2d : : ui : : Button : : createInstance ( ) ; <nl> - object_to_luaval < cocos2d : : Ref > ( tolua_S , " cc . Ref " , ( cocos2d : : Ref * ) ret ) ; <nl> - return 1 ; <nl> - } <nl> - luaL_error ( tolua_S , " % s has wrong number of arguments : % d , was expecting % d \ n " , " ccui . Button : createInstance " , argc , 0 ) ; <nl> - return 0 ; <nl> - # if COCOS2D_DEBUG > = 1 <nl> - tolua_lerror : <nl> - tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_Button_createInstance ' . " , & tolua_err ) ; <nl> - # endif <nl> - return 0 ; <nl> - } <nl> - int lua_cocos2dx_ui_Button_constructor ( lua_State * tolua_S ) <nl> - { <nl> - int argc = 0 ; <nl> - cocos2d : : ui : : Button * cobj = nullptr ; <nl> - bool ok = true ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - tolua_Error tolua_err ; <nl> - # endif <nl> - <nl> - <nl> - <nl> - argc = lua_gettop ( tolua_S ) - 1 ; <nl> - if ( argc = = 0 ) <nl> - { <nl> - if ( ! ok ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_ui_Button_constructor ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - cobj = new cocos2d : : ui : : Button ( ) ; <nl> - cobj - > autorelease ( ) ; <nl> - int ID = ( int ) cobj - > _ID ; <nl> - int * luaID = & cobj - > _luaID ; <nl> - toluafix_pushusertype_ccobject ( tolua_S , ID , luaID , ( void * ) cobj , " ccui . Button " ) ; <nl> - return 1 ; <nl> - } <nl> - luaL_error ( tolua_S , " % s has wrong number of arguments : % d , was expecting % d \ n " , " ccui . Button : Button " , argc , 0 ) ; <nl> - return 0 ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_Button_constructor ' . " , & tolua_err ) ; <nl> - # endif <nl> - <nl> - return 0 ; <nl> - } <nl> - <nl> - static int lua_cocos2dx_ui_Button_finalize ( lua_State * tolua_S ) <nl> - { <nl> - printf ( " luabindings : finalizing LUA object ( Button ) " ) ; <nl> - return 0 ; <nl> - } <nl> - <nl> - int lua_register_cocos2dx_ui_Button ( lua_State * tolua_S ) <nl> - { <nl> - tolua_usertype ( tolua_S , " ccui . Button " ) ; <nl> - tolua_cclass ( tolua_S , " Button " , " ccui . Button " , " ccui . Widget " , nullptr ) ; <nl> - <nl> - tolua_beginmodule ( tolua_S , " Button " ) ; <nl> - tolua_function ( tolua_S , " new " , lua_cocos2dx_ui_Button_constructor ) ; <nl> - tolua_function ( tolua_S , " getNormalTextureSize " , lua_cocos2dx_ui_Button_getNormalTextureSize ) ; <nl> - tolua_function ( tolua_S , " getTitleText " , lua_cocos2dx_ui_Button_getTitleText ) ; <nl> - tolua_function ( tolua_S , " setTitleFontSize " , lua_cocos2dx_ui_Button_setTitleFontSize ) ; <nl> - tolua_function ( tolua_S , " setScale9Enabled " , lua_cocos2dx_ui_Button_setScale9Enabled ) ; <nl> - tolua_function ( tolua_S , " getTitleRenderer " , lua_cocos2dx_ui_Button_getTitleRenderer ) ; <nl> - tolua_function ( tolua_S , " getZoomScale " , lua_cocos2dx_ui_Button_getZoomScale ) ; <nl> - tolua_function ( tolua_S , " getCapInsetsDisabledRenderer " , lua_cocos2dx_ui_Button_getCapInsetsDisabledRenderer ) ; <nl> - tolua_function ( tolua_S , " setTitleColor " , lua_cocos2dx_ui_Button_setTitleColor ) ; <nl> - tolua_function ( tolua_S , " setCapInsetsDisabledRenderer " , lua_cocos2dx_ui_Button_setCapInsetsDisabledRenderer ) ; <nl> - tolua_function ( tolua_S , " setCapInsets " , lua_cocos2dx_ui_Button_setCapInsets ) ; <nl> - tolua_function ( tolua_S , " loadTextureDisabled " , lua_cocos2dx_ui_Button_loadTextureDisabled ) ; <nl> - tolua_function ( tolua_S , " init " , lua_cocos2dx_ui_Button_init ) ; <nl> - tolua_function ( tolua_S , " setTitleText " , lua_cocos2dx_ui_Button_setTitleText ) ; <nl> - tolua_function ( tolua_S , " setCapInsetsNormalRenderer " , lua_cocos2dx_ui_Button_setCapInsetsNormalRenderer ) ; <nl> - tolua_function ( tolua_S , " loadTexturePressed " , lua_cocos2dx_ui_Button_loadTexturePressed ) ; <nl> - tolua_function ( tolua_S , " setTitleFontName " , lua_cocos2dx_ui_Button_setTitleFontName ) ; <nl> - tolua_function ( tolua_S , " getCapInsetsNormalRenderer " , lua_cocos2dx_ui_Button_getCapInsetsNormalRenderer ) ; <nl> - tolua_function ( tolua_S , " setTitleAlignment " , lua_cocos2dx_ui_Button_setTitleAlignment ) ; <nl> - tolua_function ( tolua_S , " getCapInsetsPressedRenderer " , lua_cocos2dx_ui_Button_getCapInsetsPressedRenderer ) ; <nl> - tolua_function ( tolua_S , " loadTextures " , lua_cocos2dx_ui_Button_loadTextures ) ; <nl> - tolua_function ( tolua_S , " isScale9Enabled " , lua_cocos2dx_ui_Button_isScale9Enabled ) ; <nl> - tolua_function ( tolua_S , " loadTextureNormal " , lua_cocos2dx_ui_Button_loadTextureNormal ) ; <nl> - tolua_function ( tolua_S , " setCapInsetsPressedRenderer " , lua_cocos2dx_ui_Button_setCapInsetsPressedRenderer ) ; <nl> - tolua_function ( tolua_S , " getTitleFontSize " , lua_cocos2dx_ui_Button_getTitleFontSize ) ; <nl> - tolua_function ( tolua_S , " getTitleFontName " , lua_cocos2dx_ui_Button_getTitleFontName ) ; <nl> - tolua_function ( tolua_S , " getTitleColor " , lua_cocos2dx_ui_Button_getTitleColor ) ; <nl> - tolua_function ( tolua_S , " setPressedActionEnabled " , lua_cocos2dx_ui_Button_setPressedActionEnabled ) ; <nl> - tolua_function ( tolua_S , " setZoomScale " , lua_cocos2dx_ui_Button_setZoomScale ) ; <nl> - tolua_function ( tolua_S , " create " , lua_cocos2dx_ui_Button_create ) ; <nl> - tolua_function ( tolua_S , " createInstance " , lua_cocos2dx_ui_Button_createInstance ) ; <nl> - tolua_endmodule ( tolua_S ) ; <nl> - std : : string typeName = typeid ( cocos2d : : ui : : Button ) . name ( ) ; <nl> - g_luaType [ typeName ] = " ccui . Button " ; <nl> - g_typeCast [ " Button " ] = " ccui . Button " ; <nl> - return 1 ; <nl> - } <nl> - <nl> - int lua_cocos2dx_ui_CheckBox_loadTextureBackGroundSelected ( lua_State * tolua_S ) <nl> - { <nl> - int argc = 0 ; <nl> - cocos2d : : ui : : CheckBox * cobj = nullptr ; <nl> - bool ok = true ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - tolua_Error tolua_err ; <nl> - # endif <nl> - <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - if ( ! tolua_isusertype ( tolua_S , 1 , " ccui . CheckBox " , 0 , & tolua_err ) ) goto tolua_lerror ; <nl> - # endif <nl> - <nl> - cobj = ( cocos2d : : ui : : CheckBox * ) tolua_tousertype ( tolua_S , 1 , 0 ) ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - if ( ! cobj ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_CheckBox_loadTextureBackGroundSelected ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - # endif <nl> - <nl> - argc = lua_gettop ( tolua_S ) - 1 ; <nl> - if ( argc = = 1 ) <nl> - { <nl> - std : : string arg0 ; <nl> - <nl> - ok & = luaval_to_std_string ( tolua_S , 2 , & arg0 , " ccui . CheckBox : loadTextureBackGroundSelected " ) ; <nl> - if ( ! ok ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_ui_CheckBox_loadTextureBackGroundSelected ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - cobj - > loadTextureBackGroundSelected ( arg0 ) ; <nl> - lua_settop ( tolua_S , 1 ) ; <nl> - return 1 ; <nl> - } <nl> - if ( argc = = 2 ) <nl> - { <nl> - std : : string arg0 ; <nl> - cocos2d : : ui : : Widget : : TextureResType arg1 ; <nl> - <nl> - ok & = luaval_to_std_string ( tolua_S , 2 , & arg0 , " ccui . CheckBox : loadTextureBackGroundSelected " ) ; <nl> - <nl> - ok & = luaval_to_int32 ( tolua_S , 3 , ( int * ) & arg1 , " ccui . CheckBox : loadTextureBackGroundSelected " ) ; <nl> - if ( ! ok ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_ui_CheckBox_loadTextureBackGroundSelected ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - cobj - > loadTextureBackGroundSelected ( arg0 , arg1 ) ; <nl> - lua_settop ( tolua_S , 1 ) ; <nl> - return 1 ; <nl> - } <nl> - luaL_error ( tolua_S , " % s has wrong number of arguments : % d , was expecting % d \ n " , " ccui . CheckBox : loadTextureBackGroundSelected " , argc , 1 ) ; <nl> - return 0 ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - tolua_lerror : <nl> - tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_CheckBox_loadTextureBackGroundSelected ' . " , & tolua_err ) ; <nl> - # endif <nl> - <nl> - return 0 ; <nl> - } <nl> - int lua_cocos2dx_ui_CheckBox_loadTextureBackGroundDisabled ( lua_State * tolua_S ) <nl> - { <nl> - int argc = 0 ; <nl> - cocos2d : : ui : : CheckBox * cobj = nullptr ; <nl> - bool ok = true ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - tolua_Error tolua_err ; <nl> - # endif <nl> - <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - if ( ! tolua_isusertype ( tolua_S , 1 , " ccui . CheckBox " , 0 , & tolua_err ) ) goto tolua_lerror ; <nl> - # endif <nl> - <nl> - cobj = ( cocos2d : : ui : : CheckBox * ) tolua_tousertype ( tolua_S , 1 , 0 ) ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - if ( ! cobj ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_CheckBox_loadTextureBackGroundDisabled ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - # endif <nl> - <nl> - argc = lua_gettop ( tolua_S ) - 1 ; <nl> - if ( argc = = 1 ) <nl> - { <nl> - std : : string arg0 ; <nl> - <nl> - ok & = luaval_to_std_string ( tolua_S , 2 , & arg0 , " ccui . CheckBox : loadTextureBackGroundDisabled " ) ; <nl> - if ( ! ok ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_ui_CheckBox_loadTextureBackGroundDisabled ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - cobj - > loadTextureBackGroundDisabled ( arg0 ) ; <nl> - lua_settop ( tolua_S , 1 ) ; <nl> - return 1 ; <nl> - } <nl> - if ( argc = = 2 ) <nl> - { <nl> - std : : string arg0 ; <nl> - cocos2d : : ui : : Widget : : TextureResType arg1 ; <nl> - <nl> - ok & = luaval_to_std_string ( tolua_S , 2 , & arg0 , " ccui . CheckBox : loadTextureBackGroundDisabled " ) ; <nl> - <nl> - ok & = luaval_to_int32 ( tolua_S , 3 , ( int * ) & arg1 , " ccui . CheckBox : loadTextureBackGroundDisabled " ) ; <nl> - if ( ! ok ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_ui_CheckBox_loadTextureBackGroundDisabled ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - cobj - > loadTextureBackGroundDisabled ( arg0 , arg1 ) ; <nl> - lua_settop ( tolua_S , 1 ) ; <nl> - return 1 ; <nl> - } <nl> - luaL_error ( tolua_S , " % s has wrong number of arguments : % d , was expecting % d \ n " , " ccui . CheckBox : loadTextureBackGroundDisabled " , argc , 1 ) ; <nl> - return 0 ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - tolua_lerror : <nl> - tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_CheckBox_loadTextureBackGroundDisabled ' . " , & tolua_err ) ; <nl> - # endif <nl> - <nl> - return 0 ; <nl> - } <nl> - int lua_cocos2dx_ui_CheckBox_setSelected ( lua_State * tolua_S ) <nl> - { <nl> - int argc = 0 ; <nl> - cocos2d : : ui : : CheckBox * cobj = nullptr ; <nl> - bool ok = true ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - tolua_Error tolua_err ; <nl> - # endif <nl> - <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - if ( ! tolua_isusertype ( tolua_S , 1 , " ccui . CheckBox " , 0 , & tolua_err ) ) goto tolua_lerror ; <nl> - # endif <nl> - <nl> - cobj = ( cocos2d : : ui : : CheckBox * ) tolua_tousertype ( tolua_S , 1 , 0 ) ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - if ( ! cobj ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_CheckBox_setSelected ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - # endif <nl> - <nl> - argc = lua_gettop ( tolua_S ) - 1 ; <nl> - if ( argc = = 1 ) <nl> - { <nl> - bool arg0 ; <nl> - <nl> - ok & = luaval_to_boolean ( tolua_S , 2 , & arg0 , " ccui . CheckBox : setSelected " ) ; <nl> - if ( ! ok ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_ui_CheckBox_setSelected ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - cobj - > setSelected ( arg0 ) ; <nl> - lua_settop ( tolua_S , 1 ) ; <nl> - return 1 ; <nl> - } <nl> - luaL_error ( tolua_S , " % s has wrong number of arguments : % d , was expecting % d \ n " , " ccui . CheckBox : setSelected " , argc , 1 ) ; <nl> - return 0 ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - tolua_lerror : <nl> - tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_CheckBox_setSelected ' . " , & tolua_err ) ; <nl> - # endif <nl> - <nl> - return 0 ; <nl> - } <nl> - int lua_cocos2dx_ui_CheckBox_addEventListener ( lua_State * tolua_S ) <nl> - { <nl> - int argc = 0 ; <nl> - cocos2d : : ui : : CheckBox * cobj = nullptr ; <nl> - bool ok = true ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - tolua_Error tolua_err ; <nl> - # endif <nl> - <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - if ( ! tolua_isusertype ( tolua_S , 1 , " ccui . CheckBox " , 0 , & tolua_err ) ) goto tolua_lerror ; <nl> - # endif <nl> - <nl> - cobj = ( cocos2d : : ui : : CheckBox * ) tolua_tousertype ( tolua_S , 1 , 0 ) ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - if ( ! cobj ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_CheckBox_addEventListener ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - # endif <nl> - <nl> - argc = lua_gettop ( tolua_S ) - 1 ; <nl> - if ( argc = = 1 ) <nl> - { <nl> - std : : function < void ( cocos2d : : Ref * , cocos2d : : ui : : CheckBox : : EventType ) > arg0 ; <nl> - <nl> - do { <nl> - / / Lambda binding for lua is not supported . <nl> - assert ( false ) ; <nl> - } while ( 0 ) <nl> - ; <nl> - if ( ! ok ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_ui_CheckBox_addEventListener ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - cobj - > addEventListener ( arg0 ) ; <nl> - lua_settop ( tolua_S , 1 ) ; <nl> - return 1 ; <nl> - } <nl> - luaL_error ( tolua_S , " % s has wrong number of arguments : % d , was expecting % d \ n " , " ccui . CheckBox : addEventListener " , argc , 1 ) ; <nl> - return 0 ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - tolua_lerror : <nl> - tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_CheckBox_addEventListener ' . " , & tolua_err ) ; <nl> - # endif <nl> - <nl> - return 0 ; <nl> - } <nl> - int lua_cocos2dx_ui_CheckBox_loadTextureFrontCross ( lua_State * tolua_S ) <nl> - { <nl> - int argc = 0 ; <nl> - cocos2d : : ui : : CheckBox * cobj = nullptr ; <nl> - bool ok = true ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - tolua_Error tolua_err ; <nl> - # endif <nl> - <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - if ( ! tolua_isusertype ( tolua_S , 1 , " ccui . CheckBox " , 0 , & tolua_err ) ) goto tolua_lerror ; <nl> - # endif <nl> - <nl> - cobj = ( cocos2d : : ui : : CheckBox * ) tolua_tousertype ( tolua_S , 1 , 0 ) ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - if ( ! cobj ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_CheckBox_loadTextureFrontCross ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - # endif <nl> - <nl> - argc = lua_gettop ( tolua_S ) - 1 ; <nl> - if ( argc = = 1 ) <nl> - { <nl> - std : : string arg0 ; <nl> - <nl> - ok & = luaval_to_std_string ( tolua_S , 2 , & arg0 , " ccui . CheckBox : loadTextureFrontCross " ) ; <nl> - if ( ! ok ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_ui_CheckBox_loadTextureFrontCross ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - cobj - > loadTextureFrontCross ( arg0 ) ; <nl> - lua_settop ( tolua_S , 1 ) ; <nl> - return 1 ; <nl> - } <nl> - if ( argc = = 2 ) <nl> - { <nl> - std : : string arg0 ; <nl> - cocos2d : : ui : : Widget : : TextureResType arg1 ; <nl> - <nl> - ok & = luaval_to_std_string ( tolua_S , 2 , & arg0 , " ccui . CheckBox : loadTextureFrontCross " ) ; <nl> - <nl> - ok & = luaval_to_int32 ( tolua_S , 3 , ( int * ) & arg1 , " ccui . CheckBox : loadTextureFrontCross " ) ; <nl> - if ( ! ok ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_ui_CheckBox_loadTextureFrontCross ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - cobj - > loadTextureFrontCross ( arg0 , arg1 ) ; <nl> - lua_settop ( tolua_S , 1 ) ; <nl> - return 1 ; <nl> - } <nl> - luaL_error ( tolua_S , " % s has wrong number of arguments : % d , was expecting % d \ n " , " ccui . CheckBox : loadTextureFrontCross " , argc , 1 ) ; <nl> - return 0 ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - tolua_lerror : <nl> - tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_CheckBox_loadTextureFrontCross ' . " , & tolua_err ) ; <nl> - # endif <nl> - <nl> - return 0 ; <nl> - } <nl> - int lua_cocos2dx_ui_CheckBox_isSelected ( lua_State * tolua_S ) <nl> - { <nl> - int argc = 0 ; <nl> - cocos2d : : ui : : CheckBox * cobj = nullptr ; <nl> - bool ok = true ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - tolua_Error tolua_err ; <nl> - # endif <nl> - <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - if ( ! tolua_isusertype ( tolua_S , 1 , " ccui . CheckBox " , 0 , & tolua_err ) ) goto tolua_lerror ; <nl> - # endif <nl> - <nl> - cobj = ( cocos2d : : ui : : CheckBox * ) tolua_tousertype ( tolua_S , 1 , 0 ) ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - if ( ! cobj ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_CheckBox_isSelected ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - # endif <nl> - <nl> - argc = lua_gettop ( tolua_S ) - 1 ; <nl> - if ( argc = = 0 ) <nl> - { <nl> - if ( ! ok ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_ui_CheckBox_isSelected ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - bool ret = cobj - > isSelected ( ) ; <nl> - tolua_pushboolean ( tolua_S , ( bool ) ret ) ; <nl> - return 1 ; <nl> - } <nl> - luaL_error ( tolua_S , " % s has wrong number of arguments : % d , was expecting % d \ n " , " ccui . CheckBox : isSelected " , argc , 0 ) ; <nl> - return 0 ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - tolua_lerror : <nl> - tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_CheckBox_isSelected ' . " , & tolua_err ) ; <nl> - # endif <nl> - <nl> - return 0 ; <nl> - } <nl> - int lua_cocos2dx_ui_CheckBox_init ( lua_State * tolua_S ) <nl> - { <nl> - int argc = 0 ; <nl> - cocos2d : : ui : : CheckBox * cobj = nullptr ; <nl> - bool ok = true ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - tolua_Error tolua_err ; <nl> - # endif <nl> - <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - if ( ! tolua_isusertype ( tolua_S , 1 , " ccui . CheckBox " , 0 , & tolua_err ) ) goto tolua_lerror ; <nl> - # endif <nl> - <nl> - cobj = ( cocos2d : : ui : : CheckBox * ) tolua_tousertype ( tolua_S , 1 , 0 ) ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - if ( ! cobj ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_CheckBox_init ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - # endif <nl> - <nl> - argc = lua_gettop ( tolua_S ) - 1 ; <nl> - if ( argc = = 5 ) <nl> - { <nl> - std : : string arg0 ; <nl> - std : : string arg1 ; <nl> - std : : string arg2 ; <nl> - std : : string arg3 ; <nl> - std : : string arg4 ; <nl> - <nl> - ok & = luaval_to_std_string ( tolua_S , 2 , & arg0 , " ccui . CheckBox : init " ) ; <nl> - <nl> - ok & = luaval_to_std_string ( tolua_S , 3 , & arg1 , " ccui . CheckBox : init " ) ; <nl> - <nl> - ok & = luaval_to_std_string ( tolua_S , 4 , & arg2 , " ccui . CheckBox : init " ) ; <nl> - <nl> - ok & = luaval_to_std_string ( tolua_S , 5 , & arg3 , " ccui . CheckBox : init " ) ; <nl> - <nl> - ok & = luaval_to_std_string ( tolua_S , 6 , & arg4 , " ccui . CheckBox : init " ) ; <nl> - if ( ! ok ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_ui_CheckBox_init ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - bool ret = cobj - > init ( arg0 , arg1 , arg2 , arg3 , arg4 ) ; <nl> - tolua_pushboolean ( tolua_S , ( bool ) ret ) ; <nl> - return 1 ; <nl> - } <nl> - if ( argc = = 6 ) <nl> - { <nl> - std : : string arg0 ; <nl> - std : : string arg1 ; <nl> - std : : string arg2 ; <nl> - std : : string arg3 ; <nl> - std : : string arg4 ; <nl> - cocos2d : : ui : : Widget : : TextureResType arg5 ; <nl> - <nl> - ok & = luaval_to_std_string ( tolua_S , 2 , & arg0 , " ccui . CheckBox : init " ) ; <nl> - <nl> - ok & = luaval_to_std_string ( tolua_S , 3 , & arg1 , " ccui . CheckBox : init " ) ; <nl> - <nl> - ok & = luaval_to_std_string ( tolua_S , 4 , & arg2 , " ccui . CheckBox : init " ) ; <nl> - <nl> - ok & = luaval_to_std_string ( tolua_S , 5 , & arg3 , " ccui . CheckBox : init " ) ; <nl> - <nl> - ok & = luaval_to_std_string ( tolua_S , 6 , & arg4 , " ccui . CheckBox : init " ) ; <nl> - <nl> - ok & = luaval_to_int32 ( tolua_S , 7 , ( int * ) & arg5 , " ccui . CheckBox : init " ) ; <nl> - if ( ! ok ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_ui_CheckBox_init ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - bool ret = cobj - > init ( arg0 , arg1 , arg2 , arg3 , arg4 , arg5 ) ; <nl> - tolua_pushboolean ( tolua_S , ( bool ) ret ) ; <nl> - return 1 ; <nl> - } <nl> - luaL_error ( tolua_S , " % s has wrong number of arguments : % d , was expecting % d \ n " , " ccui . CheckBox : init " , argc , 5 ) ; <nl> - return 0 ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - tolua_lerror : <nl> - tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_CheckBox_init ' . " , & tolua_err ) ; <nl> - # endif <nl> - <nl> - return 0 ; <nl> - } <nl> - int lua_cocos2dx_ui_CheckBox_loadTextures ( lua_State * tolua_S ) <nl> - { <nl> - int argc = 0 ; <nl> - cocos2d : : ui : : CheckBox * cobj = nullptr ; <nl> - bool ok = true ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - tolua_Error tolua_err ; <nl> - # endif <nl> - <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - if ( ! tolua_isusertype ( tolua_S , 1 , " ccui . CheckBox " , 0 , & tolua_err ) ) goto tolua_lerror ; <nl> - # endif <nl> - <nl> - cobj = ( cocos2d : : ui : : CheckBox * ) tolua_tousertype ( tolua_S , 1 , 0 ) ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - if ( ! cobj ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_CheckBox_loadTextures ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - # endif <nl> - <nl> - argc = lua_gettop ( tolua_S ) - 1 ; <nl> - if ( argc = = 5 ) <nl> - { <nl> - std : : string arg0 ; <nl> - std : : string arg1 ; <nl> - std : : string arg2 ; <nl> - std : : string arg3 ; <nl> - std : : string arg4 ; <nl> - <nl> - ok & = luaval_to_std_string ( tolua_S , 2 , & arg0 , " ccui . CheckBox : loadTextures " ) ; <nl> - <nl> - ok & = luaval_to_std_string ( tolua_S , 3 , & arg1 , " ccui . CheckBox : loadTextures " ) ; <nl> - <nl> - ok & = luaval_to_std_string ( tolua_S , 4 , & arg2 , " ccui . CheckBox : loadTextures " ) ; <nl> - <nl> - ok & = luaval_to_std_string ( tolua_S , 5 , & arg3 , " ccui . CheckBox : loadTextures " ) ; <nl> - <nl> - ok & = luaval_to_std_string ( tolua_S , 6 , & arg4 , " ccui . CheckBox : loadTextures " ) ; <nl> - if ( ! ok ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_ui_CheckBox_loadTextures ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - cobj - > loadTextures ( arg0 , arg1 , arg2 , arg3 , arg4 ) ; <nl> - lua_settop ( tolua_S , 1 ) ; <nl> - return 1 ; <nl> - } <nl> - if ( argc = = 6 ) <nl> - { <nl> - std : : string arg0 ; <nl> - std : : string arg1 ; <nl> - std : : string arg2 ; <nl> - std : : string arg3 ; <nl> - std : : string arg4 ; <nl> - cocos2d : : ui : : Widget : : TextureResType arg5 ; <nl> - <nl> - ok & = luaval_to_std_string ( tolua_S , 2 , & arg0 , " ccui . CheckBox : loadTextures " ) ; <nl> - <nl> - ok & = luaval_to_std_string ( tolua_S , 3 , & arg1 , " ccui . CheckBox : loadTextures " ) ; <nl> - <nl> - ok & = luaval_to_std_string ( tolua_S , 4 , & arg2 , " ccui . CheckBox : loadTextures " ) ; <nl> - <nl> - ok & = luaval_to_std_string ( tolua_S , 5 , & arg3 , " ccui . CheckBox : loadTextures " ) ; <nl> - <nl> - ok & = luaval_to_std_string ( tolua_S , 6 , & arg4 , " ccui . CheckBox : loadTextures " ) ; <nl> - <nl> - ok & = luaval_to_int32 ( tolua_S , 7 , ( int * ) & arg5 , " ccui . CheckBox : loadTextures " ) ; <nl> - if ( ! ok ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_ui_CheckBox_loadTextures ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - cobj - > loadTextures ( arg0 , arg1 , arg2 , arg3 , arg4 , arg5 ) ; <nl> - lua_settop ( tolua_S , 1 ) ; <nl> - return 1 ; <nl> - } <nl> - luaL_error ( tolua_S , " % s has wrong number of arguments : % d , was expecting % d \ n " , " ccui . CheckBox : loadTextures " , argc , 5 ) ; <nl> - return 0 ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - tolua_lerror : <nl> - tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_CheckBox_loadTextures ' . " , & tolua_err ) ; <nl> - # endif <nl> - <nl> - return 0 ; <nl> - } <nl> - int lua_cocos2dx_ui_CheckBox_getZoomScale ( lua_State * tolua_S ) <nl> - { <nl> - int argc = 0 ; <nl> - cocos2d : : ui : : CheckBox * cobj = nullptr ; <nl> - bool ok = true ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - tolua_Error tolua_err ; <nl> - # endif <nl> - <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - if ( ! tolua_isusertype ( tolua_S , 1 , " ccui . CheckBox " , 0 , & tolua_err ) ) goto tolua_lerror ; <nl> - # endif <nl> - <nl> - cobj = ( cocos2d : : ui : : CheckBox * ) tolua_tousertype ( tolua_S , 1 , 0 ) ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - if ( ! cobj ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_CheckBox_getZoomScale ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - # endif <nl> - <nl> - argc = lua_gettop ( tolua_S ) - 1 ; <nl> - if ( argc = = 0 ) <nl> + cocos2d : : ui : : Button * ret = cocos2d : : ui : : Button : : create ( arg0 , arg1 , arg2 , arg3 ) ; <nl> + object_to_luaval < cocos2d : : ui : : Button > ( tolua_S , " ccui . Button " , ( cocos2d : : ui : : Button * ) ret ) ; <nl> + return 1 ; <nl> + } <nl> + } while ( 0 ) ; <nl> + ok = true ; <nl> + do <nl> { <nl> - if ( ! ok ) <nl> + if ( argc = = 0 ) <nl> { <nl> - tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_ui_CheckBox_getZoomScale ' " , nullptr ) ; <nl> - return 0 ; <nl> + cocos2d : : ui : : Button * ret = cocos2d : : ui : : Button : : create ( ) ; <nl> + object_to_luaval < cocos2d : : ui : : Button > ( tolua_S , " ccui . Button " , ( cocos2d : : ui : : Button * ) ret ) ; <nl> + return 1 ; <nl> } <nl> - double ret = cobj - > getZoomScale ( ) ; <nl> - tolua_pushnumber ( tolua_S , ( lua_Number ) ret ) ; <nl> - return 1 ; <nl> - } <nl> - luaL_error ( tolua_S , " % s has wrong number of arguments : % d , was expecting % d \ n " , " ccui . CheckBox : getZoomScale " , argc , 0 ) ; <nl> + } while ( 0 ) ; <nl> + ok = true ; <nl> + luaL_error ( tolua_S , " % s has wrong number of arguments : % d , was expecting % d " , " ccui . Button : create " , argc , 0 ) ; <nl> return 0 ; <nl> - <nl> # if COCOS2D_DEBUG > = 1 <nl> tolua_lerror : <nl> - tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_CheckBox_getZoomScale ' . " , & tolua_err ) ; <nl> + tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_Button_create ' . " , & tolua_err ) ; <nl> # endif <nl> - <nl> return 0 ; <nl> } <nl> - int lua_cocos2dx_ui_CheckBox_loadTextureBackGround ( lua_State * tolua_S ) <nl> + int lua_cocos2dx_ui_Button_createInstance ( lua_State * tolua_S ) <nl> { <nl> int argc = 0 ; <nl> - cocos2d : : ui : : CheckBox * cobj = nullptr ; <nl> bool ok = true ; <nl> <nl> # if COCOS2D_DEBUG > = 1 <nl> tolua_Error tolua_err ; <nl> # endif <nl> <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - if ( ! tolua_isusertype ( tolua_S , 1 , " ccui . CheckBox " , 0 , & tolua_err ) ) goto tolua_lerror ; <nl> - # endif <nl> - <nl> - cobj = ( cocos2d : : ui : : CheckBox * ) tolua_tousertype ( tolua_S , 1 , 0 ) ; <nl> - <nl> # if COCOS2D_DEBUG > = 1 <nl> - if ( ! cobj ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_CheckBox_loadTextureBackGround ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> + if ( ! tolua_isusertable ( tolua_S , 1 , " ccui . Button " , 0 , & tolua_err ) ) goto tolua_lerror ; <nl> # endif <nl> <nl> - argc = lua_gettop ( tolua_S ) - 1 ; <nl> - if ( argc = = 1 ) <nl> - { <nl> - std : : string arg0 ; <nl> + argc = lua_gettop ( tolua_S ) - 1 ; <nl> <nl> - ok & = luaval_to_std_string ( tolua_S , 2 , & arg0 , " ccui . CheckBox : loadTextureBackGround " ) ; <nl> - if ( ! ok ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_ui_CheckBox_loadTextureBackGround ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - cobj - > loadTextureBackGround ( arg0 ) ; <nl> - lua_settop ( tolua_S , 1 ) ; <nl> - return 1 ; <nl> - } <nl> - if ( argc = = 2 ) <nl> + if ( argc = = 0 ) <nl> { <nl> - std : : string arg0 ; <nl> - cocos2d : : ui : : Widget : : TextureResType arg1 ; <nl> - <nl> - ok & = luaval_to_std_string ( tolua_S , 2 , & arg0 , " ccui . CheckBox : loadTextureBackGround " ) ; <nl> - <nl> - ok & = luaval_to_int32 ( tolua_S , 3 , ( int * ) & arg1 , " ccui . CheckBox : loadTextureBackGround " ) ; <nl> if ( ! ok ) <nl> { <nl> - tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_ui_CheckBox_loadTextureBackGround ' " , nullptr ) ; <nl> + tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_ui_Button_createInstance ' " , nullptr ) ; <nl> return 0 ; <nl> } <nl> - cobj - > loadTextureBackGround ( arg0 , arg1 ) ; <nl> - lua_settop ( tolua_S , 1 ) ; <nl> + cocos2d : : Ref * ret = cocos2d : : ui : : Button : : createInstance ( ) ; <nl> + object_to_luaval < cocos2d : : Ref > ( tolua_S , " cc . Ref " , ( cocos2d : : Ref * ) ret ) ; <nl> return 1 ; <nl> } <nl> - luaL_error ( tolua_S , " % s has wrong number of arguments : % d , was expecting % d \ n " , " ccui . CheckBox : loadTextureBackGround " , argc , 1 ) ; <nl> + luaL_error ( tolua_S , " % s has wrong number of arguments : % d , was expecting % d \ n " , " ccui . Button : createInstance " , argc , 0 ) ; <nl> return 0 ; <nl> - <nl> # if COCOS2D_DEBUG > = 1 <nl> tolua_lerror : <nl> - tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_CheckBox_loadTextureBackGround ' . " , & tolua_err ) ; <nl> + tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_Button_createInstance ' . " , & tolua_err ) ; <nl> # endif <nl> - <nl> return 0 ; <nl> } <nl> - int lua_cocos2dx_ui_CheckBox_setZoomScale ( lua_State * tolua_S ) <nl> + int lua_cocos2dx_ui_Button_constructor ( lua_State * tolua_S ) <nl> { <nl> int argc = 0 ; <nl> - cocos2d : : ui : : CheckBox * cobj = nullptr ; <nl> + cocos2d : : ui : : Button * cobj = nullptr ; <nl> bool ok = true ; <nl> <nl> # if COCOS2D_DEBUG > = 1 <nl> int lua_cocos2dx_ui_CheckBox_setZoomScale ( lua_State * tolua_S ) <nl> # endif <nl> <nl> <nl> - # if COCOS2D_DEBUG > = 1 <nl> - if ( ! tolua_isusertype ( tolua_S , 1 , " ccui . CheckBox " , 0 , & tolua_err ) ) goto tolua_lerror ; <nl> - # endif <nl> - <nl> - cobj = ( cocos2d : : ui : : CheckBox * ) tolua_tousertype ( tolua_S , 1 , 0 ) ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - if ( ! cobj ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_CheckBox_setZoomScale ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - # endif <nl> <nl> argc = lua_gettop ( tolua_S ) - 1 ; <nl> - if ( argc = = 1 ) <nl> + if ( argc = = 0 ) <nl> { <nl> - double arg0 ; <nl> - <nl> - ok & = luaval_to_number ( tolua_S , 2 , & arg0 , " ccui . CheckBox : setZoomScale " ) ; <nl> if ( ! ok ) <nl> { <nl> - tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_ui_CheckBox_setZoomScale ' " , nullptr ) ; <nl> + tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_ui_Button_constructor ' " , nullptr ) ; <nl> return 0 ; <nl> } <nl> - cobj - > setZoomScale ( arg0 ) ; <nl> - lua_settop ( tolua_S , 1 ) ; <nl> + cobj = new cocos2d : : ui : : Button ( ) ; <nl> + cobj - > autorelease ( ) ; <nl> + int ID = ( int ) cobj - > _ID ; <nl> + int * luaID = & cobj - > _luaID ; <nl> + toluafix_pushusertype_ccobject ( tolua_S , ID , luaID , ( void * ) cobj , " ccui . Button " ) ; <nl> return 1 ; <nl> } <nl> - luaL_error ( tolua_S , " % s has wrong number of arguments : % d , was expecting % d \ n " , " ccui . CheckBox : setZoomScale " , argc , 1 ) ; <nl> + luaL_error ( tolua_S , " % s has wrong number of arguments : % d , was expecting % d \ n " , " ccui . Button : Button " , argc , 0 ) ; <nl> return 0 ; <nl> <nl> # if COCOS2D_DEBUG > = 1 <nl> - tolua_lerror : <nl> - tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_CheckBox_setZoomScale ' . " , & tolua_err ) ; <nl> + tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_Button_constructor ' . " , & tolua_err ) ; <nl> # endif <nl> <nl> return 0 ; <nl> } <nl> - int lua_cocos2dx_ui_CheckBox_loadTextureFrontCrossDisabled ( lua_State * tolua_S ) <nl> + <nl> + static int lua_cocos2dx_ui_Button_finalize ( lua_State * tolua_S ) <nl> + { <nl> + printf ( " luabindings : finalizing LUA object ( Button ) " ) ; <nl> + return 0 ; <nl> + } <nl> + <nl> + int lua_register_cocos2dx_ui_Button ( lua_State * tolua_S ) <nl> + { <nl> + tolua_usertype ( tolua_S , " ccui . Button " ) ; <nl> + tolua_cclass ( tolua_S , " Button " , " ccui . Button " , " ccui . Widget " , nullptr ) ; <nl> + <nl> + tolua_beginmodule ( tolua_S , " Button " ) ; <nl> + tolua_function ( tolua_S , " new " , lua_cocos2dx_ui_Button_constructor ) ; <nl> + tolua_function ( tolua_S , " getNormalTextureSize " , lua_cocos2dx_ui_Button_getNormalTextureSize ) ; <nl> + tolua_function ( tolua_S , " getTitleText " , lua_cocos2dx_ui_Button_getTitleText ) ; <nl> + tolua_function ( tolua_S , " setTitleFontSize " , lua_cocos2dx_ui_Button_setTitleFontSize ) ; <nl> + tolua_function ( tolua_S , " setScale9Enabled " , lua_cocos2dx_ui_Button_setScale9Enabled ) ; <nl> + tolua_function ( tolua_S , " getTitleRenderer " , lua_cocos2dx_ui_Button_getTitleRenderer ) ; <nl> + tolua_function ( tolua_S , " getZoomScale " , lua_cocos2dx_ui_Button_getZoomScale ) ; <nl> + tolua_function ( tolua_S , " getCapInsetsDisabledRenderer " , lua_cocos2dx_ui_Button_getCapInsetsDisabledRenderer ) ; <nl> + tolua_function ( tolua_S , " setTitleColor " , lua_cocos2dx_ui_Button_setTitleColor ) ; <nl> + tolua_function ( tolua_S , " setCapInsetsDisabledRenderer " , lua_cocos2dx_ui_Button_setCapInsetsDisabledRenderer ) ; <nl> + tolua_function ( tolua_S , " setCapInsets " , lua_cocos2dx_ui_Button_setCapInsets ) ; <nl> + tolua_function ( tolua_S , " loadTextureDisabled " , lua_cocos2dx_ui_Button_loadTextureDisabled ) ; <nl> + tolua_function ( tolua_S , " init " , lua_cocos2dx_ui_Button_init ) ; <nl> + tolua_function ( tolua_S , " setTitleText " , lua_cocos2dx_ui_Button_setTitleText ) ; <nl> + tolua_function ( tolua_S , " setCapInsetsNormalRenderer " , lua_cocos2dx_ui_Button_setCapInsetsNormalRenderer ) ; <nl> + tolua_function ( tolua_S , " loadTexturePressed " , lua_cocos2dx_ui_Button_loadTexturePressed ) ; <nl> + tolua_function ( tolua_S , " setTitleFontName " , lua_cocos2dx_ui_Button_setTitleFontName ) ; <nl> + tolua_function ( tolua_S , " getCapInsetsNormalRenderer " , lua_cocos2dx_ui_Button_getCapInsetsNormalRenderer ) ; <nl> + tolua_function ( tolua_S , " setTitleAlignment " , lua_cocos2dx_ui_Button_setTitleAlignment ) ; <nl> + tolua_function ( tolua_S , " getCapInsetsPressedRenderer " , lua_cocos2dx_ui_Button_getCapInsetsPressedRenderer ) ; <nl> + tolua_function ( tolua_S , " loadTextures " , lua_cocos2dx_ui_Button_loadTextures ) ; <nl> + tolua_function ( tolua_S , " isScale9Enabled " , lua_cocos2dx_ui_Button_isScale9Enabled ) ; <nl> + tolua_function ( tolua_S , " loadTextureNormal " , lua_cocos2dx_ui_Button_loadTextureNormal ) ; <nl> + tolua_function ( tolua_S , " setCapInsetsPressedRenderer " , lua_cocos2dx_ui_Button_setCapInsetsPressedRenderer ) ; <nl> + tolua_function ( tolua_S , " getTitleFontSize " , lua_cocos2dx_ui_Button_getTitleFontSize ) ; <nl> + tolua_function ( tolua_S , " getTitleFontName " , lua_cocos2dx_ui_Button_getTitleFontName ) ; <nl> + tolua_function ( tolua_S , " getTitleColor " , lua_cocos2dx_ui_Button_getTitleColor ) ; <nl> + tolua_function ( tolua_S , " setPressedActionEnabled " , lua_cocos2dx_ui_Button_setPressedActionEnabled ) ; <nl> + tolua_function ( tolua_S , " setZoomScale " , lua_cocos2dx_ui_Button_setZoomScale ) ; <nl> + tolua_function ( tolua_S , " create " , lua_cocos2dx_ui_Button_create ) ; <nl> + tolua_function ( tolua_S , " createInstance " , lua_cocos2dx_ui_Button_createInstance ) ; <nl> + tolua_endmodule ( tolua_S ) ; <nl> + std : : string typeName = typeid ( cocos2d : : ui : : Button ) . name ( ) ; <nl> + g_luaType [ typeName ] = " ccui . Button " ; <nl> + g_typeCast [ " Button " ] = " ccui . Button " ; <nl> + return 1 ; <nl> + } <nl> + <nl> + int lua_cocos2dx_ui_CheckBox_addEventListener ( lua_State * tolua_S ) <nl> { <nl> int argc = 0 ; <nl> cocos2d : : ui : : CheckBox * cobj = nullptr ; <nl> int lua_cocos2dx_ui_CheckBox_loadTextureFrontCrossDisabled ( lua_State * tolua_S ) <nl> # if COCOS2D_DEBUG > = 1 <nl> if ( ! cobj ) <nl> { <nl> - tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_CheckBox_loadTextureFrontCrossDisabled ' " , nullptr ) ; <nl> + tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_CheckBox_addEventListener ' " , nullptr ) ; <nl> return 0 ; <nl> } <nl> # endif <nl> int lua_cocos2dx_ui_CheckBox_loadTextureFrontCrossDisabled ( lua_State * tolua_S ) <nl> argc = lua_gettop ( tolua_S ) - 1 ; <nl> if ( argc = = 1 ) <nl> { <nl> - std : : string arg0 ; <nl> - <nl> - ok & = luaval_to_std_string ( tolua_S , 2 , & arg0 , " ccui . CheckBox : loadTextureFrontCrossDisabled " ) ; <nl> - if ( ! ok ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_ui_CheckBox_loadTextureFrontCrossDisabled ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - cobj - > loadTextureFrontCrossDisabled ( arg0 ) ; <nl> - lua_settop ( tolua_S , 1 ) ; <nl> - return 1 ; <nl> - } <nl> - if ( argc = = 2 ) <nl> - { <nl> - std : : string arg0 ; <nl> - cocos2d : : ui : : Widget : : TextureResType arg1 ; <nl> - <nl> - ok & = luaval_to_std_string ( tolua_S , 2 , & arg0 , " ccui . CheckBox : loadTextureFrontCrossDisabled " ) ; <nl> + std : : function < void ( cocos2d : : Ref * , cocos2d : : ui : : CheckBox : : EventType ) > arg0 ; <nl> <nl> - ok & = luaval_to_int32 ( tolua_S , 3 , ( int * ) & arg1 , " ccui . CheckBox : loadTextureFrontCrossDisabled " ) ; <nl> + do { <nl> + / / Lambda binding for lua is not supported . <nl> + assert ( false ) ; <nl> + } while ( 0 ) <nl> + ; <nl> if ( ! ok ) <nl> { <nl> - tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_ui_CheckBox_loadTextureFrontCrossDisabled ' " , nullptr ) ; <nl> + tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_ui_CheckBox_addEventListener ' " , nullptr ) ; <nl> return 0 ; <nl> } <nl> - cobj - > loadTextureFrontCrossDisabled ( arg0 , arg1 ) ; <nl> + cobj - > addEventListener ( arg0 ) ; <nl> lua_settop ( tolua_S , 1 ) ; <nl> return 1 ; <nl> } <nl> - luaL_error ( tolua_S , " % s has wrong number of arguments : % d , was expecting % d \ n " , " ccui . CheckBox : loadTextureFrontCrossDisabled " , argc , 1 ) ; <nl> + luaL_error ( tolua_S , " % s has wrong number of arguments : % d , was expecting % d \ n " , " ccui . CheckBox : addEventListener " , argc , 1 ) ; <nl> return 0 ; <nl> <nl> # if COCOS2D_DEBUG > = 1 <nl> tolua_lerror : <nl> - tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_CheckBox_loadTextureFrontCrossDisabled ' . " , & tolua_err ) ; <nl> + tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_CheckBox_addEventListener ' . " , & tolua_err ) ; <nl> # endif <nl> <nl> return 0 ; <nl> static int lua_cocos2dx_ui_CheckBox_finalize ( lua_State * tolua_S ) <nl> int lua_register_cocos2dx_ui_CheckBox ( lua_State * tolua_S ) <nl> { <nl> tolua_usertype ( tolua_S , " ccui . CheckBox " ) ; <nl> - tolua_cclass ( tolua_S , " CheckBox " , " ccui . CheckBox " , " ccui . Widget " , nullptr ) ; <nl> + tolua_cclass ( tolua_S , " CheckBox " , " ccui . CheckBox " , " ccui . AbstractCheckButton " , nullptr ) ; <nl> <nl> tolua_beginmodule ( tolua_S , " CheckBox " ) ; <nl> tolua_function ( tolua_S , " new " , lua_cocos2dx_ui_CheckBox_constructor ) ; <nl> - tolua_function ( tolua_S , " loadTextureBackGroundSelected " , lua_cocos2dx_ui_CheckBox_loadTextureBackGroundSelected ) ; <nl> - tolua_function ( tolua_S , " loadTextureBackGroundDisabled " , lua_cocos2dx_ui_CheckBox_loadTextureBackGroundDisabled ) ; <nl> - tolua_function ( tolua_S , " setSelected " , lua_cocos2dx_ui_CheckBox_setSelected ) ; <nl> tolua_function ( tolua_S , " addEventListener " , lua_cocos2dx_ui_CheckBox_addEventListener ) ; <nl> - tolua_function ( tolua_S , " loadTextureFrontCross " , lua_cocos2dx_ui_CheckBox_loadTextureFrontCross ) ; <nl> - tolua_function ( tolua_S , " isSelected " , lua_cocos2dx_ui_CheckBox_isSelected ) ; <nl> - tolua_function ( tolua_S , " init " , lua_cocos2dx_ui_CheckBox_init ) ; <nl> - tolua_function ( tolua_S , " loadTextures " , lua_cocos2dx_ui_CheckBox_loadTextures ) ; <nl> - tolua_function ( tolua_S , " getZoomScale " , lua_cocos2dx_ui_CheckBox_getZoomScale ) ; <nl> - tolua_function ( tolua_S , " loadTextureBackGround " , lua_cocos2dx_ui_CheckBox_loadTextureBackGround ) ; <nl> - tolua_function ( tolua_S , " setZoomScale " , lua_cocos2dx_ui_CheckBox_setZoomScale ) ; <nl> - tolua_function ( tolua_S , " loadTextureFrontCrossDisabled " , lua_cocos2dx_ui_CheckBox_loadTextureFrontCrossDisabled ) ; <nl> tolua_function ( tolua_S , " create " , lua_cocos2dx_ui_CheckBox_create ) ; <nl> tolua_function ( tolua_S , " createInstance " , lua_cocos2dx_ui_CheckBox_createInstance ) ; <nl> tolua_endmodule ( tolua_S ) ; <nl> int lua_register_cocos2dx_ui_ListView ( lua_State * tolua_S ) <nl> return 1 ; <nl> } <nl> <nl> + int lua_cocos2dx_ui_Slider_setMaxPercent ( lua_State * tolua_S ) <nl> + { <nl> + int argc = 0 ; <nl> + cocos2d : : ui : : Slider * cobj = nullptr ; <nl> + bool ok = true ; <nl> + <nl> + # if COCOS2D_DEBUG > = 1 <nl> + tolua_Error tolua_err ; <nl> + # endif <nl> + <nl> + <nl> + # if COCOS2D_DEBUG > = 1 <nl> + if ( ! tolua_isusertype ( tolua_S , 1 , " ccui . Slider " , 0 , & tolua_err ) ) goto tolua_lerror ; <nl> + # endif <nl> + <nl> + cobj = ( cocos2d : : ui : : Slider * ) tolua_tousertype ( tolua_S , 1 , 0 ) ; <nl> + <nl> + # if COCOS2D_DEBUG > = 1 <nl> + if ( ! cobj ) <nl> + { <nl> + tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_Slider_setMaxPercent ' " , nullptr ) ; <nl> + return 0 ; <nl> + } <nl> + # endif <nl> + <nl> + argc = lua_gettop ( tolua_S ) - 1 ; <nl> + if ( argc = = 1 ) <nl> + { <nl> + int arg0 ; <nl> + <nl> + ok & = luaval_to_int32 ( tolua_S , 2 , ( int * ) & arg0 , " ccui . Slider : setMaxPercent " ) ; <nl> + if ( ! ok ) <nl> + { <nl> + tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_ui_Slider_setMaxPercent ' " , nullptr ) ; <nl> + return 0 ; <nl> + } <nl> + cobj - > setMaxPercent ( arg0 ) ; <nl> + lua_settop ( tolua_S , 1 ) ; <nl> + return 1 ; <nl> + } <nl> + luaL_error ( tolua_S , " % s has wrong number of arguments : % d , was expecting % d \ n " , " ccui . Slider : setMaxPercent " , argc , 1 ) ; <nl> + return 0 ; <nl> + <nl> + # if COCOS2D_DEBUG > = 1 <nl> + tolua_lerror : <nl> + tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_Slider_setMaxPercent ' . " , & tolua_err ) ; <nl> + # endif <nl> + <nl> + return 0 ; <nl> + } <nl> int lua_cocos2dx_ui_Slider_setPercent ( lua_State * tolua_S ) <nl> { <nl> int argc = 0 ; <nl> int lua_cocos2dx_ui_Slider_loadSlidBallTextureDisabled ( lua_State * tolua_S ) <nl> <nl> return 0 ; <nl> } <nl> + int lua_cocos2dx_ui_Slider_getMaxPercent ( lua_State * tolua_S ) <nl> + { <nl> + int argc = 0 ; <nl> + cocos2d : : ui : : Slider * cobj = nullptr ; <nl> + bool ok = true ; <nl> + <nl> + # if COCOS2D_DEBUG > = 1 <nl> + tolua_Error tolua_err ; <nl> + # endif <nl> + <nl> + <nl> + # if COCOS2D_DEBUG > = 1 <nl> + if ( ! tolua_isusertype ( tolua_S , 1 , " ccui . Slider " , 0 , & tolua_err ) ) goto tolua_lerror ; <nl> + # endif <nl> + <nl> + cobj = ( cocos2d : : ui : : Slider * ) tolua_tousertype ( tolua_S , 1 , 0 ) ; <nl> + <nl> + # if COCOS2D_DEBUG > = 1 <nl> + if ( ! cobj ) <nl> + { <nl> + tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_Slider_getMaxPercent ' " , nullptr ) ; <nl> + return 0 ; <nl> + } <nl> + # endif <nl> + <nl> + argc = lua_gettop ( tolua_S ) - 1 ; <nl> + if ( argc = = 0 ) <nl> + { <nl> + if ( ! ok ) <nl> + { <nl> + tolua_error ( tolua_S , " invalid arguments in function ' lua_cocos2dx_ui_Slider_getMaxPercent ' " , nullptr ) ; <nl> + return 0 ; <nl> + } <nl> + int ret = cobj - > getMaxPercent ( ) ; <nl> + tolua_pushnumber ( tolua_S , ( lua_Number ) ret ) ; <nl> + return 1 ; <nl> + } <nl> + luaL_error ( tolua_S , " % s has wrong number of arguments : % d , was expecting % d \ n " , " ccui . Slider : getMaxPercent " , argc , 0 ) ; <nl> + return 0 ; <nl> + <nl> + # if COCOS2D_DEBUG > = 1 <nl> + tolua_lerror : <nl> + tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_Slider_getMaxPercent ' . " , & tolua_err ) ; <nl> + # endif <nl> + <nl> + return 0 ; <nl> + } <nl> int lua_cocos2dx_ui_Slider_loadSlidBallTextureNormal ( lua_State * tolua_S ) <nl> { <nl> int argc = 0 ; <nl> int lua_register_cocos2dx_ui_Slider ( lua_State * tolua_S ) <nl> <nl> tolua_beginmodule ( tolua_S , " Slider " ) ; <nl> tolua_function ( tolua_S , " new " , lua_cocos2dx_ui_Slider_constructor ) ; <nl> + tolua_function ( tolua_S , " setMaxPercent " , lua_cocos2dx_ui_Slider_setMaxPercent ) ; <nl> tolua_function ( tolua_S , " setPercent " , lua_cocos2dx_ui_Slider_setPercent ) ; <nl> tolua_function ( tolua_S , " loadSlidBallTextureDisabled " , lua_cocos2dx_ui_Slider_loadSlidBallTextureDisabled ) ; <nl> + tolua_function ( tolua_S , " getMaxPercent " , lua_cocos2dx_ui_Slider_getMaxPercent ) ; <nl> tolua_function ( tolua_S , " loadSlidBallTextureNormal " , lua_cocos2dx_ui_Slider_loadSlidBallTextureNormal ) ; <nl> tolua_function ( tolua_S , " loadBarTexture " , lua_cocos2dx_ui_Slider_loadBarTexture ) ; <nl> tolua_function ( tolua_S , " loadProgressBarTexture " , lua_cocos2dx_ui_Slider_loadProgressBarTexture ) ; <nl> TOLUA_API int register_all_cocos2dx_ui ( lua_State * tolua_S ) <nl> lua_register_cocos2dx_ui_LoadingBar ( tolua_S ) ; <nl> lua_register_cocos2dx_ui_TextField ( tolua_S ) ; <nl> lua_register_cocos2dx_ui_Scale9Sprite ( tolua_S ) ; <nl> - lua_register_cocos2dx_ui_VBox ( tolua_S ) ; <nl> lua_register_cocos2dx_ui_RichElement ( tolua_S ) ; <nl> lua_register_cocos2dx_ui_RichElementCustomNode ( tolua_S ) ; <nl> + lua_register_cocos2dx_ui_VBox ( tolua_S ) ; <nl> lua_register_cocos2dx_ui_Slider ( tolua_S ) ; <nl> lua_register_cocos2dx_ui_ScrollView ( tolua_S ) ; <nl> lua_register_cocos2dx_ui_ListView ( tolua_S ) ; <nl> mmm a / cocos / scripting / lua - bindings / auto / lua_cocos2dx_ui_auto . hpp <nl> ppp b / cocos / scripting / lua - bindings / auto / lua_cocos2dx_ui_auto . hpp <nl> int register_all_cocos2dx_ui ( lua_State * tolua_S ) ; <nl> <nl> <nl> <nl> - <nl> - <nl> - <nl> - <nl> - <nl> - <nl> - <nl> - <nl> - <nl> <nl> <nl> <nl> | Merge pull request from CocosRobot / update_lua_bindings_1435919557 | cocos2d/cocos2d-x | 61c076eee90e9bea72a24c04cac51b6fc39f47c1 | 2015-07-03T10:37:59Z |
mmm a / src / IO / ReadHelpers . h <nl> ppp b / src / IO / ReadHelpers . h <nl> inline ReturnType readDateTimeTextImpl ( time_t & datetime , ReadBuffer & buf , cons <nl> static constexpr auto DateTimeStringInputSize = 19 ; <nl> bool optimistic_path_for_date_time_input = s + DateTimeStringInputSize < = buf . buffer ( ) . end ( ) ; <nl> <nl> - / / / YYYY - MM - DD <nl> - static constexpr auto DateStringInputSize = 10 ; <nl> - bool optimistic_path_for_date_input = s + DateStringInputSize < = buf . buffer ( ) . end ( ) ; <nl> - <nl> - if ( optimistic_path_for_date_time_input | | optimistic_path_for_date_input ) <nl> + if ( optimistic_path_for_date_time_input ) <nl> { <nl> if ( s [ 4 ] < ' 0 ' | | s [ 4 ] > ' 9 ' ) <nl> { <nl> inline ReturnType readDateTimeTextImpl ( time_t & datetime , ReadBuffer & buf , cons <nl> UInt8 month = ( s [ 5 ] - ' 0 ' ) * 10 + ( s [ 6 ] - ' 0 ' ) ; <nl> UInt8 day = ( s [ 8 ] - ' 0 ' ) * 10 + ( s [ 9 ] - ' 0 ' ) ; <nl> <nl> - UInt8 hour = 0 ; <nl> - UInt8 minute = 0 ; <nl> - UInt8 second = 0 ; <nl> - <nl> - if ( optimistic_path_for_date_time_input ) <nl> - { <nl> - hour = ( s [ 11 ] - ' 0 ' ) * 10 + ( s [ 12 ] - ' 0 ' ) ; <nl> - minute = ( s [ 14 ] - ' 0 ' ) * 10 + ( s [ 15 ] - ' 0 ' ) ; <nl> - second = ( s [ 17 ] - ' 0 ' ) * 10 + ( s [ 18 ] - ' 0 ' ) ; <nl> - } <nl> + UInt8 hour = ( s [ 11 ] - ' 0 ' ) * 10 + ( s [ 12 ] - ' 0 ' ) ; <nl> + UInt8 minute = ( s [ 14 ] - ' 0 ' ) * 10 + ( s [ 15 ] - ' 0 ' ) ; <nl> + UInt8 second = ( s [ 17 ] - ' 0 ' ) * 10 + ( s [ 18 ] - ' 0 ' ) ; <nl> <nl> if ( unlikely ( year = = 0 ) ) <nl> datetime = 0 ; <nl> else <nl> datetime = date_lut . makeDateTime ( year , month , day , hour , minute , second ) ; <nl> <nl> - buf . position ( ) + = optimistic_path_for_date_time_input ? DateTimeStringInputSize : DateStringInputSize ; <nl> + buf . position ( ) + = DateTimeStringInputSize ; <nl> return ReturnType ( true ) ; <nl> } <nl> else <nl> | Removed fast path for parsing DateTime in Date format | ClickHouse/ClickHouse | 240bbd2cd728c588f0218d1246b2262c43c4a644 | 2020-11-09T08:29:08Z |
mmm a / cocos / scripting / auto - generated <nl> ppp b / cocos / scripting / auto - generated <nl> @ @ - 1 + 1 @ @ <nl> - Subproject commit 877d9825d3c0df8e6bf565c90c4cfa8634c71ffa <nl> + Subproject commit 96129ccc8c55a5ad145581182e487da551e2103d <nl> | [ AUTO ] : updating submodule reference to latest autogenerated bindings | cocos2d/cocos2d-x | ff550bf8656dc4f948b7cf7b192f037afd16e665 | 2014-01-01T13:49:57Z |
mmm a / dbms / src / Interpreters / OptimizeIfChains . cpp <nl> ppp b / dbms / src / Interpreters / OptimizeIfChains . cpp <nl> namespace DB <nl> namespace ErrorCodes <nl> { <nl> extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH ; <nl> + extern const int UNEXPECTED_AST_STRUCTURE ; <nl> } <nl> <nl> void OptimizeIfChainsVisitor : : visit ( ASTPtr & current_ast ) <nl> { <nl> if ( ! current_ast ) <nl> - { <nl> return ; <nl> - } <nl> + <nl> for ( ASTPtr & child : current_ast - > children ) <nl> { <nl> - auto * function_node = child - > as < ASTFunction > ( ) ; <nl> + / / / Fallthrough cases <nl> + <nl> + const auto * function_node = child - > as < ASTFunction > ( ) ; <nl> + if ( ! function_node | | function_node - > name ! = " if " | | ! function_node - > arguments ) <nl> + { <nl> + visit ( child ) ; <nl> + continue ; <nl> + } <nl> <nl> - if ( ! function_node | | function_node - > name ! = " if " | | <nl> - ( ! function_node - > arguments - > as < ASTExpressionList > ( ) - > children [ 2 ] - > as < ASTFunction > ( ) | | <nl> - function_node - > arguments - > as < ASTExpressionList > ( ) - > children [ 2 ] - > as < ASTFunction > ( ) - > name ! = " if " ) ) <nl> + const auto * function_args = function_node - > arguments - > as < ASTExpressionList > ( ) ; <nl> + if ( ! function_args | | function_args - > children . size ( ) ! = 3 | | ! function_args - > children [ 2 ] ) <nl> { <nl> visit ( child ) ; <nl> continue ; <nl> } <nl> <nl> - auto chain = IfChain ( child ) ; <nl> - reverse ( chain . begin ( ) , chain . end ( ) ) ; <nl> + const auto * else_arg = function_args - > children [ 2 ] - > as < ASTFunction > ( ) ; <nl> + if ( ! else_arg | | else_arg - > name ! = " if " ) <nl> + { <nl> + visit ( child ) ; <nl> + continue ; <nl> + } <nl> + <nl> + / / / The case of : <nl> + / / / if ( cond , a , if ( . . . ) ) <nl> + <nl> + auto chain = ifChain ( child ) ; <nl> + std : : reverse ( chain . begin ( ) , chain . end ( ) ) ; <nl> child - > as < ASTFunction > ( ) - > name = " multiIf " ; <nl> child - > as < ASTFunction > ( ) - > arguments - > children = std : : move ( chain ) ; <nl> } <nl> } <nl> <nl> - ASTs OptimizeIfChainsVisitor : : IfChain ( ASTPtr & child ) <nl> + ASTs OptimizeIfChainsVisitor : : ifChain ( const ASTPtr & child ) <nl> { <nl> - auto * function_node = child - > as < ASTFunction > ( ) ; <nl> + const auto * function_node = child - > as < ASTFunction > ( ) ; <nl> + if ( ! function_node | | ! function_node - > arguments ) <nl> + throw Exception ( " Unexpected AST for function ' if ' " , ErrorCodes : : UNEXPECTED_AST_STRUCTURE ) ; <nl> <nl> - const auto * args = function_node - > arguments - > as < ASTExpressionList > ( ) ; <nl> + const auto * function_args = function_node - > arguments - > as < ASTExpressionList > ( ) ; <nl> <nl> - if ( args - > children . size ( ) ! = 3 ) <nl> - throw Exception ( " Wrong number of arguments for function ' if ' ( " + toString ( args - > children . size ( ) ) + " instead of 3 ) " , <nl> + if ( ! function_args | | function_args - > children . size ( ) ! = 3 ) <nl> + throw Exception ( " Wrong number of arguments for function ' if ' ( " + toString ( function_args - > children . size ( ) ) + " instead of 3 ) " , <nl> ErrorCodes : : NUMBER_OF_ARGUMENTS_DOESNT_MATCH ) ; <nl> <nl> - if ( args - > children [ 2 ] - > as < ASTFunction > ( ) & & args - > children [ 2 ] - > as < ASTFunction > ( ) - > name = = " if " ) <nl> + const auto * else_arg = function_args - > children [ 2 ] - > as < ASTFunction > ( ) ; <nl> + <nl> + / / / Recursively collect arguments from the innermost if ( " head - resursion " ) . <nl> + / / / Arguments will be returned in reverse order . <nl> + <nl> + if ( else_arg & & else_arg - > name = = " if " ) <nl> { <nl> - auto cur = IfChain ( function_node - > arguments - > children [ 2 ] ) ; <nl> + auto cur = ifChain ( function_node - > arguments - > children [ 2 ] ) ; <nl> cur . push_back ( function_node - > arguments - > children [ 1 ] ) ; <nl> cur . push_back ( function_node - > arguments - > children [ 0 ] ) ; <nl> return cur ; <nl> ASTs OptimizeIfChainsVisitor : : IfChain ( ASTPtr & child ) <nl> else <nl> { <nl> ASTs end ; <nl> + end . reserve ( 3 ) ; <nl> end . push_back ( function_node - > arguments - > children [ 2 ] ) ; <nl> end . push_back ( function_node - > arguments - > children [ 1 ] ) ; <nl> end . push_back ( function_node - > arguments - > children [ 0 ] ) ; <nl> mmm a / dbms / src / Interpreters / OptimizeIfChains . h <nl> ppp b / dbms / src / Interpreters / OptimizeIfChains . h <nl> <nl> # pragma once <nl> <nl> - # include < Interpreters / Aliases . h > <nl> + # include < Parsers / IAST . h > <nl> <nl> namespace DB <nl> { <nl> class OptimizeIfChainsVisitor <nl> { <nl> public : <nl> OptimizeIfChainsVisitor ( ) = default ; <nl> - <nl> void visit ( ASTPtr & ast ) ; <nl> <nl> - ASTs IfChain ( ASTPtr & child ) ; <nl> - <nl> + private : <nl> + ASTs ifChain ( const ASTPtr & child ) ; <nl> } ; <nl> <nl> } <nl> | Improvements , part 1 | ClickHouse/ClickHouse | 6540eda331f38e9d2d5a8069ab4384f329d01536 | 2019-12-30T22:24:19Z |
mmm a / doc / tutorials / calib3d / real_time_pose / real_time_pose . rst <nl> ppp b / doc / tutorials / calib3d / real_time_pose / real_time_pose . rst <nl> The application will have the followings parts : <nl> + Take input from Camera or Video . <nl> + Extract ORB features and descriptors from the scene . <nl> + Match scene descriptors with model descriptors using Flann matcher . <nl> - + Estimate pose using PnP + Ransac . <nl> - + Use Linear Kalman Filter to reject bad poses . <nl> + + Pose estimation using PnP + Ransac . <nl> + + Linear Kalman Filter for bad poses rejection . <nl> <nl> <nl> Theory <nl> Here is explained in detail the code for the real time application : <nl> <nl> * * 1 . Read 3D textured object model and object mesh . * * <nl> <nl> - In order to load the textured model I implemented the * class * * * Model * * which has the function * load ( ) * that opens a YAML file and take the stored 3D points with its corresponding descriptors . You can find an example of a 3D textured model in : file : ` samples / cpp / tutorial_code / calib3d / real_time_pose_estimation / Data / cookies_ORB . yml ` or : download : ` download from here < . / . . / . . / . . / samples / cpp / tutorial_code / calib3d / real_time_pose_estimation / Data / cookies_ORB . yml > ` . <nl> + In order to load the textured model I implemented the * class * * * Model * * which has the function * load ( ) * that opens a YAML file and take the stored 3D points with its corresponding descriptors . You can find an example of a 3D textured model in : file : ` samples / cpp / tutorial_code / calib3d / real_time_pose_estimation / Data / cookies_ORB . yml ` . <nl> <nl> . . code - block : : cpp <nl> <nl> In the main program the model is loaded as follows : <nl> <nl> <nl> <nl> - In order to read the model mesh I implemented a * class * * * Mesh * * which has a function * load ( ) * that opens a * . ply file and store the 3D points of the object and also the composed triangles . You can find an example of a model mesh in : file : ` samples / cpp / tutorial_code / calib3d / real_time_pose_estimation / Data / box . ply ` or : download : ` download from here < . / . . / . . / . . / samples / cpp / tutorial_code / calib3d / real_time_pose_estimation / Data / box . ply > ` . <nl> + In order to read the model mesh I implemented a * class * * * Mesh * * which has a function * load ( ) * that opens a : math : ` * ` . ply file and store the 3D points of the object and also the composed triangles . You can find an example of a model mesh in : file : ` samples / cpp / tutorial_code / calib3d / real_time_pose_estimation / Data / box . ply ` . <nl> <nl> . . code - block : : cpp <nl> <nl> In the main program the mesh is loaded as follows : <nl> <nl> * * 2 . Take input from Camera or Video * * <nl> <nl> - To detect is necessary capture video . It ' s done loading a recorded video by passing the absolute path where it is located in your machine or using the default camera device : <nl> + To detect is necessary capture video . It ' s done loading a recorded video by passing the absolute path where it is located in your machine or using the default camera device . In order to test the application you can find a recorded video in : file : ` samples / cpp / tutorial_code / calib3d / real_time_pose_estimation / Data / box . mp4 ` . <nl> <nl> . . code - block : : cpp <nl> <nl> The features and descriptors will be computed by the * RobustMatcher * inside the <nl> <nl> It is the first step in our detection algorithm . The main idea is to match the scene descriptors with our model descriptors in order to know the 3D coordinates of the found features into the current scene . <nl> <nl> - First , we have to set which matcher we want to use . In this case is used * FlannBased * matcher which in terms of computational cost is faster than the * BruteForce * matcher as we increase the trained collectction of features . Then , for FlannBased matcher the index created is * Multi - Probe LSH : Efficient Indexing for High - Dimensional Similarity Search * due to * ORB * descriptors are binary . <nl> + Firstly , we have to set which matcher we want to use . In this case is used * FlannBased * matcher which in terms of computational cost is faster than the * BruteForce * matcher as we increase the trained collectction of features . Then , for FlannBased matcher the index created is * Multi - Probe LSH : Efficient Indexing for High - Dimensional Similarity Search * due to * ORB * descriptors are binary . <nl> <nl> You can tune the * LSH * and search parameters to improve the matching efficiency : <nl> <nl> You can tune the * LSH * and search parameters to improve the matching efficiency : <nl> rmatcher . setDescriptorMatcher ( matcher ) ; / / set matcher <nl> <nl> <nl> - Secondly , we have to call the matcher by using * robustMatch ( ) * or * fastRobustMatch ( ) * function . The difference of using this two functions is its computational cost . The first method is slower but more robust at filtering good matches due to that uses two ratio test and a symmetry test . In contrast , the second method is faster but less robust due to that only applies a single ratio test to the matches . <nl> + Secondly , we have to call the matcher by using * robustMatch ( ) * or * fastRobustMatch ( ) * function . The difference of using this two functions is its computational cost . The first method is slower but more robust at filtering good matches because uses two ratio test and a symmetry test . In contrast , the second method is faster but less robust because only applies a single ratio test to the matches . <nl> <nl> The following code is to get the model 3D points and its descriptors and then call the matcher in the main program : <nl> <nl> The following code is to get the model 3D points and its descriptors and then ca <nl> rmatcher . robustMatch ( frame , good_matches , keypoints_scene , descriptors_model ) ; <nl> } <nl> <nl> - The following code corresponds to the * robustMatch ( ) * function which belongs to the * RobustMatcher * class . This function uses the given image to detect the keypoints and extract the descriptors , match using * 2 Nearest Neighbour * the extracted descriptors with the given model descriptors and vice versa . Then , is applied a ratio test to the two direction matches in order to remove these matches which its distance ratio between the first and second best match is larger than a given threshold . Finally , a symmetry test is applied in order the remove non symmetrical matches . <nl> + The following code corresponds to the * robustMatch ( ) * function which belongs to the * RobustMatcher * class . This function uses the given image to detect the keypoints and extract the descriptors , match using * two Nearest Neighbour * the extracted descriptors with the given model descriptors and vice versa . Then , a ratio test is applied to the two direction matches in order to remove these matches which its distance ratio between the first and second best match is larger than a given threshold . Finally , a symmetry test is applied in order the remove non symmetrical matches . <nl> <nl> . . code - block : : cpp <nl> <nl> The following code corresponds to the * robustMatch ( ) * function which belongs to <nl> <nl> } <nl> <nl> - After the matches filtering we have to get the 2D an 3D correspondences using the obtained * DMatches * vector . For more information about : core : ` DMatch < dmatch > ` check the documentation . <nl> + After the matches filtering we have to subtract the 2D and 3D correspondences from the found scene keypoints and our 3D model using the obtained * DMatches * vector . For more information about : core : ` DMatch < dmatch > ` check the documentation . <nl> <nl> . . code - block : : cpp <nl> <nl> After the matches filtering we have to get the 2D an 3D correspondences using th <nl> } <nl> <nl> <nl> - * * 5 . Estimate pose using PnP + Ransac * * <nl> + * * 5 . Pose estimation using PnP + Ransac * * <nl> <nl> - With the 2D and 3D correspondences we have to apply the PnP algorithm using : calib3d : ` solvePnPRansac ( ) < solvepnpransac > ` function in order to estimate the camera pose . The reason why we have to use : calib3d : ` solvePnPRansac ( ) < solvepnpransac > ` instead of : calib3d : ` solvePnP ( ) < solvepnp > ` is due to the fact that after the matching not all the found correspondences are correct and may be there are bad correspondences or also called * outliers * . The ` Random Sample Consensus < http : / / en . wikipedia . org / wiki / RANSAC > ` _ or * Ransac * is a non - deterministic iterative method which estimate parameters of a mathematical model from observed data producing an aproximate result as the number of iterations increase . After appyling * Ransac * all these * outliers * will be eliminated to then estimate the camera pose with a certain probability . <nl> + Once with the 2D and 3D correspondences we have to apply the PnP algorithm using : calib3d : ` solvePnPRansac < solvepnpransac > ` function in order to estimate the camera pose . The reason why we have to use : calib3d : ` solvePnPRansac < solvepnpransac > ` instead of : calib3d : ` solvePnP < solvepnp > ` is due to the fact that after the matching not all the found correspondences are correct and , as like as not , there are false correspondences or also called * outliers * . The ` Random Sample Consensus < http : / / en . wikipedia . org / wiki / RANSAC > ` _ or * Ransac * is a non - deterministic iterative method which estimate parameters of a mathematical model from observed data producing an aproximate result as the number of iterations increase . After appyling * Ransac * all the * outliers * will be eliminated to then estimate the camera pose with a certain probability to obtain a good solution . <nl> <nl> - For the camera pose estimation I have implemented a * class * * * PnPProblem * * . This * class * has 4 atributes : a given calibration matrix , the rotation matrix , the translation matrix and the rotation - translation matrix . To declare it we need the intrinsic calibration parameters of the camera which you will use to estimate the pose . To obtain these parameters you can check : ref : ` CameraCalibrationSquareChessBoardTutorial ` and : ref : ` cameraCalibrationOpenCV ` tutorials . <nl> + For the camera pose estimation I have implemented a * class * * * PnPProblem * * . This * class * has 4 atributes : a given calibration matrix , the rotation matrix , the translation matrix and the rotation - translation matrix . The intrinsic calibration parameters of the camera which you are using to estimate the pose are necessary . In order to obtain the parameters you can check : ref : ` CameraCalibrationSquareChessBoardTutorial ` and : ref : ` cameraCalibrationOpenCV ` tutorials . <nl> <nl> The following code is how to declare the * PnPProblem class * in the main program : <nl> <nl> The following code is how the * PnPProblem class * initialises its atributes : <nl> <nl> } <nl> <nl> - OpenCV provides four PnP methods : ITERATIVE , EPNP , P3P and ? . If we want a real time time application the more suitable methods are EPNP and P3P due to are faster than ITERATIVE finding a solution . Otherwise , EPNP and P3P are not robust especially in front of planar surfaces and sometimes the pose estimation seems to have like a mirror effect . Therefore , in this this tutorial is used ITERATIVE method due to the object to be detected has planar surfaces . <nl> + OpenCV provides four PnP methods : ITERATIVE , EPNP , P3P and DLS . Depending on the application that we want , the estimation method will be different . In the case that we want a real time time application the more suitable methods are EPNP and P3P due to that are faster than ITERATIVE and DLS at finding an optimal solution . Otherwise , EPNP and P3P are not especially robust in front of planar surfaces and sometimes the pose estimation seems to have like a mirror effect . Therefore , in this this tutorial is used ITERATIVE method due to the object to be detected has planar surfaces . <nl> <nl> The OpenCV Ransac implementation wants you to provide three parameters : the maximum number of iterations until stop the algorithm , the maximum allowed distance between the observed and computed point projections to consider it an inlier and the confidence to obtain a result . You can tune these paramaters in order to improve your algorithm performance . Increasing the number of iterations you will have a more accurate solution , but will take more time to find a solution . Increasing the reprojection error will reduce the computation time , but your solution will be unaccurate . Decreasing the confidence your arlgorithm will be faster , but the obtained solution will also be unaccurate . <nl> <nl> - The following parameters works for this application : <nl> + The following parameters work for this application : <nl> <nl> . . code - block : : cpp <nl> <nl> The following code corresponds to the * estimatePoseRANSAC ( ) * function which belo <nl> <nl> } <nl> <nl> - In the following code are the 3th and 4th steps of the main algorithm . The first , calling the above function and the second taking the output inliers vector from Ransac to get the 2D scene points for drawing purpose . As seen in the code we must be sure to apply Ransac if we have matches , in the other case , the function : calib3d : ` solvePnPRansac ( ) < solvepnpransac > ` crashes due to some OpenCV * bug * . <nl> + In the following code are the 3th and 4th steps of the main algorithm . The first , calling the above function and the second taking the output inliers vector from Ransac to get the 2D scene points for drawing purpose . As seen in the code we must be sure to apply Ransac if we have matches , in the other case , the function : calib3d : ` solvePnPRansac < solvepnpransac > ` crashes due to any OpenCV * bug * . <nl> <nl> . . code - block : : cpp <nl> <nl> In the following code are the 3th and 4th steps of the main algorithm . The first <nl> <nl> Finally , once the camera pose has been estimated we can use the : math : ` R ` and : math : ` t ` in order to compute the 2D projection onto the image of a given 3D point expressed in a world reference frame using the showed formula on * Theory * . <nl> <nl> - The following code corresponds to the * backproject3DPoint ( ) * function which belongs to the * PnPProblem class * . This function backproject a given 3D point expressed in a world reference frame onto a 2D image : <nl> + The following code corresponds to the * backproject3DPoint ( ) * function which belongs to the * PnPProblem class * . The function backproject a given 3D point expressed in a world reference frame onto a 2D image : <nl> <nl> . . code - block : : cpp <nl> <nl> The following code corresponds to the * backproject3DPoint ( ) * function which belo <nl> return point2d ; <nl> } <nl> <nl> - The above function then is used to compute all the 3D points of the object * Mesh * to show the pose of the object . <nl> + The above function is used to compute all the 3D points of the object * Mesh * to show the pose of the object . <nl> <nl> <nl> - * * 6 . Use Linear Kalman Filter to reject bad poses * * <nl> + * * 6 . Linear Kalman Filter for bad poses rejection * * <nl> <nl> - Is it common in computer vision or robotics fields that after applying detection or tracking techniques bad results are obtained due to some sensor errors . In order to avoid these bad detections in this tutorialis explained how to implement a Linear Kalman Filter after getting a good pose estimation . The definition of a good pose is arbitrary , so here we will define good pose as a detection with high number of inliers . <nl> + Is it common in computer vision or robotics fields that after applying detection or tracking techniques , bad results are obtained due to some sensor errors . In order to avoid these bad detections in this tutorial is explained how to implement a Linear Kalman Filter . The Kalman Filter will be applied after detected a given number of inliers . <nl> <nl> You can find more information about what ` Kalman Filter < http : / / en . wikipedia . org / wiki / Kalman_filter > ` _ is . In this tutorial it ' s used the OpenCV implementation of the : video : ` Kalman Filter < kalmanfilter > ` based on ` Linear Kalman Filter for position and orientation tracking < http : / / campar . in . tum . de / Chair / KalmanFilter > ` _ to set the dynamics and measurement models . <nl> <nl> - First , we have to define our state vector which will have 18 states : the positional data ( x , y , z ) with its first and second derivatives ( velocity and acceleration ) , then rotation is added in form of three euler angles ( roll , pitch , jaw ) together with their first and second derivatives ( angular velocity and acceleration ) <nl> + Firstly , we have to define our state vector which will have 18 states : the positional data ( x , y , z ) with its first and second derivatives ( velocity and acceleration ) , then rotation is added in form of three euler angles ( roll , pitch , jaw ) together with their first and second derivatives ( angular velocity and acceleration ) <nl> <nl> . . math : : <nl> <nl> X = ( x , y , z , \ dot x , \ dot y , \ dot z , \ ddot x , \ ddot y , \ ddot z , \ psi , \ theta , \ phi , \ dot \ psi , \ dot \ theta , \ dot \ phi , \ ddot \ psi , \ ddot \ theta , \ ddot \ phi ) ^ T <nl> <nl> - Secondly , we have to define the number of measuremnts which will be 6 : from : math : ` R ` and : math : ` t ` we can extract : math : ` ( x , y , z ) ` and : math : ` ( \ psi , \ theta , \ phi ) ` . Thirdly , we have t define the number of control actions to apply to the system which in this case will be * zero * . Finally , we have to define the differential time between the measurements which in this case is : math : ` 1 / T ` , where * T * is the frame rate of the video . <nl> + Secondly , we have to define the number of measuremnts which will be 6 : from : math : ` R ` and : math : ` t ` we can extract : math : ` ( x , y , z ) ` and : math : ` ( \ psi , \ theta , \ phi ) ` . In addition , we have to define the number of control actions to apply to the system which in this case will be * zero * . Finally , we have to define the differential time between measurements which in this case is : math : ` 1 / T ` , where * T * is the frame rate of the video . <nl> <nl> . . code - block : : cpp <nl> <nl> Secondly , we have to define the number of measuremnts which will be 6 : from : mat <nl> initKalmanFilter ( KF , nStates , nMeasurements , nInputs , dt ) ; / / init function <nl> <nl> <nl> - The following code corresponds to the Kalman Filter initialisation . First , is set the process noise , the measurement noise and the error covariance matrix . Secondly , are set the transition matrix which is the dynamic model and then the measurement matrix which is the measurement model . <nl> + The following code corresponds to the Kalman Filter initialisation . Firstly , is set the process noise , the measurement noise and the error covariance matrix . Secondly , are set the transition matrix which is the dynamic model and finally the measurement matrix , which is the measurement model . <nl> <nl> - You can tune the process and measurement noise to improve the Kalman Filter performance . As you reduce the measurement noise the faster will converge but will be more sensible in front of bad measurements . <nl> + You can tune the process and measurement noise to improve the Kalman Filter performance . As the measurement noise is reduced the faster will converge doing the algorithm sensitive in front of bad measurements . <nl> <nl> . . code - block : : cpp <nl> <nl> You can tune the process and measurement noise to improve the Kalman Filter perf <nl> <nl> } <nl> <nl> - In the following code is 5th step of the main algorithm . When the obtained number of inliers after * Ransac * is over the threshold , the measurements matrix is filled and then the Kalman Filter is updated : <nl> + In the following code is the 5th step of the main algorithm . When the obtained number of inliers after * Ransac * is over the threshold , the measurements matrix is filled and then the Kalman Filter is updated : <nl> <nl> . . code - block : : cpp <nl> <nl> The last and optional step is draw the found pose . To do it I implemented a func <nl> Results <nl> = = = = = = = <nl> <nl> - The following videos are the results of pose estimation in real time using the explained detection algorithm with the following parameters : <nl> + The following videos are the results of pose estimation in real time using the explained detection algorithm using the following parameters : <nl> <nl> . . code - block : : cpp <nl> <nl> The following videos are the results of pose estimation in real time using the e <nl> int minInliersKalman = 30 ; / / Kalman threshold updating <nl> <nl> <nl> + You can watch the real time pose estimation on the ` YouTube here < https : / / www . youtube . com / watch ? v = msFFuHsiUns > ` _ . <nl> + <nl> + <nl> . . raw : : html <nl> <nl> < div align = " center " > <nl> - < iframe width = " 560 " height = " 315 " src = " / / www . youtube . com / embed / msFFuHsiUns ? rel = 0 " frameborder = " 0 " allowfullscreen > < / iframe > <nl> + < iframe > < / iframe > <nl> < / div > <nl> <nl> - <nl> + < div align = " center " > <nl> + < iframe title = " Pose estimation for the Google Summer Code 2014 using OpenCV libraries . " width = " 560 " height = " 349 " src = " http : / / www . youtube . com / embed / msFFuHsiUns ? rel = 0 & loop = 1 " frameborder = " 0 " allowfullscreen align = " middle " > < / iframe > <nl> + < / div > <nl> | Update some text | opencv/opencv | 9a25cb012d831d9887bac74ed18a324a90030732 | 2014-07-30T15:05:06Z |
mmm a / stdlib / public / core / ClosedRange . swift <nl> ppp b / stdlib / public / core / ClosedRange . swift <nl> public struct CountableClosedRange < Bound > : RandomAccessCollection <nl> case . pastEnd : <nl> if n = = 0 { <nl> return i <nl> - } else if n > 0 { <nl> - _preconditionFailure ( " Advancing past end index " ) <nl> - } else { <nl> + } <nl> + if n < 0 { <nl> return index ( ClosedRangeIndex ( upperBound ) , offsetBy : ( n + 1 ) ) <nl> } <nl> + _preconditionFailure ( " Advancing past end index " ) <nl> } <nl> } <nl> <nl> | [ stdlib ] Refactor logic for . pastEnd index check . ( ) | apple/swift | 731df181eb01496cb17f045ff9b06e62b0e1b3aa | 2016-09-23T22:33:53Z |
mmm a / runtime / shared / index . js <nl> ppp b / runtime / shared / index . js <nl> if ( ! process . env . SUPPORT_ES2015 ) { <nl> require ( ' . / polyfill / objectAssign ' ) <nl> require ( ' . / polyfill / objectSetPrototypeOf ' ) <nl> <nl> - / / import promise hack and polyfills <nl> - require ( ' . / polyfill / promise ' ) <nl> - require ( ' core - js / modules / es6 . object . to - string ' ) <nl> - require ( ' core - js / modules / es6 . string . iterator ' ) <nl> - require ( ' core - js / modules / web . dom . iterable ' ) <nl> - require ( ' core - js / modules / es6 . promise ' ) <nl> + / / eslint - disable - next - line <nl> + if ( typeof WXEnvironment = = = ' undefined ' | | ! WXEnvironment . __enable_native_promise__ ) { <nl> + / / import promise hack and polyfill <nl> + require ( ' . / polyfill / promise ' ) <nl> + require ( ' core - js / modules / es6 . object . to - string ' ) <nl> + require ( ' core - js / modules / es6 . string . iterator ' ) <nl> + require ( ' core - js / modules / web . dom . iterable ' ) <nl> + require ( ' core - js / modules / es6 . promise ' ) <nl> + } <nl> } <nl> <nl> export * from ' . / env / console ' <nl> mmm a / runtime / shared / polyfill / promise . js <nl> ppp b / runtime / shared / polyfill / promise . js <nl> <nl> const { WXEnvironment } = global <nl> <nl> / * istanbul ignore next * / <nl> - if ( WXEnvironment & & WXEnvironment . platform = = = ' iOS ' ) { <nl> + if ( typeof WXEnvironment ! = = ' undefined ' <nl> + & & WXEnvironment . platform = = = ' iOS ' <nl> + & & ! WXEnvironment . __enable_native_promise__ ) { <nl> global . Promise = undefined <nl> } <nl> | [ jsfm ] decide whether to use promise polyfill by environment variable ( ) | apache/incubator-weex | 77b00acb4d5f21237354575fd857c5b0e75e4d29 | 2018-10-02T07:35:17Z |
mmm a / tensorflow / compiler / xla / service / gpu / BUILD <nl> ppp b / tensorflow / compiler / xla / service / gpu / BUILD <nl> cc_library ( <nl> <nl> cc_library ( <nl> name = " cudnn_conv_runner " , <nl> - srcs = [ " cudnn_conv_runner . cc " ] , <nl> - hdrs = [ " cudnn_conv_runner . h " ] , <nl> + srcs = [ " gpu_conv_runner . cc " ] , <nl> + hdrs = [ " gpu_conv_runner . h " ] , <nl> deps = [ <nl> " : backend_configs " , <nl> " : ir_emission_utils " , <nl> mmm a / tensorflow / compiler / xla / service / gpu / backend_configs . proto <nl> ppp b / tensorflow / compiler / xla / service / gpu / backend_configs . proto <nl> message CudnnConvBackendConfig { <nl> double conv_result_scale = 4 ; <nl> <nl> / / Below are the fields related to cuDNN ' s fused convolution . Refer to <nl> - / / CudnnConvParams for their meanings . <nl> + / / GpuConvParams for their meanings . <nl> <nl> / / The requested activation ( e . g . relu ) after the convolution . It is with type <nl> / / stream_executor : : dnn : : ActivationMode . <nl> mmm a / tensorflow / compiler / xla / service / gpu / convolution_thunk . cc <nl> ppp b / tensorflow / compiler / xla / service / gpu / convolution_thunk . cc <nl> limitations under the License . <nl> # include < string > <nl> <nl> # include " absl / strings / str_cat . h " <nl> - # include " tensorflow / compiler / xla / service / gpu / cudnn_conv_runner . h " <nl> + # include " tensorflow / compiler / xla / service / gpu / gpu_conv_runner . h " <nl> # include " tensorflow / compiler / xla / service / gpu / hlo_execution_profiler . h " <nl> # include " tensorflow / compiler / xla / service / gpu / ir_emission_utils . h " <nl> # include " tensorflow / compiler / xla / types . h " <nl> Status ConvolutionThunk : : ExecuteOnStream ( const ExecuteParams & params ) { <nl> <nl> auto op_profiler = <nl> params . profiler - > MakeScopedInstructionProfiler ( hlo_instruction ( ) ) ; <nl> - TF_RETURN_IF_ERROR ( RunCudnnConv ( cudnn_call_ , <nl> - absl : : MakeSpan ( operand_se_buffers ) , <nl> - result_buffer , scratch , params . stream ) ) ; <nl> + TF_RETURN_IF_ERROR ( RunGpuConv ( cudnn_call_ , absl : : MakeSpan ( operand_se_buffers ) , <nl> + result_buffer , scratch , params . stream ) ) ; <nl> <nl> / / Write the output tuple . <nl> const int kNumOutputs = 2 ; <nl> mmm a / tensorflow / compiler / xla / service / gpu / convolution_thunk . h <nl> ppp b / tensorflow / compiler / xla / service / gpu / convolution_thunk . h <nl> limitations under the License . <nl> # include " absl / types / optional . h " <nl> # include " tensorflow / compiler / xla / service / buffer_assignment . h " <nl> # include " tensorflow / compiler / xla / service / gpu / buffer_allocations . h " <nl> - # include " tensorflow / compiler / xla / service / gpu / cudnn_conv_runner . h " <nl> + # include " tensorflow / compiler / xla / service / gpu / gpu_conv_runner . h " <nl> # include " tensorflow / compiler / xla / service / gpu / gpu_executable . h " <nl> # include " tensorflow / compiler / xla / service / gpu / hlo_execution_profiler . h " <nl> # include " tensorflow / compiler / xla / service / gpu / thunk . h " <nl> mmm a / tensorflow / compiler / xla / service / gpu / cudnn_conv_algorithm_picker . cc <nl> ppp b / tensorflow / compiler / xla / service / gpu / cudnn_conv_algorithm_picker . cc <nl> StatusOr < AutotuneResult > CudnnConvAlgorithmPicker : : PickBestAlgorithmNoCache ( <nl> options . profile_result = & profile_result ; <nl> options . algo_override = alg ; <nl> Status launch_status = <nl> - RunCudnnConv ( instr , absl : : MakeSpan ( operand_buffers ) , result_buffer , <nl> - & scratch_allocator , stream , options ) ; <nl> + RunGpuConv ( instr , absl : : MakeSpan ( operand_buffers ) , result_buffer , <nl> + & scratch_allocator , stream , options ) ; <nl> <nl> if ( ! launch_status . ok ( ) ) { <nl> continue ; <nl> mmm a / tensorflow / compiler / xla / service / gpu / cudnn_conv_algorithm_picker . h <nl> ppp b / tensorflow / compiler / xla / service / gpu / cudnn_conv_algorithm_picker . h <nl> limitations under the License . <nl> # include " absl / time / time . h " <nl> # include " absl / types / optional . h " <nl> # include " tensorflow / compiler / xla / service / compiler . h " <nl> - # include " tensorflow / compiler / xla / service / gpu / cudnn_conv_runner . h " <nl> + # include " tensorflow / compiler / xla / service / gpu / gpu_conv_runner . h " <nl> # include " tensorflow / compiler / xla / service / hlo_instructions . h " <nl> # include " tensorflow / compiler / xla / service / hlo_module . h " <nl> # include " tensorflow / compiler / xla / service / hlo_pass_interface . h " <nl> mmm a / tensorflow / compiler / xla / service / gpu / gemm_algorithm_picker . h <nl> ppp b / tensorflow / compiler / xla / service / gpu / gemm_algorithm_picker . h <nl> limitations under the License . <nl> # define TENSORFLOW_COMPILER_XLA_SERVICE_GPU_GEMM_ALGORITHM_PICKER_H_ <nl> <nl> # include " absl / types / optional . h " <nl> - # include " tensorflow / compiler / xla / service / gpu / cudnn_conv_runner . h " <nl> + # include " tensorflow / compiler / xla / service / gpu / gpu_conv_runner . h " <nl> # include " tensorflow / compiler / xla / service / hlo_instructions . h " <nl> # include " tensorflow / compiler / xla / service / hlo_module . h " <nl> # include " tensorflow / compiler / xla / service / hlo_pass_interface . h " <nl> similarity index 79 % <nl> rename from tensorflow / compiler / xla / service / gpu / cudnn_conv_runner . cc <nl> rename to tensorflow / compiler / xla / service / gpu / gpu_conv_runner . cc <nl> mmm a / tensorflow / compiler / xla / service / gpu / cudnn_conv_runner . cc <nl> ppp b / tensorflow / compiler / xla / service / gpu / gpu_conv_runner . cc <nl> See the License for the specific language governing permissions and <nl> limitations under the License . <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = * / <nl> <nl> - # include " tensorflow / compiler / xla / service / gpu / cudnn_conv_runner . h " <nl> + # include " tensorflow / compiler / xla / service / gpu / gpu_conv_runner . h " <nl> <nl> # include " absl / strings / str_cat . h " <nl> # include " tensorflow / compiler / xla / layout_util . h " <nl> class ScratchBufAllocator : public se : : ScratchAllocator { <nl> } ; <nl> <nl> template < typename ElementType , typename OutputType > <nl> - Status RunCudnnConvForward ( CudnnConvParams params , <nl> - se : : ScratchAllocator * scratch_allocator , <nl> - se : : Stream * stream , RunConvOptions options , <nl> - DeviceMemory < ElementType > input_buf , <nl> - DeviceMemory < ElementType > filter_buf , <nl> - DeviceMemory < OutputType > output_buf , <nl> - AlgorithmConfig algorithm ) { <nl> + Status RunGpuConvForward ( GpuConvParams params , <nl> + se : : ScratchAllocator * scratch_allocator , <nl> + se : : Stream * stream , RunConvOptions options , <nl> + DeviceMemory < ElementType > input_buf , <nl> + DeviceMemory < ElementType > filter_buf , <nl> + DeviceMemory < OutputType > output_buf , <nl> + AlgorithmConfig algorithm ) { <nl> if ( params . conv_result_scale ! = 1 ) { <nl> return InternalError ( <nl> " StreamExecutor doesn ' t support scaled convolution : % lf . " , <nl> Status RunCudnnConvForward ( CudnnConvParams params , <nl> } <nl> <nl> template < typename ElementType , typename BiasType , typename OutputType > <nl> - Status RunCudnnConvForwardActivation ( CudnnConvParams params , <nl> - se : : ScratchAllocator * scratch_allocator , <nl> - se : : Stream * stream , RunConvOptions options , <nl> - DeviceMemory < ElementType > input_buf , <nl> - DeviceMemory < ElementType > filter_buf , <nl> - DeviceMemory < OutputType > output_buf , <nl> - AlgorithmConfig algorithm ) { <nl> + Status RunGpuConvForwardActivation ( GpuConvParams params , <nl> + se : : ScratchAllocator * scratch_allocator , <nl> + se : : Stream * stream , RunConvOptions options , <nl> + DeviceMemory < ElementType > input_buf , <nl> + DeviceMemory < ElementType > filter_buf , <nl> + DeviceMemory < OutputType > output_buf , <nl> + AlgorithmConfig algorithm ) { <nl> BatchDescriptor bias_desc ; <nl> bias_desc . set_count ( 1 ) <nl> . set_height ( 1 ) <nl> Status RunCudnnConvForwardActivation ( CudnnConvParams params , <nl> template < typename ElementType , typename BiasType , typename OutputType , <nl> typename std : : enable_if < <nl> ! std : : is_integral < ElementType > : : value > : : type * = nullptr > <nl> - Status RunCudnnConvInternalImpl ( CudnnConvParams params , <nl> - se : : ScratchAllocator * scratch_allocator , <nl> - se : : Stream * stream , RunConvOptions options , <nl> - DeviceMemory < ElementType > input_buf , <nl> - DeviceMemory < ElementType > filter_buf , <nl> - DeviceMemory < OutputType > output_buf , <nl> - AlgorithmConfig algorithm ) { <nl> + Status RunGpuConvInternalImpl ( GpuConvParams params , <nl> + se : : ScratchAllocator * scratch_allocator , <nl> + se : : Stream * stream , RunConvOptions options , <nl> + DeviceMemory < ElementType > input_buf , <nl> + DeviceMemory < ElementType > filter_buf , <nl> + DeviceMemory < OutputType > output_buf , <nl> + AlgorithmConfig algorithm ) { <nl> switch ( params . kind ) { <nl> case CudnnConvKind : : kForward : <nl> - return RunCudnnConvForward ( params , scratch_allocator , stream , options , <nl> - input_buf , filter_buf , output_buf , algorithm ) ; <nl> + return RunGpuConvForward ( params , scratch_allocator , stream , options , <nl> + input_buf , filter_buf , output_buf , algorithm ) ; <nl> case CudnnConvKind : : kBackwardInput : <nl> if ( params . conv_result_scale ! = 1 ) { <nl> return InternalError ( <nl> Status RunCudnnConvInternalImpl ( CudnnConvParams params , <nl> scratch_allocator , algorithm , options . profile_result ) ; <nl> break ; <nl> case CudnnConvKind : : kForwardActivation : { <nl> - return RunCudnnConvForwardActivation < ElementType , BiasType , OutputType > ( <nl> + return RunGpuConvForwardActivation < ElementType , BiasType , OutputType > ( <nl> params , scratch_allocator , stream , options , input_buf , filter_buf , <nl> output_buf , algorithm ) ; <nl> } <nl> Status RunCudnnConvInternalImpl ( CudnnConvParams params , <nl> template < typename ElementType , typename BiasType , typename OutputType , <nl> typename std : : enable_if < std : : is_integral < ElementType > : : value > : : type * = <nl> nullptr > <nl> - Status RunCudnnConvInternalImpl ( CudnnConvParams params , <nl> - se : : ScratchAllocator * scratch_allocator , <nl> - se : : Stream * stream , RunConvOptions options , <nl> - DeviceMemory < ElementType > input_buf , <nl> - DeviceMemory < ElementType > filter_buf , <nl> - DeviceMemory < OutputType > output_buf , <nl> - AlgorithmConfig algorithm ) { <nl> + Status RunGpuConvInternalImpl ( GpuConvParams params , <nl> + se : : ScratchAllocator * scratch_allocator , <nl> + se : : Stream * stream , RunConvOptions options , <nl> + DeviceMemory < ElementType > input_buf , <nl> + DeviceMemory < ElementType > filter_buf , <nl> + DeviceMemory < OutputType > output_buf , <nl> + AlgorithmConfig algorithm ) { <nl> switch ( params . kind ) { <nl> case CudnnConvKind : : kForward : <nl> - return RunCudnnConvForward ( params , scratch_allocator , stream , options , <nl> - input_buf , filter_buf , output_buf , algorithm ) ; <nl> + return RunGpuConvForward ( params , scratch_allocator , stream , options , <nl> + input_buf , filter_buf , output_buf , algorithm ) ; <nl> case CudnnConvKind : : kForwardActivation : <nl> - return RunCudnnConvForwardActivation < ElementType , BiasType , OutputType > ( <nl> + return RunGpuConvForwardActivation < ElementType , BiasType , OutputType > ( <nl> params , scratch_allocator , stream , options , input_buf , filter_buf , <nl> output_buf , algorithm ) ; <nl> default : <nl> Status RunCudnnConvInternalImpl ( CudnnConvParams params , <nl> } <nl> <nl> template < typename ElementType , typename BiasType , typename OutputType > <nl> - Status RunCudnnConvImpl ( const CudnnConvParams & params , <nl> - se : : ScratchAllocator * scratch_allocator , <nl> - se : : Stream * stream , RunConvOptions options ) { <nl> + Status RunGpuConvImpl ( const GpuConvParams & params , <nl> + se : : ScratchAllocator * scratch_allocator , <nl> + se : : Stream * stream , RunConvOptions options ) { <nl> auto input_buf = se : : DeviceMemory < ElementType > ( params . input_buf ) ; <nl> auto filter_buf = se : : DeviceMemory < ElementType > ( params . filter_buf ) ; <nl> auto output_buf = se : : DeviceMemory < OutputType > ( params . output_buf ) ; <nl> Status RunCudnnConvImpl ( const CudnnConvParams & params , <nl> algorithm = AlgorithmConfig ( * options . algo_override ) ; <nl> } <nl> <nl> - Status run_status = <nl> - RunCudnnConvInternalImpl < ElementType , BiasType , OutputType > ( <nl> - params , scratch_allocator , stream , options , input_buf , filter_buf , <nl> - output_buf , algorithm ) ; <nl> + Status run_status = RunGpuConvInternalImpl < ElementType , BiasType , OutputType > ( <nl> + params , scratch_allocator , stream , options , input_buf , filter_buf , <nl> + output_buf , algorithm ) ; <nl> <nl> if ( run_status ! = Status : : OK ( ) ) { <nl> return run_status ; <nl> Status RunCudnnConvImpl ( const CudnnConvParams & params , <nl> <nl> } / / anonymous namespace <nl> <nl> - StatusOr < CudnnConvParams > GetCudnnConvParams ( <nl> + StatusOr < GpuConvParams > GetGpuConvParams ( <nl> const HloCustomCallInstruction * conv , <nl> absl : : Span < se : : DeviceMemoryBase > operand_buffers , <nl> se : : DeviceMemoryBase result_buffer ) { <nl> - CudnnConvParams params ; <nl> + GpuConvParams params ; <nl> <nl> TF_ASSIGN_OR_RETURN ( CudnnConvBackendConfig backend_config , <nl> conv - > backend_config < CudnnConvBackendConfig > ( ) ) ; <nl> StatusOr < CudnnConvParams > GetCudnnConvParams ( <nl> filter_shape = & conv - > operand ( 1 ) - > shape ( ) ; <nl> output_shape = & conv - > shape ( ) . tuple_shapes ( 0 ) ; <nl> params . fusion . emplace ( ) ; <nl> - CudnnConvParams : : FusionParams & fusion = * params . fusion ; <nl> + GpuConvParams : : FusionParams & fusion = * params . fusion ; <nl> if ( ! se : : dnn : : ActivationMode_IsValid ( backend_config . activation_mode ( ) ) ) { <nl> return InternalError ( " Bad activation mode : % s " , <nl> backend_config . ShortDebugString ( ) ) ; <nl> StatusOr < CudnnConvParams > GetCudnnConvParams ( <nl> return params ; <nl> } <nl> <nl> - Status RunCudnnConv ( const HloCustomCallInstruction * conv , <nl> - absl : : Span < se : : DeviceMemoryBase > operand_buffers , <nl> - se : : DeviceMemoryBase result_buffer , <nl> - se : : DeviceMemoryBase scratch_buf , se : : Stream * stream , <nl> - RunConvOptions options ) { <nl> + Status RunGpuConv ( const HloCustomCallInstruction * conv , <nl> + absl : : Span < se : : DeviceMemoryBase > operand_buffers , <nl> + se : : DeviceMemoryBase result_buffer , <nl> + se : : DeviceMemoryBase scratch_buf , se : : Stream * stream , <nl> + RunConvOptions options ) { <nl> ScratchBufAllocator scratch_allocator ( scratch_buf ) ; <nl> - return RunCudnnConv ( conv , operand_buffers , result_buffer , & scratch_allocator , <nl> - stream , options ) ; <nl> + return RunGpuConv ( conv , operand_buffers , result_buffer , & scratch_allocator , <nl> + stream , options ) ; <nl> } <nl> <nl> - Status RunCudnnConv ( const HloCustomCallInstruction * conv , <nl> - absl : : Span < se : : DeviceMemoryBase > operand_buffers , <nl> - se : : DeviceMemoryBase result_buffer , <nl> - se : : ScratchAllocator * scratch_allocator , se : : Stream * stream , <nl> - RunConvOptions options ) { <nl> - TF_ASSIGN_OR_RETURN ( CudnnConvParams params , <nl> - GetCudnnConvParams ( conv , operand_buffers , result_buffer ) ) ; <nl> + Status RunGpuConv ( const HloCustomCallInstruction * conv , <nl> + absl : : Span < se : : DeviceMemoryBase > operand_buffers , <nl> + se : : DeviceMemoryBase result_buffer , <nl> + se : : ScratchAllocator * scratch_allocator , se : : Stream * stream , <nl> + RunConvOptions options ) { <nl> + TF_ASSIGN_OR_RETURN ( GpuConvParams params , <nl> + GetGpuConvParams ( conv , operand_buffers , result_buffer ) ) ; <nl> <nl> PrimitiveType input_primitive_type = conv - > operand ( 0 ) - > shape ( ) . element_type ( ) ; <nl> switch ( input_primitive_type ) { <nl> case F16 : <nl> - return RunCudnnConvImpl < Eigen : : half , Eigen : : half , Eigen : : half > ( <nl> + return RunGpuConvImpl < Eigen : : half , Eigen : : half , Eigen : : half > ( <nl> params , scratch_allocator , stream , options ) ; <nl> case F32 : <nl> - return RunCudnnConvImpl < float , float , float > ( params , scratch_allocator , <nl> - stream , options ) ; <nl> + return RunGpuConvImpl < float , float , float > ( params , scratch_allocator , <nl> + stream , options ) ; <nl> case F64 : <nl> - return RunCudnnConvImpl < double , double , double > ( params , scratch_allocator , <nl> - stream , options ) ; <nl> + return RunGpuConvImpl < double , double , double > ( params , scratch_allocator , <nl> + stream , options ) ; <nl> case S8 : { <nl> PrimitiveType output_primitive_type = <nl> conv - > shape ( ) . tuple_shapes ( 0 ) . element_type ( ) ; <nl> switch ( output_primitive_type ) { <nl> case F32 : <nl> - return RunCudnnConvImpl < int8 , float , float > ( params , scratch_allocator , <nl> - stream , options ) ; <nl> + return RunGpuConvImpl < int8 , float , float > ( params , scratch_allocator , <nl> + stream , options ) ; <nl> case S8 : <nl> - return RunCudnnConvImpl < int8 , float , int8 > ( params , scratch_allocator , <nl> - stream , options ) ; <nl> + return RunGpuConvImpl < int8 , float , int8 > ( params , scratch_allocator , <nl> + stream , options ) ; <nl> default : <nl> LOG ( FATAL ) < < conv - > ToString ( ) ; <nl> } <nl> similarity index 81 % <nl> rename from tensorflow / compiler / xla / service / gpu / cudnn_conv_runner . h <nl> rename to tensorflow / compiler / xla / service / gpu / gpu_conv_runner . h <nl> mmm a / tensorflow / compiler / xla / service / gpu / cudnn_conv_runner . h <nl> ppp b / tensorflow / compiler / xla / service / gpu / gpu_conv_runner . h <nl> See the License for the specific language governing permissions and <nl> limitations under the License . <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = * / <nl> <nl> - # ifndef TENSORFLOW_COMPILER_XLA_SERVICE_GPU_CUDNN_CONV_RUNNER_H_ <nl> - # define TENSORFLOW_COMPILER_XLA_SERVICE_GPU_CUDNN_CONV_RUNNER_H_ <nl> + # ifndef TENSORFLOW_COMPILER_XLA_SERVICE_GPU_GPU_CONV_RUNNER_H_ <nl> + # define TENSORFLOW_COMPILER_XLA_SERVICE_GPU_GPU_CONV_RUNNER_H_ <nl> <nl> # include " absl / types / optional . h " <nl> # include " tensorflow / compiler / xla / service / gpu / ir_emission_utils . h " <nl> struct RunConvOptions { <nl> } ; <nl> <nl> / / Implementation struct exposed for debugging and log analysis . <nl> - struct CudnnConvParams { <nl> + struct GpuConvParams { <nl> / / Here are the fields related to cuDNN ' s fused convolution . The result thus <nl> / / is defined as : <nl> / / activation ( conv_result_scale * conv ( x , w ) + <nl> struct CudnnConvParams { <nl> / / allocator and take note of how much memory is used . The next time you call <nl> / / the same conv , you can provide an explicitly preallocated scratch buffer of <nl> / / that size , if you like . <nl> - Status RunCudnnConv ( const HloCustomCallInstruction * conv , <nl> - absl : : Span < se : : DeviceMemoryBase > operand_buffers , <nl> - se : : DeviceMemoryBase result_buffer , <nl> - se : : DeviceMemoryBase scratch_buf , se : : Stream * stream , <nl> - RunConvOptions = { } ) ; <nl> - <nl> - Status RunCudnnConv ( const HloCustomCallInstruction * conv , <nl> - absl : : Span < se : : DeviceMemoryBase > operand_buffers , <nl> - se : : DeviceMemoryBase result_buffer , <nl> - se : : ScratchAllocator * scratch_allocator , se : : Stream * stream , <nl> - RunConvOptions = { } ) ; <nl> + Status RunGpuConv ( const HloCustomCallInstruction * conv , <nl> + absl : : Span < se : : DeviceMemoryBase > operand_buffers , <nl> + se : : DeviceMemoryBase result_buffer , <nl> + se : : DeviceMemoryBase scratch_buf , se : : Stream * stream , <nl> + RunConvOptions = { } ) ; <nl> + <nl> + Status RunGpuConv ( const HloCustomCallInstruction * conv , <nl> + absl : : Span < se : : DeviceMemoryBase > operand_buffers , <nl> + se : : DeviceMemoryBase result_buffer , <nl> + se : : ScratchAllocator * scratch_allocator , se : : Stream * stream , <nl> + RunConvOptions = { } ) ; <nl> <nl> / / Implementation details exposed for debugging and log analysis . <nl> - StatusOr < CudnnConvParams > GetCudnnConvParams ( <nl> + StatusOr < GpuConvParams > GetGpuConvParams ( <nl> const HloCustomCallInstruction * conv , <nl> absl : : Span < se : : DeviceMemoryBase > operand_buffers , <nl> se : : DeviceMemoryBase result_buffer ) ; <nl> StatusOr < CudnnConvParams > GetCudnnConvParams ( <nl> } / / namespace gpu <nl> } / / namespace xla <nl> <nl> - # endif / / TENSORFLOW_COMPILER_XLA_SERVICE_GPU_CUDNN_CONV_RUNNER_H_ <nl> + # endif / / TENSORFLOW_COMPILER_XLA_SERVICE_GPU_GPU_CONV_RUNNER_H_ <nl> mmm a / tensorflow / compiler / xla / service / gpu / ir_emitter_unnested . cc <nl> ppp b / tensorflow / compiler / xla / service / gpu / ir_emitter_unnested . cc <nl> limitations under the License . <nl> # include " tensorflow / compiler / xla / service / gpu / conditional_thunk . h " <nl> # include " tensorflow / compiler / xla / service / gpu / copy_thunk . h " <nl> # include " tensorflow / compiler / xla / service / gpu / cudnn_batchnorm_thunk . h " <nl> - # include " tensorflow / compiler / xla / service / gpu / cudnn_conv_runner . h " <nl> # include " tensorflow / compiler / xla / service / gpu / for_thunk . h " <nl> # include " tensorflow / compiler / xla / service / gpu / gpu_constants . h " <nl> + # include " tensorflow / compiler / xla / service / gpu / gpu_conv_runner . h " <nl> # include " tensorflow / compiler / xla / service / gpu / hlo_to_ir_bindings . h " <nl> # include " tensorflow / compiler / xla / service / gpu / ir_emission_utils . h " <nl> # include " tensorflow / compiler / xla / service / gpu / ir_emitter_context . h " <nl> | Merge pull request from ROCmSoftwarePlatform : google - upstream - pr - rename - cudnn_conv_runner | tensorflow/tensorflow | 95affd00e57d1b061ebe01a14fb45adcf76ab02a | 2019-09-20T01:46:04Z |
mmm a / configure . py <nl> ppp b / configure . py <nl> def set_tf_cuda_compute_capabilities ( environ_cp ) : <nl> ask_cuda_compute_capabilities , default_cuda_compute_capabilities ) <nl> # Check whether all capabilities from the input is valid <nl> all_valid = True <nl> + # Provide a warning for capabilities less than 3 . 5 <nl> + warning_flag = False <nl> # Remove all whitespace characters before splitting the string <nl> # that users may insert by accident , as this will result in error <nl> tf_cuda_compute_capabilities = ' ' . join ( tf_cuda_compute_capabilities . split ( ) ) <nl> def set_tf_cuda_compute_capabilities ( environ_cp ) : <nl> if ver < 3 : <nl> print ( ' Only compute capabilities 3 . 0 or higher are supported . ' ) <nl> all_valid = False <nl> + elif float ( compute_capability ) < 3 . 5 : <nl> + warning_flag = True <nl> + <nl> + if warning_flag : <nl> + print ( ' Warning : TensorFlow can be build with CUDA compute capabilities ' \ <nl> + ' higher than 3 . 0 but it works with compute capabilities > = 3 . 5 ' \ <nl> + ' only . You may remove all compute capabilities lesser than 3 . 5 ' \ <nl> + ' to reduce the build time . ' ) <nl> <nl> if all_valid : <nl> break <nl> | Modify configure . py to provide a warning if CUDA compute capabilities are less than 3 . 5 | tensorflow/tensorflow | d910c0289b1be262b822fcfec6bedfab575d401e | 2019-02-19T09:16:38Z |
new file mode 100644 <nl> index 0000000000 . . 5b216980e7 <nl> mmm / dev / null <nl> ppp b / src / utils / socket . h <nl> <nl> + # ifndef XGBOOST_UTILS_SOCKET_H <nl> + # define XGBOOST_UTILS_SOCKET_H <nl> + / * ! <nl> + * \ file socket . h <nl> + * \ brief this file aims to provide a platform independent wrapper <nl> + * of socket <nl> + * \ author Tianqi Chen <nl> + * / <nl> + # include < fcntl . h > <nl> + # include < netdb . h > <nl> + # include < errno . h > <nl> + # include < unistd . h > <nl> + # include < arpa / inet . h > <nl> + # include < netinet / in . h > <nl> + # include < sys / socket . h > <nl> + # include < sys / select . h > <nl> + # include < string > <nl> + # include < cstring > <nl> + # include " . / utils . h " <nl> + <nl> + namespace xgboost { <nl> + namespace utils { <nl> + <nl> + / * ! \ brief data structure for network address * / <nl> + struct SockAddr { <nl> + sockaddr_in addr ; <nl> + / / constructor <nl> + SockAddr ( void ) { } <nl> + SockAddr ( const char * url , int port ) { <nl> + this - > Set ( url , port ) ; <nl> + } <nl> + / * ! <nl> + * \ brief set the address <nl> + * \ param url the url of the address <nl> + * \ param port the port of address <nl> + * / <nl> + inline void Set ( const char * url , int port ) { <nl> + hostent * hp = gethostbyname ( url ) ; <nl> + Check ( hp ! = NULL , " cannot obtain address of % s " , url ) ; <nl> + memset ( & addr , 0 , sizeof ( addr ) ) ; <nl> + addr . sin_family = AF_INET ; <nl> + addr . sin_port = htons ( port ) ; <nl> + memcpy ( & addr . sin_addr , hp - > h_addr_list [ 0 ] , hp - > h_length ) ; <nl> + } <nl> + / * ! \ return a string representation of the address * / <nl> + inline std : : string ToString ( void ) const { <nl> + std : : string buf ; buf . resize ( 256 ) ; <nl> + const char * s = inet_ntop ( AF_INET , & addr , & buf [ 0 ] , buf . length ( ) ) ; <nl> + Assert ( s ! = NULL , " cannot decode address " ) ; <nl> + std : : string res = s ; <nl> + sprintf ( & buf [ 0 ] , " % u " , ntohs ( addr . sin_port ) ) ; <nl> + res + = " : " + buf ; <nl> + return res ; <nl> + } <nl> + } ; <nl> + / * ! <nl> + * \ brief a wrapper of TCP socket that hopefully be cross platform <nl> + * / <nl> + class TCPSocket { <nl> + public : <nl> + / * ! \ brief the file descriptor of socket * / <nl> + int sockfd ; <nl> + / / constructor <nl> + TCPSocket ( void ) { } <nl> + / / default conversion to int <nl> + inline int operator ( ) ( ) const { <nl> + return sockfd ; <nl> + } <nl> + / * ! <nl> + * \ brief start up the socket module <nl> + * call this before using the sockets <nl> + * / <nl> + inline static void Startup ( void ) { <nl> + } <nl> + / * ! <nl> + * \ brief shutdown the socket module after use , all sockets need to be closed <nl> + * / <nl> + inline static void Finalize ( void ) { <nl> + } <nl> + / * ! <nl> + * \ brief set this socket to use async I / O <nl> + * / <nl> + inline void SetAsync ( void ) { <nl> + if ( fcntl ( sockfd , fcntl ( sockfd , F_GETFL ) | O_NONBLOCK ) = = - 1 ) { <nl> + SockError ( " SetAsync " , errno ) ; <nl> + } <nl> + } <nl> + / * ! <nl> + * \ brief perform listen of the socket <nl> + * \ param backlog backlog parameter <nl> + * / <nl> + inline void Listen ( int backlog = 16 ) { <nl> + listen ( sockfd , backlog ) ; <nl> + } <nl> + / * ! <nl> + * \ brief bind the socket to an address <nl> + * \ param 3 <nl> + * / <nl> + inline void Bind ( const SockAddr & addr ) { <nl> + if ( bind ( sockfd , ( sockaddr * ) & addr . addr , sizeof ( addr . addr ) ) = = - 1 ) { <nl> + SockError ( " Bind " , errno ) ; <nl> + } <nl> + } <nl> + / * ! <nl> + * \ brief connect to an address <nl> + * \ param addr the address to connect to <nl> + * / <nl> + inline void Connect ( const SockAddr & addr ) { <nl> + if ( connect ( sockfd , ( sockaddr * ) & addr . addr , sizeof ( addr . addr ) ) = = - 1 ) { <nl> + SockError ( " Connect " , errno ) ; <nl> + } <nl> + } <nl> + / * ! \ brief close the connection * / <nl> + inline void Close ( void ) { <nl> + close ( sockfd ) ; <nl> + } <nl> + / * ! <nl> + * \ brief send data using the socket <nl> + * \ param buf the pointer to the buffer <nl> + * \ param len the size of the buffer <nl> + * \ param flags extra flags <nl> + * \ return size of data actually sent <nl> + * / <nl> + inline size_t Send ( const void * buf , size_t len , int flag = 0 ) { <nl> + ssize_t ret = send ( sockfd , buf , len , flag ) ; <nl> + if ( ret = = - 1 ) SockError ( " Send " , errno ) ; <nl> + return ret ; <nl> + } <nl> + / * ! <nl> + * \ brief send data using the socket <nl> + * \ param buf the pointer to the buffer <nl> + * \ param len the size of the buffer <nl> + * \ param flags extra flags <nl> + * \ return size of data actually received <nl> + * / <nl> + inline size_t Recv ( void * buf , size_t len , int flags = 0 ) { <nl> + ssize_t ret = recv ( sockfd , buf , len , flags ) ; <nl> + if ( ret = = - 1 ) SockError ( " Recv " , errno ) ; <nl> + return ret ; <nl> + } <nl> + private : <nl> + / / report an socket error <nl> + inline static void SockError ( const char * msg , int errsv ) { <nl> + char buf [ 256 ] ; <nl> + Error ( " Socket % s Error : % s " , msg , strerror_r ( errsv , buf , sizeof ( buf ) ) ) ; <nl> + } <nl> + } ; <nl> + / * ! \ brief helper data structure to perform select * / <nl> + struct SelectHelper { <nl> + public : <nl> + SelectHelper ( void ) { } <nl> + / * ! <nl> + * \ brief add file descriptor to watch for read <nl> + * \ param fd file descriptor to be watched <nl> + * / <nl> + inline void WatchRead ( int fd ) { <nl> + FD_SET ( fd , & read_set ) ; <nl> + if ( fd > maxfd ) maxfd = fd ; <nl> + } <nl> + / * ! <nl> + * \ brief add file descriptor to watch for write <nl> + * \ param fd file descriptor to be watched <nl> + * / <nl> + inline void WatchWrite ( int fd ) { <nl> + FD_SET ( fd , & write_set ) ; <nl> + if ( fd > maxfd ) maxfd = fd ; <nl> + } <nl> + / * ! <nl> + * \ brief Check if the descriptor is ready for read <nl> + * \ param <nl> + * / <nl> + inline bool CheckRead ( int fd ) const { <nl> + return FD_ISSET ( fd , & read_set ) ; <nl> + } <nl> + inline bool CheckWrite ( int fd ) const { <nl> + return FD_ISSET ( fd , & write_set ) ; <nl> + } <nl> + inline void Clear ( void ) { <nl> + FD_ZERO ( & read_set ) ; <nl> + FD_ZERO ( & write_set ) ; <nl> + maxfd = 0 ; <nl> + } <nl> + / * ! <nl> + * \ brief peform select on the set defined <nl> + * \ param timeout specify timeout in micro - seconds ( ms ) if equals 0 , means select will always block <nl> + * \ return number of active descriptors selected <nl> + * / <nl> + inline int Select ( long timeout = 0 ) { <nl> + int ret ; <nl> + if ( timeout = = 0 ) { <nl> + ret = select ( maxfd + 1 , & read_set , & write_set , NULL , NULL ) ; <nl> + } else { <nl> + timeval tm ; <nl> + tm . tv_usec = ( timeout % 1000 ) * 1000 ; <nl> + tm . tv_sec = timeout / 1000 ; <nl> + ret = select ( maxfd + 1 , & read_set , & write_set , NULL , & tm ) ; <nl> + } <nl> + if ( ret = = - 1 ) { <nl> + int errsv = errno ; <nl> + char buf [ 256 ] ; <nl> + Error ( " Select Error : % s " , strerror_r ( errsv , buf , sizeof ( buf ) ) ) ; <nl> + } <nl> + return ret ; <nl> + } <nl> + <nl> + private : <nl> + int maxfd ; <nl> + fd_set read_set , write_set ; <nl> + } ; <nl> + } <nl> + } <nl> + # endif <nl> | checkin socket module | dmlc/xgboost | 84dcab67951e5df055f6b6b40a707d0e2f0e5c9c | 2014-11-22T00:09:26Z |
mmm a / SConstruct <nl> ppp b / SConstruct <nl> usesm = not GetOption ( " usesm " ) is None <nl> <nl> commonFiles = Split ( " stdafx . cpp buildinfo . cpp db / jsobj . cpp db / json . cpp db / commands . cpp db / lasterror . cpp db / nonce . cpp db / queryutil . cpp " ) <nl> commonFiles + = [ " util / background . cpp " , " util / mmap . cpp " , " util / sock . cpp " , " util / util . cpp " , " util / message . cpp " ] <nl> - commonFiles + = Glob ( " util / * . c " ) ; <nl> + commonFiles + = Glob ( " util / * . c " ) <nl> commonFiles + = Split ( " client / connpool . cpp client / dbclient . cpp client / model . cpp " ) <nl> + commonFiles + = [ " scripting / engine . cpp " ] <nl> <nl> # mmap stuff <nl> <nl> coreDbFiles = [ ] <nl> coreServerFiles = [ " util / message_server_port . cpp " , " util / message_server_asio . cpp " ] <nl> <nl> serverOnlyFiles = Split ( " db / query . cpp db / introspect . cpp db / btree . cpp db / clientcursor . cpp db / tests . cpp db / repl . cpp db / btreecursor . cpp db / cloner . cpp db / namespace . cpp db / matcher . cpp db / dbcommands . cpp db / dbeval . cpp db / dbwebserver . cpp db / dbinfo . cpp db / dbhelpers . cpp db / instance . cpp db / pdfile . cpp db / cursor . cpp db / security_commands . cpp db / security . cpp util / miniwebserver . cpp db / storage . cpp db / reccache . cpp db / queryoptimizer . cpp " ) <nl> - serverOnlyFiles + = [ " scripting / engine . cpp " ] <nl> <nl> if usesm : <nl> serverOnlyFiles + = [ " scripting / engine_spidermonkey . cpp " , " shell / mongo . cpp " ] <nl> elif not onlyServer : <nl> shellEnv . Append ( LIBS = [ " winmm . lib " ] ) <nl> <nl> if weird : <nl> - shell32BitFiles = Glob ( " shell / * . cpp " ) <nl> + shell32BitFiles = Glob ( " shell / * . cpp " ) + [ " scripting / engine_v8 . cpp " ] <nl> for f in allClientFiles : <nl> shell32BitFiles . append ( " 32bit / " + str ( f ) ) <nl> <nl> elif not onlyServer : <nl> mongo = shellEnv . Program ( " mongo " , shell32BitFiles ) <nl> else : <nl> shellEnv . Append ( LIBS = [ " mongoclient " ] ) <nl> - mongo = shellEnv . Program ( " mongo " , Glob ( " shell / * . cpp " ) ) ; <nl> + mongo = shellEnv . Program ( " mongo " , Glob ( " shell / * . cpp " ) + [ " scripting / engine_v8 . cpp " ] ) ; <nl> <nl> <nl> # mmm - RUNNING TESTS mmm - <nl> mmm a / mongo . xcodeproj / project . pbxproj <nl> ppp b / mongo . xcodeproj / project . pbxproj <nl> <nl> 93A479F70FAF2A5000E760DD / * engine_java . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = engine_java . h ; sourceTree = " < group > " ; } ; <nl> 93A479F90FAF2A5000E760DD / * engine_none . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = engine_none . cpp ; sourceTree = " < group > " ; } ; <nl> 93A479FA0FAF2A5000E760DD / * engine_spidermonkey . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = engine_spidermonkey . cpp ; sourceTree = " < group > " ; } ; <nl> + 93A47AA50FAF416F00E760DD / * engine_v8 . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = engine_v8 . cpp ; sourceTree = " < group > " ; } ; <nl> + 93A47AA60FAF41B200E760DD / * engine_v8 . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = engine_v8 . h ; sourceTree = " < group > " ; } ; <nl> 93A6E10C0F24CF9800DA4EBF / * lasterror . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = lasterror . h ; sourceTree = " < group > " ; } ; <nl> 93A6E10D0F24CFB100DA4EBF / * flushtest . cpp * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . cpp . cpp ; path = flushtest . cpp ; sourceTree = " < group > " ; } ; <nl> 93A6E10E0F24CFD300DA4EBF / * security . h * / = { isa = PBXFileReference ; fileEncoding = 4 ; lastKnownFileType = sourcecode . c . h ; path = security . h ; sourceTree = " < group > " ; } ; <nl> <nl> 93A479F20FAF2A5000E760DD / * scripting * / = { <nl> isa = PBXGroup ; <nl> children = ( <nl> + 93A47AA60FAF41B200E760DD / * engine_v8 . h * / , <nl> + 93A47AA50FAF416F00E760DD / * engine_v8 . cpp * / , <nl> 93A479F30FAF2A5000E760DD / * engine . cpp * / , <nl> 93A479F40FAF2A5000E760DD / * engine . h * / , <nl> 93A479F60FAF2A5000E760DD / * engine_java . cpp * / , <nl> new file mode 100644 <nl> index 000000000000 . . cd1ba1141b13 <nl> mmm / dev / null <nl> ppp b / scripting / engine_v8 . cpp <nl> <nl> + # include " engine_v8 . h " <nl> + <nl> + namespace mongo { <nl> + <nl> + void ScriptEngine : : setup ( ) { <nl> + if ( ! globalScriptEngine ) { <nl> + globalScriptEngine = new V8ScriptEngine ( ) ; <nl> + } <nl> + } <nl> + <nl> + } / / namespace mongo <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 000000000000 . . e29a56f96e46 <nl> mmm / dev / null <nl> ppp b / scripting / engine_v8 . h <nl> <nl> + # pragma once <nl> + <nl> + # include " engine . h " <nl> + <nl> + namespace mongo { <nl> + <nl> + class V8Scope : public Scope { <nl> + public : <nl> + V8Scope ( ) { } <nl> + virtual ~ V8Scope ( ) { } <nl> + <nl> + virtual void reset ( ) { } <nl> + virtual void init ( BSONObj * data ) { } <nl> + <nl> + virtual void localConnect ( const char * dbName ) { } <nl> + <nl> + virtual double getNumber ( const char * field ) { assert ( false ) ; return 0 ; } <nl> + virtual string getString ( const char * field ) { assert ( false ) ; return " " ; } <nl> + virtual bool getBoolean ( const char * field ) { assert ( false ) ; return false ; } <nl> + virtual BSONObj getObject ( const char * field ) { assert ( false ) ; return BSONObj ( ) ; } <nl> + <nl> + virtual int type ( const char * field ) { assert ( false ) ; return 0 ; } <nl> + <nl> + virtual void setNumber ( const char * field , double val ) { } <nl> + virtual void setString ( const char * field , const char * val ) { } <nl> + virtual void setObject ( const char * field , const BSONObj & obj ) { } <nl> + virtual void setBoolean ( const char * field , bool val ) { } <nl> + virtual void setThis ( const BSONObj * obj ) { } <nl> + <nl> + virtual ScriptingFunction createFunction ( const char * code ) { assert ( false ) ; return 0 ; } <nl> + virtual int invoke ( ScriptingFunction func , const BSONObj & args ) { assert ( false ) ; return 0 ; } <nl> + virtual string getError ( ) { assert ( false ) ; return " " ; } <nl> + <nl> + } ; <nl> + <nl> + class V8ScriptEngine : public ScriptEngine { <nl> + public : <nl> + V8ScriptEngine ( ) { } <nl> + virtual ~ V8ScriptEngine ( ) { } <nl> + <nl> + virtual Scope * createScope ( ) { return new V8Scope ( ) ; } <nl> + <nl> + virtual void runTest ( ) { } <nl> + } ; <nl> + <nl> + <nl> + extern ScriptEngine * globalScriptEngine ; <nl> + } <nl> | stubbed v8 engine | mongodb/mongo | 187689b0cd24b96b8ca06b417c1a0674e5466af2 | 2009-05-04T15:49:18Z |
mmm a / lib / Sema / TypeCheckDecl . cpp <nl> ppp b / lib / Sema / TypeCheckDecl . cpp <nl> class DeclChecker : public DeclVisitor < DeclChecker > { <nl> checkAccessControl ( TC , EED ) ; <nl> return ; <nl> } <nl> - if ( EED - > hasInterfaceType ( ) | | EED - > isBeingValidated ( ) ) <nl> - return ; <nl> - <nl> - TC . checkDeclAttributesEarly ( EED ) ; <nl> - TC . validateAccessControl ( EED ) ; <nl> - <nl> - validateAttributes ( TC , EED ) ; <nl> - <nl> - if ( ! EED - > getArgumentTypeLoc ( ) . isNull ( ) ) { <nl> - if ( TC . validateType ( EED - > getArgumentTypeLoc ( ) , EED - > getDeclContext ( ) , <nl> - TypeResolutionFlags : : EnumCase ) ) { <nl> - EED - > setInterfaceType ( ErrorType : : get ( TC . Context ) ) ; <nl> - EED - > setInvalid ( ) ; <nl> - return ; <nl> - } <nl> - } <nl> - <nl> - / / If we have a raw value , make sure there ' s a raw type as well . <nl> - if ( auto * rawValue = EED - > getRawValueExpr ( ) ) { <nl> - EnumDecl * ED = EED - > getParentEnum ( ) ; <nl> - if ( ! ED - > hasRawType ( ) ) { <nl> - TC . diagnose ( rawValue - > getLoc ( ) , diag : : enum_raw_value_without_raw_type ) ; <nl> - / / Recover by setting the raw type as this element ' s type . <nl> - Expr * typeCheckedExpr = rawValue ; <nl> - if ( ! TC . typeCheckExpression ( typeCheckedExpr , ED ) ) { <nl> - EED - > setTypeCheckedRawValueExpr ( typeCheckedExpr ) ; <nl> - TC . checkEnumElementErrorHandling ( EED ) ; <nl> - } <nl> - } else { <nl> - / / Wait until the second pass , when all the raw value expressions <nl> - / / can be checked together . <nl> - } <nl> - } <nl> - <nl> - / / Now that we have an argument type we can set the element ' s declared <nl> - / / type . <nl> - if ( ! EED - > computeType ( ) ) <nl> - return ; <nl> <nl> - / / Require the carried type to be materializable . <nl> - if ( auto argTy = EED - > getArgumentInterfaceType ( ) ) { <nl> - assert ( ! argTy - > hasLValueType ( ) & & " enum element cannot carry @ lvalue " ) ; <nl> - <nl> - if ( ! argTy - > isMaterializable ( ) ) { <nl> - TC . diagnose ( EED - > getLoc ( ) , diag : : enum_element_not_materializable , argTy ) ; <nl> - EED - > setInterfaceType ( ErrorType : : get ( TC . Context ) ) ; <nl> - EED - > setInvalid ( ) ; <nl> - } <nl> - } <nl> + TC . validateDecl ( EED ) ; <nl> TC . checkDeclAttributes ( EED ) ; <nl> } <nl> <nl> void TypeChecker : : validateDecl ( ValueDecl * D ) { <nl> case DeclKind : : Accessor : <nl> case DeclKind : : Subscript : <nl> case DeclKind : : Constructor : <nl> - case DeclKind : : Destructor : <nl> - case DeclKind : : EnumElement : { <nl> + case DeclKind : : Destructor : { <nl> typeCheckDecl ( D , true ) ; <nl> break ; <nl> } <nl> + case DeclKind : : EnumElement : { <nl> + auto * EED = cast < EnumElementDecl > ( D ) ; <nl> + <nl> + checkDeclAttributesEarly ( EED ) ; <nl> + validateAccessControl ( EED ) ; <nl> + <nl> + validateAttributes ( * this , EED ) ; <nl> + <nl> + EED - > setIsBeingValidated ( true ) ; <nl> + <nl> + if ( ! EED - > getArgumentTypeLoc ( ) . isNull ( ) ) { <nl> + if ( validateType ( EED - > getArgumentTypeLoc ( ) , EED - > getDeclContext ( ) , <nl> + TypeResolutionFlags : : EnumCase ) ) { <nl> + EED - > setIsBeingValidated ( false ) ; <nl> + EED - > setInterfaceType ( ErrorType : : get ( Context ) ) ; <nl> + EED - > setInvalid ( ) ; <nl> + break ; <nl> + } <nl> + } <nl> + <nl> + / / If we have a raw value , make sure there ' s a raw type as well . <nl> + if ( auto * rawValue = EED - > getRawValueExpr ( ) ) { <nl> + EnumDecl * ED = EED - > getParentEnum ( ) ; <nl> + if ( ! ED - > hasRawType ( ) ) { <nl> + diagnose ( rawValue - > getLoc ( ) , diag : : enum_raw_value_without_raw_type ) ; <nl> + / / Recover by setting the raw type as this element ' s type . <nl> + Expr * typeCheckedExpr = rawValue ; <nl> + if ( ! typeCheckExpression ( typeCheckedExpr , ED ) ) { <nl> + EED - > setTypeCheckedRawValueExpr ( typeCheckedExpr ) ; <nl> + checkEnumElementErrorHandling ( EED ) ; <nl> + } <nl> + } else { <nl> + / / Wait until the second pass , when all the raw value expressions <nl> + / / can be checked together . <nl> + } <nl> + } <nl> + <nl> + EED - > setIsBeingValidated ( false ) ; <nl> + <nl> + / / Now that we have an argument type we can set the element ' s declared <nl> + / / type . <nl> + if ( ! EED - > computeType ( ) ) <nl> + break ; <nl> + <nl> + / / Require the carried type to be materializable . <nl> + if ( auto argTy = EED - > getArgumentInterfaceType ( ) ) { <nl> + assert ( ! argTy - > hasLValueType ( ) & & " enum element cannot carry @ lvalue " ) ; <nl> + <nl> + if ( ! argTy - > isMaterializable ( ) ) { <nl> + diagnose ( EED - > getLoc ( ) , diag : : enum_element_not_materializable , argTy ) ; <nl> + EED - > setInterfaceType ( ErrorType : : get ( Context ) ) ; <nl> + EED - > setInvalid ( ) ; <nl> + } <nl> + } <nl> + <nl> + break ; <nl> + } <nl> } <nl> <nl> assert ( D - > hasValidSignature ( ) ) ; <nl> | Sema : Move most of DeclChecker : : visitEnumElementDecl ( ) to validateDecl ( ) | apple/swift | 64844c4b886815fba0021698650b3f0b0c3832ab | 2018-03-22T06:54:47Z |
mmm a / . gitignore <nl> ppp b / . gitignore <nl> <nl> / Telegram / Resources / art / sprite_150x . png <nl> / Telegram / * . user <nl> * . vcxproj * <nl> + * . sln <nl> * . suo <nl> * . sdf <nl> * . opensdf <nl> mmm a / Telegram / gyp / utils . gyp <nl> ppp b / Telegram / gyp / utils . gyp <nl> <nl> ' variables ' : { <nl> ' libs_loc ' : ' . . / . . / . . / Libraries ' , <nl> ' src_loc ' : ' . . / SourceFiles ' , <nl> + ' res_loc ' : ' . . / Resources ' , <nl> } , <nl> ' includes ' : [ <nl> ' common_executable . gypi ' , <nl> <nl> ' < ( src_loc ) / _other / updater_osx . m ' , <nl> ] , <nl> ' conditions ' : [ <nl> - [ ' < ( build_win ) ' , { <nl> + [ ' build_win ' , { <nl> ' sources ' : [ <nl> ' < ( res_loc ) / winrc / Updater . rc ' , <nl> ] , <nl> mmm a / doc / building - msvc . md <nl> ppp b / doc / building - msvc . md <nl> and run <nl> . . \ depot_tools \ gclient sync <nl> xcopy src \ src \ * src / s / i <nl> <nl> - <nl> # # # # Build <nl> <nl> * Open in VS2015 * * D : \ TBuild \ Libraries \ breakpad \ src \ client \ windows \ breakpad_client . sln * * <nl> and run <nl> <nl> # # Building Telegram Desktop <nl> <nl> + # # # # Setup GYP / Ninja and generate VS solution <nl> + <nl> + * Download [ Ninja binaries ] ( https : / / github . com / ninja - build / ninja / releases / download / v1 . 7 . 1 / ninja - win . zip ) and unpack them to * * D : \ \ TBuild \ \ Libraries \ \ ninja * * to have * * D : \ \ TBuild \ \ Libraries \ \ ninja \ \ ninja . exe * * <nl> + * Open * * VS2015 x86 Native Tools Command Prompt . bat * * ( should be in * * Start Menu > Programs > Visual Studio 2015 * * menu folder ) <nl> + <nl> + There go to Libraries directory <nl> + <nl> + D : <nl> + cd TBuild \ Libraries <nl> + <nl> + and run <nl> + <nl> + git clone https : / / chromium . googlesource . com / external / gyp <nl> + SET PATH = % PATH % ; D : \ TBuild \ Libraries \ gyp ; D : \ TBuild \ Libraries \ ninja ; <nl> + cd . . \ tdesktop \ Telegram <nl> + gyp \ refresh . bat <nl> + <nl> + # # # # Configure VS <nl> + <nl> * Launch VS2015 for configuring Qt5Package <nl> * QT5 > Qt Options > Add <nl> * Version name : * * Qt 5 . 6 . 0 Win32 * * <nl> * Path : * * D : \ TBuild \ Libraries \ qt5_6_0 \ qtbase * * <nl> * Default Qt / Win version : * * Qt 5 . 6 . 0 Win32 * * – * * OK * * - You may need to restart Visual Studio for this to take effect . <nl> + <nl> + # # # # Build the project <nl> + <nl> * File > Open > Project / Solution > * * D : \ TBuild \ tdesktop \ Telegram . sln * * <nl> - * Build \ Build Solution ( Debug and Release configurations ) <nl> + * Select Telegram project and press Build > Build Telegram ( Debug and Release configurations ) <nl> + * The result Telegram . exe will be located in * * D : \ TBuild \ tdesktop \ out \ Debug * * ( and * * Release * * ) <nl> | Build docs updated , . sln files added to . gitignore . | telegramdesktop/tdesktop | 4def7f2a18e1bb51a2315712d68ae80acbee03bb | 2016-08-14T18:41:31Z |
mmm a / Telegram / SourceFiles / platform / win / notifications_manager_win . cpp <nl> ppp b / Telegram / SourceFiles / platform / win / notifications_manager_win . cpp <nl> namespace { <nl> bool QuietHoursEnabled = false ; <nl> DWORD QuietHoursValue = 0 ; <nl> <nl> + bool useQuietHoursRegistryEntry ( ) { <nl> + / / Taken from QSysInfo . <nl> + OSVERSIONINFO result = { sizeof ( OSVERSIONINFO ) , 0 , 0 , 0 , 0 , { ' \ 0 ' } } ; <nl> + if ( const auto library = GetModuleHandle ( L " ntdll . dll " ) ) { <nl> + using RtlGetVersionFunction = NTSTATUS ( NTAPI * ) ( LPOSVERSIONINFO ) ; <nl> + const auto RtlGetVersion = reinterpret_cast < RtlGetVersionFunction > ( <nl> + GetProcAddress ( library , " RtlGetVersion " ) ) ; <nl> + if ( RtlGetVersion ) { <nl> + RtlGetVersion ( & result ) ; <nl> + } <nl> + } <nl> + / / At build 17134 ( Redstone 4 ) the " Quiet hours " was replaced <nl> + / / by " Focus assist " and it looks like it doesn ' t use registry . <nl> + return ( result . dwMajorVersion = = 10 <nl> + & & result . dwMinorVersion = = 0 <nl> + & & result . dwBuildNumber < 17134 ) ; <nl> + } <nl> + <nl> / / Thanks https : / / stackoverflow . com / questions / 35600128 / get - windows - quiet - hours - from - win32 - or - c - sharp - api <nl> void queryQuietHours ( ) { <nl> - if ( QSysInfo : : windowsVersion ( ) < QSysInfo : : WV_WINDOWS10 ) { <nl> + if ( ! useQuietHoursRegistryEntry ( ) ) { <nl> / / There are quiet hours in Windows starting from Windows 8 . 1 <nl> / / But there were several reports about the notifications being shut <nl> / / down according to the registry while no quiet hours were enabled . <nl> | Don ' t use registry quiet hours entry any more . | telegramdesktop/tdesktop | fae0bccc9cc5eaf912ca63f4b0e1aea9ee30bde5 | 2018-07-31T19:53:37Z |
mmm a / tensorflow / python / BUILD <nl> ppp b / tensorflow / python / BUILD <nl> py_library ( <nl> " : pywrap_tensorflow " , <nl> " : util " , <nl> " / / tensorflow / core : protos_all_py " , <nl> - " @ absl_py / / absl : app " , <nl> " @ absl_py / / absl / flags " , <nl> " @ six_archive / / : six " , <nl> ] , <nl> py_library ( <nl> name = " platform_test " , <nl> srcs = [ " platform / googletest . py " ] , <nl> srcs_version = " PY2AND3 " , <nl> - deps = [ <nl> - " : platform_benchmark " , <nl> - " @ absl_py / / absl / testing : absltest " , <nl> - ] , <nl> + deps = [ " : platform_benchmark " ] , <nl> ) <nl> <nl> tf_py_test ( <nl> mmm a / tensorflow / python / platform / app . py <nl> ppp b / tensorflow / python / platform / app . py <nl> <nl> from __future__ import division <nl> from __future__ import print_function <nl> <nl> + import errno as _errno <nl> import sys as _sys <nl> <nl> - from absl . app import run as _run <nl> - <nl> from tensorflow . python . platform import flags <nl> from tensorflow . python . util . tf_export import tf_export <nl> <nl> <nl> - def _parse_flags_tolerate_undef ( argv ) : <nl> - " " " Parse args , returning any unknown flags ( ABSL defaults to crashing ) . " " " <nl> - return flags . FLAGS ( _sys . argv if argv is None else argv , known_only = True ) <nl> + def _usage ( shorthelp ) : <nl> + " " " Writes __main__ ' s docstring to stdout with some help text . <nl> + <nl> + Args : <nl> + shorthelp : bool , if True , prints only flags from the main module , <nl> + rather than all flags . <nl> + " " " <nl> + doc = _sys . modules [ ' __main__ ' ] . __doc__ <nl> + if not doc : <nl> + doc = ' \ nUSAGE : % s [ flags ] \ n ' % _sys . argv [ 0 ] <nl> + doc = flags . text_wrap ( doc , indent = ' ' , firstline_indent = ' ' ) <nl> + else : <nl> + # Replace all ' % s ' with sys . argv [ 0 ] , and all ' % % ' with ' % ' . <nl> + num_specifiers = doc . count ( ' % ' ) - 2 * doc . count ( ' % % ' ) <nl> + try : <nl> + doc % = ( _sys . argv [ 0 ] , ) * num_specifiers <nl> + except ( OverflowError , TypeError , ValueError ) : <nl> + # Just display the docstring as - is . <nl> + pass <nl> + if shorthelp : <nl> + flag_str = flags . FLAGS . main_module_help ( ) <nl> + else : <nl> + flag_str = str ( flags . FLAGS ) <nl> + try : <nl> + _sys . stdout . write ( doc ) <nl> + if flag_str : <nl> + _sys . stdout . write ( ' \ nflags : \ n ' ) <nl> + _sys . stdout . write ( flag_str ) <nl> + _sys . stdout . write ( ' \ n ' ) <nl> + except IOError as e : <nl> + # We avoid printing a huge backtrace if we get EPIPE , because <nl> + # " foo . par - - help | less " is a frequent use case . <nl> + if e . errno ! = _errno . EPIPE : <nl> + raise <nl> + <nl> + <nl> + class _HelpFlag ( flags . BooleanFlag ) : <nl> + " " " Special boolean flag that displays usage and raises SystemExit . " " " <nl> + NAME = ' help ' <nl> + SHORT_NAME = ' h ' <nl> + <nl> + def __init__ ( self ) : <nl> + super ( _HelpFlag , self ) . __init__ ( <nl> + self . NAME , False , ' show this help ' , short_name = self . SHORT_NAME ) <nl> + <nl> + def parse ( self , arg ) : <nl> + if arg : <nl> + _usage ( shorthelp = True ) <nl> + print ( ) <nl> + print ( ' Try - - helpfull to get a list of all flags . ' ) <nl> + _sys . exit ( 1 ) <nl> + <nl> + <nl> + class _HelpshortFlag ( _HelpFlag ) : <nl> + " " " - - helpshort is an alias for - - help . " " " <nl> + NAME = ' helpshort ' <nl> + SHORT_NAME = None <nl> + <nl> + <nl> + class _HelpfullFlag ( flags . BooleanFlag ) : <nl> + " " " Display help for flags in main module and all dependent modules . " " " <nl> + <nl> + def __init__ ( self ) : <nl> + super ( _HelpfullFlag , self ) . __init__ ( ' helpfull ' , False , ' show full help ' ) <nl> + <nl> + def parse ( self , arg ) : <nl> + if arg : <nl> + _usage ( shorthelp = False ) <nl> + _sys . exit ( 1 ) <nl> + <nl> + <nl> + _define_help_flags_called = False <nl> + <nl> + <nl> + def _define_help_flags ( ) : <nl> + global _define_help_flags_called <nl> + if not _define_help_flags_called : <nl> + flags . DEFINE_flag ( _HelpFlag ( ) ) <nl> + flags . DEFINE_flag ( _HelpfullFlag ( ) ) <nl> + flags . DEFINE_flag ( _HelpshortFlag ( ) ) <nl> + _define_help_flags_called = True <nl> <nl> <nl> @ tf_export ( v1 = [ ' app . run ' ] ) <nl> def run ( main = None , argv = None ) : <nl> " " " Runs the program with an optional ' main ' function and ' argv ' list . " " " <nl> <nl> + # Define help flags . <nl> + _define_help_flags ( ) <nl> + <nl> + # Parse known flags . <nl> + argv = flags . FLAGS ( _sys . argv if argv is None else argv , known_only = True ) <nl> + <nl> main = main or _sys . modules [ ' __main__ ' ] . main <nl> <nl> - _run ( main = main , argv = argv , flags_parser = _parse_flags_tolerate_undef ) <nl> + # Call the main function , passing through any arguments <nl> + # to the final program . <nl> + _sys . exit ( main ( argv ) ) <nl> + <nl> mmm a / tensorflow / python / platform / googletest . py <nl> ppp b / tensorflow / python / platform / googletest . py <nl> <nl> # limitations under the License . <nl> # = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = <nl> <nl> - " " " Imports absltest as a replacement for testing . pybase . googletest . " " " <nl> + " " " Imports unittest as a replacement for testing . pybase . googletest . " " " <nl> from __future__ import absolute_import <nl> from __future__ import division <nl> from __future__ import print_function <nl> <nl> <nl> # go / tf - wildcard - import <nl> # pylint : disable = wildcard - import <nl> - from absl . testing . absltest import * <nl> + from unittest import * <nl> # pylint : enable = wildcard - import <nl> <nl> from tensorflow . python . framework import errors <nl> <nl> <nl> Benchmark = benchmark . TensorFlowBenchmark # pylint : disable = invalid - name <nl> <nl> - absltest_main = main <nl> + unittest_main = main <nl> <nl> # We keep a global variable in this module to make sure we create the temporary <nl> # directory only once per test binary invocation . <nl> <nl> # pylint : disable = invalid - name <nl> # pylint : disable = undefined - variable <nl> def g_main ( argv ) : <nl> - " " " Delegate to absltest . main after redefining testLoader . " " " <nl> + " " " Delegate to unittest . main after redefining testLoader . " " " <nl> if ' TEST_SHARD_STATUS_FILE ' in os . environ : <nl> try : <nl> f = None <nl> def g_main ( argv ) : <nl> <nl> if ( ' TEST_TOTAL_SHARDS ' not in os . environ or <nl> ' TEST_SHARD_INDEX ' not in os . environ ) : <nl> - return absltest_main ( argv = argv ) <nl> + return unittest_main ( argv = argv ) <nl> <nl> total_shards = int ( os . environ [ ' TEST_TOTAL_SHARDS ' ] ) <nl> shard_index = int ( os . environ [ ' TEST_SHARD_INDEX ' ] ) <nl> def getShardedTestCaseNames ( testCaseClass ) : <nl> # Override getTestCaseNames <nl> base_loader . getTestCaseNames = getShardedTestCaseNames <nl> <nl> - absltest_main ( argv = argv , testLoader = base_loader ) <nl> + unittest_main ( argv = argv , testLoader = base_loader ) <nl> <nl> <nl> # Redefine main to allow running benchmarks <nl> mmm a / tensorflow / tools / pip_package / BUILD <nl> ppp b / tensorflow / tools / pip_package / BUILD <nl> filegroup ( <nl> " / / third_party / eigen3 : LICENSE " , <nl> " / / third_party / fft2d : LICENSE " , <nl> " / / third_party / hadoop : LICENSE . txt " , <nl> - " @ absl_py / / absl : LICENSE " , <nl> - " @ absl_py / / absl / logging : LICENSE " , <nl> " @ absl_py / / absl / flags : LICENSE " , <nl> - " @ absl_py / / absl / testing : LICENSE " , <nl> - " @ absl_py / / absl / third_party / unittest3_backport : LICENSE " , <nl> " @ arm_neon_2_x86_sse / / : LICENSE " , <nl> " @ astor_archive / / : LICENSE " , <nl> " @ boringssl / / : LICENSE " , <nl> filegroup ( <nl> " @ curl / / : COPYING " , <nl> " @ double_conversion / / : LICENSE " , <nl> " @ eigen_archive / / : COPYING . MPL2 " , <nl> - " @ enum34_archive / / : LICENSE " , <nl> " @ farmhash_archive / / : COPYING " , <nl> " @ fft2d / / : fft / readme . txt " , <nl> " @ flatbuffers / / : LICENSE . txt " , <nl> | Automated rollback of commit 2435a1875b574f5d299b1dee431ab5ceccd6132f | tensorflow/tensorflow | 28401a50f1839f44c76f7b202c8766ecb61fc569 | 2019-01-18T00:04:19Z |
mmm a / Marlin / Marlin_main . cpp <nl> ppp b / Marlin / Marlin_main . cpp <nl> inline void gcode_M428 ( ) { <nl> <nl> if ( ! err ) { <nl> sync_plan_position ( ) ; <nl> - LCD_ALERTMESSAGEPGM ( MSG_HOME_OFFSETS_APPLIED ) ; <nl> + LCD_MESSAGEPGM ( MSG_HOME_OFFSETS_APPLIED ) ; <nl> # if HAS_BUZZER <nl> buzz ( 200 , 659 ) ; <nl> buzz ( 200 , 698 ) ; <nl> mmm a / Marlin / ultralcd . cpp <nl> ppp b / Marlin / ultralcd . cpp <nl> void lcd_cooldown ( ) { <nl> mbl . set_zigzag_z ( _lcd_level_bed_position + + , current_position [ Z_AXIS ] ) ; <nl> if ( _lcd_level_bed_position = = ( MESH_NUM_X_POINTS ) * ( MESH_NUM_Y_POINTS ) ) { <nl> lcd_return_to_status ( ) ; <nl> - LCD_ALERTMESSAGEPGM ( MSG_LEVEL_BED_DONE ) ; <nl> + LCD_MESSAGEPGM ( MSG_LEVEL_BED_DONE ) ; <nl> # if HAS_BUZZER <nl> buzz ( 200 , 659 ) ; <nl> buzz ( 200 , 698 ) ; <nl> | Merge pull request from thinkyhead / rc_lcd_alert_only_on_error | MarlinFirmware/Marlin | a5452902a60c1513509be403c99ba6ba494f3e19 | 2016-04-16T02:56:24Z |
mmm a / src / main . cpp <nl> ppp b / src / main . cpp <nl> bool CVerifyDB : : VerifyDB ( CCoinsView * coinsview , int nCheckLevel , int nCheckDepth <nl> } else <nl> nGoodTransactions + = block . vtx . size ( ) ; <nl> } <nl> + if ( ShutdownRequested ( ) ) <nl> + return true ; <nl> } <nl> if ( pindexFailure ) <nl> return error ( " VerifyDB ( ) : * * * coin database inconsistencies found ( last % i blocks , % i good transactions before that ) \ n " , chainActive . Height ( ) - pindexFailure - > nHeight + 1 , nGoodTransactions ) ; <nl> | On close of splashscreen interrupt verifyDB | bitcoin/bitcoin | 70477a0bdf6eb6d123ce256f064bbd3bc356c82a | 2015-01-03T09:22:02Z |
mmm a / buildscripts / resmokeconfig / suites / sharding_last_stable_mongos_and_mixed_shards . yml <nl> ppp b / buildscripts / resmokeconfig / suites / sharding_last_stable_mongos_and_mixed_shards . yml <nl> selector : <nl> # SERVER - 33683 : We added a restriction on using an aggregation within a transaction against <nl> # mongos . This should be removed and the test can be adjusted and re - added to this passthrough . <nl> - jstests / sharding / aggregations_in_session . js <nl> - # New waitForClusterTime <nl> - - jstests / sharding / auth_slaveok_routing . js <nl> # This test should not be run with a mixed cluster environment . <nl> - jstests / sharding / nonreplicated_uuids_on_shardservers . js <nl> - # Enable when SERVER - 33538 is backported . <nl> - - jstests / sharding / mapReduce_outSharded_checkUUID . js <nl> # Will always fail because we can ' t downgrade FCV before the last - stable binary mongos connects , <nl> # meaning that either the test will stall , or mongos will crash due to connecting to an upgraded <nl> # FCV cluster . <nl> - jstests / sharding / mongos_wait_csrs_initiate . js <nl> - # Enable if SERVER - 34971 is backported or 4 . 2 becomes last - stable <nl> - - jstests / sharding / update_replace_id . js <nl> - - jstests / sharding / stale_mongos_updates_and_removes . js <nl> - - jstests / sharding / geo_near_sharded . js <nl> - # Enable when 4 . 2 becomes last - stable . <nl> - - jstests / sharding / aggregation_internal_parameters . js <nl> - - jstests / sharding / agg_error_reports_shard_host_and_port . js <nl> - - jstests / sharding / commands_that_write_accept_wc_shards . js <nl> - - jstests / sharding / now_variable_replset . js <nl> - - jstests / sharding / now_variable_sharding . js <nl> - - jstests / sharding / index_and_collection_option_propagation . js <nl> - - jstests / sharding / shard6 . js <nl> - - jstests / sharding / regex_targeting . js <nl> - - jstests / sharding / update_compound_shard_key . js <nl> - - jstests / sharding / upsert_sharded . js <nl> - - jstests / sharding / write_transactions_during_migration . js <nl> - - jstests / sharding / change_stream_show_migration_events . js <nl> - - jstests / sharding / features3 . js <nl> - - jstests / sharding / prepare_transaction_then_migrate . js <nl> # Enable after SERVER - 40258 gets backported and available in the official 4 . 2 binaries . <nl> - jstests / sharding / prepared_txn_metadata_refresh . js <nl> - # mongos in 4 . 0 doesn ' t like an aggregation explain without stages for optimized away pipelines , <nl> - # so blacklisting the test until 4 . 2 becomes last - stable . <nl> - - jstests / sharding / agg_explain_fmt . js <nl> - - jstests / sharding / change_stream_metadata_notifications . js <nl> - - jstests / sharding / change_stream_transaction_sharded . js <nl> - - jstests / sharding / change_streams . js <nl> - - jstests / sharding / collation_lookup . js <nl> - - jstests / sharding / collation_targeting . js <nl> - - jstests / sharding / collation_targeting_inherited . js <nl> - # mongos in 4 . 0 doesn ' t like an aggregation explain without stages for optimized away pipelines , <nl> - # so blacklisting the test until 4 . 2 becomes last - stable . <nl> - - jstests / sharding / agg_write_stages_cannot_run_on_mongos . js <nl> - - jstests / sharding / explain_agg_read_pref . js <nl> - - jstests / sharding / explain_cmd . js <nl> - - jstests / sharding / failcommand_failpoint_not_parallel . js <nl> - - jstests / sharding / failcommand_ignores_internal . js <nl> - - jstests / sharding / geo_near_random1 . js <nl> - - jstests / sharding / geo_near_random2 . js <nl> - - jstests / sharding / lookup . js <nl> - - jstests / sharding / lookup_mongod_unaware . js <nl> - - jstests / sharding / lookup_on_shard . js <nl> - - jstests / sharding / lookup_stale_mongos . js <nl> - - jstests / sharding / merge_command_options . js <nl> - - jstests / sharding / merge_does_not_force_pipeline_split . js <nl> - - jstests / sharding / merge_from_stale_mongos . js <nl> - - jstests / sharding / merge_hashed_shard_key . js <nl> - - jstests / sharding / merge_on_fields . js <nl> - - jstests / sharding / merge_requires_unique_index . js <nl> - - jstests / sharding / merge_stale_on_fields . js <nl> - - jstests / sharding / merge_to_existing . js <nl> - - jstests / sharding / merge_to_non_existing . js <nl> - - jstests / sharding / merge_with_chunk_migrations . js <nl> - - jstests / sharding / merge_with_drop_shard . js <nl> - - jstests / sharding / merge_with_move_primary . js <nl> - - jstests / sharding / move_chunk_update_shard_key_in_retryable_write . js <nl> - - jstests / sharding / merge_write_concern . js <nl> - - jstests / sharding / range_deleter_does_not_block_stepdown_with_prepare_conflict . js <nl> - - jstests / sharding / restart_transactions . js <nl> - - jstests / sharding / shard7 . js <nl> - - jstests / sharding / shard_config_db_collections . js <nl> - - jstests / sharding / unsharded_collection_targetting . js <nl> - - jstests / sharding / array_shard_key . js <nl> - - jstests / sharding / update_immutable_fields . js <nl> - - jstests / sharding / update_shard_key_doc_on_same_shard . js <nl> - - jstests / sharding / update_shard_key_doc_moves_shards . js <nl> - - jstests / sharding / update_shard_key_conflicting_writes . js <nl> - - jstests / sharding / update_shard_key_pipeline_update . js <nl> - # mongos in 4 . 0 doesn ' t like an aggregation explain without stages for optimized away pipelines , <nl> - # so blacklisting the test until 4 . 2 becomes last - stable . <nl> - - jstests / sharding / views . js <nl> - # TODO : SERVER - 38541 remove from blacklist <nl> - - jstests / sharding / shard_collection_existing_zones . js <nl> - - jstests / sharding / single_shard_transaction_with_arbiter . js <nl> - - jstests / sharding / single_shard_transaction_without_majority_reads_lagged . js <nl> - - jstests / sharding / multi_shard_transaction_without_majority_reads . js <nl> - - jstests / sharding / snapshot_cursor_commands_mongos . js <nl> - - jstests / sharding / transactions_causal_consistency . js <nl> - - jstests / sharding / transactions_distinct_not_allowed_on_sharded_collections . js <nl> - - jstests / sharding / transactions_error_labels . js <nl> - - jstests / sharding / transactions_expiration . js <nl> - - jstests / sharding / transactions_implicit_abort . js <nl> - - jstests / sharding / transactions_multi_writes . js <nl> - - jstests / sharding / transactions_read_concerns . js <nl> - - jstests / sharding / transactions_reject_writes_for_moved_chunks . js <nl> - - jstests / sharding / transactions_snapshot_errors_first_statement . js <nl> - - jstests / sharding / transactions_snapshot_errors_subsequent_statements . js <nl> - - jstests / sharding / transactions_stale_database_version_errors . js <nl> - - jstests / sharding / transactions_stale_shard_version_errors . js <nl> - - jstests / sharding / transactions_target_at_point_in_time . js <nl> - - jstests / sharding / transactions_targeting_errors . js <nl> - - jstests / sharding / transactions_view_resolution . js <nl> - - jstests / sharding / transactions_writes_not_retryable . js <nl> - - jstests / sharding / txn_agg . js <nl> - - jstests / sharding / txn_two_phase_commit_basic . js <nl> - - jstests / sharding / txn_two_phase_commit_commands_basic_requirements . js <nl> - - jstests / sharding / txn_two_phase_commit_coordinator_shutdown_and_restart . js <nl> - - jstests / sharding / txn_two_phase_commit_failover . js <nl> - - jstests / sharding / txn_two_phase_commit_killop . js <nl> - - jstests / sharding / txn_two_phase_commit_server_status . js <nl> - - jstests / sharding / txn_recover_decision_using_recovery_router . js <nl> - - jstests / sharding / txn_two_phase_commit_wait_for_majority_commit_after_stepup . js <nl> - - jstests / sharding / txn_commit_optimizations_for_read_only_shards . js <nl> - - jstests / sharding / txn_being_applied_to_secondary_cannot_be_killed . js <nl> - - jstests / sharding / txn_with_several_routers . js <nl> - - jstests / sharding / txn_writes_during_movechunk . js <nl> - - jstests / sharding / update_sharded . js <nl> - - jstests / sharding / shard_existing_coll_chunk_count . js <nl> - - jstests / sharding / wildcard_index_banned_for_shard_key . js <nl> - - jstests / sharding / unsharded_lookup_in_txn . js <nl> - # Enable if SERVER - 20865 is backported or 4 . 2 becomes last - stable <nl> - - jstests / sharding / sharding_statistics_server_status . js <nl> - # Enable if SERVER - 36966 is backported or 4 . 2 becomes last - stable <nl> - - jstests / sharding / mr_output_sharded_validation . js <nl> # Enable when 4 . 4 becomes last stable <nl> - jstests / sharding / explain_exec_stats_on_shards . js <nl> - jstests / sharding / refine_collection_shard_key_basic . js <nl> mmm a / jstests / sharding / features3 . js <nl> ppp b / jstests / sharding / features3 . js <nl> assert . eq ( numDocs , x . count , " total count " ) ; <nl> assert . eq ( numDocs / 2 , x . shards [ s . shard0 . shardName ] . count , " count on " + s . shard0 . shardName ) ; <nl> assert . eq ( numDocs / 2 , x . shards [ s . shard1 . shardName ] . count , " count on " + s . shard1 . shardName ) ; <nl> assert ( x . totalIndexSize > 0 ) ; <nl> - assert ( x . totalSize > 0 ) ; <nl> + assert ( x . size > 0 ) ; <nl> <nl> / / insert one doc into a non - sharded collection <nl> dbForTest . bar . insert ( { x : 1 } ) ; <nl> | SERVER - 43006 Unblacklist last_stable_mongos_and_mixed_shards tests now that 4 . 2 is last - stable | mongodb/mongo | 8498f706a392c84dc587eb70090c296a4fead296 | 2019-08-23T15:17:44Z |
mmm a / dbms / include / DB / Client / ReplicasConnections . h <nl> ppp b / dbms / include / DB / Client / ReplicasConnections . h <nl> namespace DB <nl> <nl> std : : string dumpAddresses ( ) const ; <nl> <nl> + size_t size ( ) const ; <nl> + <nl> + void sendExternalTablesData ( std : : vector < ExternalTablesData > & data ) ; <nl> + <nl> private : <nl> using ConnectionHash = std : : unordered_map < int , ConnectionInfo > ; <nl> <nl> mmm a / dbms / include / DB / Core / ErrorCodes . h <nl> ppp b / dbms / include / DB / Core / ErrorCodes . h <nl> namespace ErrorCodes <nl> INCOMPATIBLE_TYPE_OF_JOIN , <nl> NO_AVAILABLE_REPLICA , <nl> UNEXPECTED_REPLICA , <nl> + MISMATCH_REPLICAS_DATA_SOURCES , <nl> <nl> POCO_EXCEPTION = 1000 , <nl> STD_EXCEPTION , <nl> mmm a / dbms / include / DB / DataStreams / RemoteBlockInputStream . h <nl> ppp b / dbms / include / DB / DataStreams / RemoteBlockInputStream . h <nl> class RemoteBlockInputStream : public IProfilingBlockInputStream <nl> / / / Отправить на удаленные сервера все временные таблицы <nl> void sendExternalTables ( ) <nl> { <nl> - ExternalTablesData res ; <nl> - for ( const auto & table : external_tables ) <nl> + size_t count = use_many_replicas ? replicas_connections - > size ( ) : 1 ; <nl> + <nl> + std : : vector < ExternalTablesData > instances ; <nl> + instances . reserve ( count ) ; <nl> + <nl> + for ( size_t i = 0 ; i < count ; + + i ) <nl> { <nl> - StoragePtr cur = table . second ; <nl> - QueryProcessingStage : : Enum stage = QueryProcessingStage : : Complete ; <nl> - DB : : BlockInputStreams input = cur - > read ( cur - > getColumnNamesList ( ) , ASTPtr ( ) , context , settings , <nl> - stage , DEFAULT_BLOCK_SIZE , 1 ) ; <nl> - if ( input . size ( ) = = 0 ) <nl> - res . push_back ( std : : make_pair ( new OneBlockInputStream ( cur - > getSampleBlock ( ) ) , table . first ) ) ; <nl> - else <nl> - res . push_back ( std : : make_pair ( input [ 0 ] , table . first ) ) ; <nl> + ExternalTablesData res ; <nl> + for ( const auto & table : external_tables ) <nl> + { <nl> + StoragePtr cur = table . second ; <nl> + QueryProcessingStage : : Enum stage = QueryProcessingStage : : Complete ; <nl> + DB : : BlockInputStreams input = cur - > read ( cur - > getColumnNamesList ( ) , ASTPtr ( ) , context , settings , <nl> + stage , DEFAULT_BLOCK_SIZE , 1 ) ; <nl> + if ( input . size ( ) = = 0 ) <nl> + res . push_back ( std : : make_pair ( new OneBlockInputStream ( cur - > getSampleBlock ( ) ) , table . first ) ) ; <nl> + else <nl> + res . push_back ( std : : make_pair ( input [ 0 ] , table . first ) ) ; <nl> + } <nl> + instances . push_back ( std : : move ( res ) ) ; <nl> } <nl> + <nl> if ( use_many_replicas ) <nl> - { <nl> - / / / XXX Отправить res по всем соединениям . <nl> - / / replicas_connections - > sendExternalTablesData ( res ) ; <nl> - } <nl> + replicas_connections - > sendExternalTablesData ( instances ) ; <nl> else <nl> - connection - > sendExternalTablesData ( res ) ; <nl> + connection - > sendExternalTablesData ( instances [ 0 ] ) ; <nl> } <nl> <nl> Block readImpl ( ) override <nl> mmm a / dbms / src / Client / ReplicasConnections . cpp <nl> ppp b / dbms / src / Client / ReplicasConnections . cpp <nl> namespace DB <nl> <nl> return os . str ( ) ; <nl> } <nl> + <nl> + size_t ReplicasConnections : : size ( ) const <nl> + { <nl> + return connection_hash . size ( ) ; <nl> + } <nl> + <nl> + void ReplicasConnections : : sendExternalTablesData ( std : : vector < ExternalTablesData > & data ) <nl> + { <nl> + if ( data . size ( ) ! = connection_hash . size ( ) ) <nl> + throw Exception ( " Mismatch between replicas and data sources " , ErrorCodes : : MISMATCH_REPLICAS_DATA_SOURCES ) ; <nl> + <nl> + auto it = data . begin ( ) ; <nl> + for ( auto & e : connection_hash ) <nl> + { <nl> + Connection * connection = e . second . connection ; <nl> + connection - > sendExternalTablesData ( * it ) ; <nl> + + + it ; <nl> + } <nl> + } <nl> } <nl> | dbms : Server : queries with several replicas : development [ # METR - 14410 ] | ClickHouse/ClickHouse | 594ab0957904808eba8e1418fc83eb36a7844657 | 2015-02-03T13:36:12Z |
mmm a / dbms / src / Functions / FunctionFactory . cpp <nl> ppp b / dbms / src / Functions / FunctionFactory . cpp <nl> FunctionPtr FunctionFactory : : get ( <nl> const String & name , <nl> const Context & context ) const <nl> { <nl> - / / / Немного неоптимально . <nl> - <nl> - if ( name = = " plus " ) return new FunctionPlus ; <nl> - else if ( name = = " minus " ) return new FunctionMinus ; <nl> - else if ( name = = " multiply " ) return new FunctionMultiply ; <nl> - else if ( name = = " divide " ) return new FunctionDivideFloating ; <nl> - else if ( name = = " intDiv " ) return new FunctionDivideIntegral ; <nl> - else if ( name = = " modulo " ) return new FunctionModulo ; <nl> - else if ( name = = " negate " ) return new FunctionNegate ; <nl> - else if ( name = = " bitAnd " ) return new FunctionBitAnd ; <nl> - else if ( name = = " bitOr " ) return new FunctionBitOr ; <nl> - else if ( name = = " bitXor " ) return new FunctionBitXor ; <nl> - else if ( name = = " bitNot " ) return new FunctionBitNot ; <nl> - else if ( name = = " bitShiftLeft " ) return new FunctionBitShiftLeft ; <nl> - else if ( name = = " bitShiftRight " ) return new FunctionBitShiftRight ; <nl> - <nl> - else if ( name = = " equals " ) return new FunctionEquals ; <nl> - else if ( name = = " notEquals " ) return new FunctionNotEquals ; <nl> - else if ( name = = " less " ) return new FunctionLess ; <nl> - else if ( name = = " greater " ) return new FunctionGreater ; <nl> - else if ( name = = " lessOrEquals " ) return new FunctionLessOrEquals ; <nl> - else if ( name = = " greaterOrEquals " ) return new FunctionGreaterOrEquals ; <nl> - <nl> - else if ( name = = " and " ) return new FunctionAnd ; <nl> - else if ( name = = " or " ) return new FunctionOr ; <nl> - else if ( name = = " xor " ) return new FunctionXor ; <nl> - else if ( name = = " not " ) return new FunctionNot ; <nl> - <nl> - else if ( name = = " roundToExp2 " ) return new FunctionRoundToExp2 ; <nl> - else if ( name = = " roundDuration " ) return new FunctionRoundDuration ; <nl> - else if ( name = = " roundAge " ) return new FunctionRoundAge ; <nl> - <nl> - else if ( name = = " empty " ) return new FunctionEmpty ; <nl> - else if ( name = = " notEmpty " ) return new FunctionNotEmpty ; <nl> - else if ( name = = " length " ) return new FunctionLength ; <nl> - else if ( name = = " lengthUTF8 " ) return new FunctionLengthUTF8 ; <nl> - else if ( name = = " lower " ) return new FunctionLower ; <nl> - else if ( name = = " upper " ) return new FunctionUpper ; <nl> - else if ( name = = " lowerUTF8 " ) return new FunctionLowerUTF8 ; <nl> - else if ( name = = " upperUTF8 " ) return new FunctionUpperUTF8 ; <nl> - else if ( name = = " reverse " ) return new FunctionReverse ; <nl> - else if ( name = = " reverseUTF8 " ) return new FunctionReverseUTF8 ; <nl> - else if ( name = = " concat " ) return new FunctionConcat ; <nl> - else if ( name = = " substring " ) return new FunctionSubstring ; <nl> - else if ( name = = " replaceOne " ) return new FunctionReplaceOne ; <nl> - else if ( name = = " replaceAll " ) return new FunctionReplaceAll ; <nl> - else if ( name = = " replaceRegexpOne " ) return new FunctionReplaceRegexpOne ; <nl> - else if ( name = = " replaceRegexpAll " ) return new FunctionReplaceRegexpAll ; <nl> - else if ( name = = " substringUTF8 " ) return new FunctionSubstringUTF8 ; <nl> - <nl> - else if ( name = = " toUInt8 " ) return new FunctionToUInt8 ; <nl> - else if ( name = = " toUInt16 " ) return new FunctionToUInt16 ; <nl> - else if ( name = = " toUInt32 " ) return new FunctionToUInt32 ; <nl> - else if ( name = = " toUInt64 " ) return new FunctionToUInt64 ; <nl> - else if ( name = = " toInt8 " ) return new FunctionToInt8 ; <nl> - else if ( name = = " toInt16 " ) return new FunctionToInt16 ; <nl> - else if ( name = = " toInt32 " ) return new FunctionToInt32 ; <nl> - else if ( name = = " toInt64 " ) return new FunctionToInt64 ; <nl> - else if ( name = = " toFloat32 " ) return new FunctionToFloat32 ; <nl> - else if ( name = = " toFloat64 " ) return new FunctionToFloat64 ; <nl> - else if ( name = = " toDate " ) return new FunctionToDate ; <nl> - else if ( name = = " toDateTime " ) return new FunctionToDateTime ; <nl> - else if ( name = = " toString " ) return new FunctionToString ; <nl> - else if ( name = = " toFixedString " ) return new FunctionToFixedString ; <nl> - else if ( name = = " toStringCutToZero " ) return new FunctionToStringCutToZero ; <nl> - <nl> - else if ( name = = " reinterpretAsUInt8 " ) return new FunctionReinterpretAsUInt8 ; <nl> - else if ( name = = " reinterpretAsUInt16 " ) return new FunctionReinterpretAsUInt16 ; <nl> - else if ( name = = " reinterpretAsUInt32 " ) return new FunctionReinterpretAsUInt32 ; <nl> - else if ( name = = " reinterpretAsUInt64 " ) return new FunctionReinterpretAsUInt64 ; <nl> - else if ( name = = " reinterpretAsInt8 " ) return new FunctionReinterpretAsInt8 ; <nl> - else if ( name = = " reinterpretAsInt16 " ) return new FunctionReinterpretAsInt16 ; <nl> - else if ( name = = " reinterpretAsInt32 " ) return new FunctionReinterpretAsInt32 ; <nl> - else if ( name = = " reinterpretAsInt64 " ) return new FunctionReinterpretAsInt64 ; <nl> - else if ( name = = " reinterpretAsFloat32 " ) return new FunctionReinterpretAsFloat32 ; <nl> - else if ( name = = " reinterpretAsFloat64 " ) return new FunctionReinterpretAsFloat64 ; <nl> - else if ( name = = " reinterpretAsDate " ) return new FunctionReinterpretAsDate ; <nl> - else if ( name = = " reinterpretAsDateTime " ) return new FunctionReinterpretAsDateTime ; <nl> - else if ( name = = " reinterpretAsString " ) return new FunctionReinterpretAsString ; <nl> - <nl> - else if ( name = = " toYear " ) return new FunctionToYear ; <nl> - else if ( name = = " toMonth " ) return new FunctionToMonth ; <nl> - else if ( name = = " toDayOfMonth " ) return new FunctionToDayOfMonth ; <nl> - else if ( name = = " toDayOfWeek " ) return new FunctionToDayOfWeek ; <nl> - else if ( name = = " toHour " ) return new FunctionToHour ; <nl> - else if ( name = = " toMinute " ) return new FunctionToMinute ; <nl> - else if ( name = = " toSecond " ) return new FunctionToSecond ; <nl> - else if ( name = = " toMonday " ) return new FunctionToMonday ; <nl> - else if ( name = = " toStartOfMonth " ) return new FunctionToStartOfMonth ; <nl> - else if ( name = = " toStartOfQuarter " ) return new FunctionToStartOfQuarter ; <nl> - else if ( name = = " toStartOfYear " ) return new FunctionToStartOfYear ; <nl> - else if ( name = = " toStartOfMinute " ) return new FunctionToStartOfMinute ; <nl> - else if ( name = = " toStartOfHour " ) return new FunctionToStartOfHour ; <nl> - else if ( name = = " toRelativeYearNum " ) return new FunctionToRelativeYearNum ; <nl> - else if ( name = = " toRelativeMonthNum " ) return new FunctionToRelativeMonthNum ; <nl> - else if ( name = = " toRelativeWeekNum " ) return new FunctionToRelativeWeekNum ; <nl> - else if ( name = = " toRelativeDayNum " ) return new FunctionToRelativeDayNum ; <nl> - else if ( name = = " toRelativeHourNum " ) return new FunctionToRelativeHourNum ; <nl> - else if ( name = = " toRelativeMinuteNum " ) return new FunctionToRelativeMinuteNum ; <nl> - else if ( name = = " toRelativeSecondNum " ) return new FunctionToRelativeSecondNum ; <nl> - else if ( name = = " toTime " ) return new FunctionToTime ; <nl> - else if ( name = = " now " ) return new FunctionNow ; <nl> - else if ( name = = " timeSlot " ) return new FunctionTimeSlot ; <nl> - else if ( name = = " timeSlots " ) return new FunctionTimeSlots ; <nl> - <nl> - else if ( name = = " position " ) return new FunctionPosition ; <nl> - else if ( name = = " positionUTF8 " ) return new FunctionPositionUTF8 ; <nl> - else if ( name = = " match " ) return new FunctionMatch ; <nl> - else if ( name = = " like " ) return new FunctionLike ; <nl> - else if ( name = = " notLike " ) return new FunctionNotLike ; <nl> - else if ( name = = " extract " ) return new FunctionExtract ; <nl> - else if ( name = = " extractAll " ) return new FunctionExtractAll ; <nl> - <nl> - else if ( name = = " halfMD5 " ) return new FunctionHalfMD5 ; <nl> - else if ( name = = " sipHash64 " ) return new FunctionSipHash64 ; <nl> - else if ( name = = " cityHash64 " ) return new FunctionCityHash64 ; <nl> - else if ( name = = " intHash32 " ) return new FunctionIntHash32 ; <nl> - else if ( name = = " intHash64 " ) return new FunctionIntHash64 ; <nl> - <nl> - else if ( name = = " IPv4NumToString " ) return new FunctionIPv4NumToString ; <nl> - else if ( name = = " IPv4StringToNum " ) return new FunctionIPv4StringToNum ; <nl> - else if ( name = = " hex " ) return new FunctionHex ; <nl> - else if ( name = = " unhex " ) return new FunctionUnhex ; <nl> - else if ( name = = " bitmaskToList " ) return new FunctionBitmaskToList ; <nl> - else if ( name = = " bitmaskToArray " ) return new FunctionBitmaskToArray ; <nl> - <nl> - else if ( name = = " rand " ) return new FunctionRand ; <nl> - else if ( name = = " rand64 " ) return new FunctionRand64 ; <nl> - <nl> - else if ( name = = " protocol " ) return new FunctionProtocol ; <nl> - else if ( name = = " domain " ) return new FunctionDomain ; <nl> - else if ( name = = " domainWithoutWWW " ) return new FunctionDomainWithoutWWW ; <nl> - else if ( name = = " topLevelDomain " ) return new FunctionTopLevelDomain ; <nl> - else if ( name = = " path " ) return new FunctionPath ; <nl> - else if ( name = = " queryString " ) return new FunctionQueryString ; <nl> - else if ( name = = " fragment " ) return new FunctionFragment ; <nl> - else if ( name = = " queryStringAndFragment " ) return new FunctionQueryStringAndFragment ; <nl> - else if ( name = = " extractURLParameter " ) return new FunctionExtractURLParameter ; <nl> - else if ( name = = " extractURLParameters " ) return new FunctionExtractURLParameters ; <nl> - else if ( name = = " extractURLParameterNames " ) return new FunctionExtractURLParameterNames ; <nl> - else if ( name = = " URLHierarchy " ) return new FunctionURLHierarchy ; <nl> - else if ( name = = " URLPathHierarchy " ) return new FunctionURLPathHierarchy ; <nl> - else if ( name = = " cutWWW " ) return new FunctionCutWWW ; <nl> - else if ( name = = " cutQueryString " ) return new FunctionCutQueryString ; <nl> - else if ( name = = " cutFragment " ) return new FunctionCutFragment ; <nl> - else if ( name = = " cutQueryStringAndFragment " ) return new FunctionCutQueryStringAndFragment ; <nl> - else if ( name = = " cutURLParameter " ) return new FunctionCutURLParameter ; <nl> - <nl> - else if ( name = = " hostName " ) return new FunctionHostName ; <nl> - else if ( name = = " visibleWidth " ) return new FunctionVisibleWidth ; <nl> - else if ( name = = " bar " ) return new FunctionBar ; <nl> - else if ( name = = " toTypeName " ) return new FunctionToTypeName ; <nl> - else if ( name = = " blockSize " ) return new FunctionBlockSize ; <nl> - else if ( name = = " sleep " ) return new FunctionSleep ; <nl> - else if ( name = = " materialize " ) return new FunctionMaterialize ; <nl> - else if ( name = = " ignore " ) return new FunctionIgnore ; <nl> - else if ( name = = " arrayJoin " ) return new FunctionArrayJoin ; <nl> - <nl> - else if ( name = = " tuple " ) return new FunctionTuple ; <nl> - else if ( name = = " tupleElement " ) return new FunctionTupleElement ; <nl> - else if ( name = = " in " ) return new FunctionIn ( false , false ) ; <nl> - else if ( name = = " notIn " ) return new FunctionIn ( true , false ) ; <nl> - else if ( name = = " globalIn " ) return new FunctionIn ( false , true ) ; <nl> - else if ( name = = " globalNotIn " ) return new FunctionIn ( true , true ) ; <nl> - <nl> - else if ( name = = " array " ) return new FunctionArray ; <nl> - else if ( name = = " arrayElement " ) return new FunctionArrayElement ; <nl> - else if ( name = = " has " ) return new FunctionHas ; <nl> - else if ( name = = " indexOf " ) return new FunctionIndexOf ; <nl> - else if ( name = = " countEqual " ) return new FunctionCountEqual ; <nl> - else if ( name = = " arrayEnumerate " ) return new FunctionArrayEnumerate ; <nl> - else if ( name = = " arrayEnumerateUniq " ) return new FunctionArrayEnumerateUniq ; <nl> - <nl> - else if ( name = = " arrayMap " ) return new FunctionArrayMap ; <nl> - else if ( name = = " arrayFilter " ) return new FunctionArrayFilter ; <nl> - else if ( name = = " arrayCount " ) return new FunctionArrayCount ; <nl> - else if ( name = = " arrayExists " ) return new FunctionArrayExists ; <nl> - else if ( name = = " arrayAll " ) return new FunctionArrayAll ; <nl> - else if ( name = = " arraySum " ) return new FunctionArraySum ; <nl> - <nl> - else if ( name = = " alphaTokens " ) return new FunctionAlphaTokens ; <nl> - else if ( name = = " splitByChar " ) return new FunctionSplitByChar ; <nl> - else if ( name = = " splitByString " ) return new FunctionSplitByString ; <nl> - <nl> - else if ( name = = " if " ) return new FunctionIf ; <nl> - <nl> - else if ( name = = " regionToCity " ) return new FunctionRegionToCity ( context . getDictionaries ( ) . getRegionsHierarchies ( ) ) ; <nl> - else if ( name = = " regionToArea " ) return new FunctionRegionToArea ( context . getDictionaries ( ) . getRegionsHierarchies ( ) ) ; <nl> - else if ( name = = " regionToCountry " ) return new FunctionRegionToCountry ( context . getDictionaries ( ) . getRegionsHierarchies ( ) ) ; <nl> - else if ( name = = " regionToContinent " ) return new FunctionRegionToContinent ( context . getDictionaries ( ) . getRegionsHierarchies ( ) ) ; <nl> - else if ( name = = " OSToRoot " ) return new FunctionOSToRoot ( context . getDictionaries ( ) . getTechDataHierarchy ( ) ) ; <nl> - else if ( name = = " SEToRoot " ) return new FunctionSEToRoot ( context . getDictionaries ( ) . getTechDataHierarchy ( ) ) ; <nl> - else if ( name = = " categoryToRoot " ) return new FunctionCategoryToRoot ( context . getDictionaries ( ) . getCategoriesHierarchy ( ) ) ; <nl> - else if ( name = = " categoryToSecondLevel " ) return new FunctionCategoryToSecondLevel ( context . getDictionaries ( ) . getCategoriesHierarchy ( ) ) ; <nl> - else if ( name = = " regionIn " ) return new FunctionRegionIn ( context . getDictionaries ( ) . getRegionsHierarchies ( ) ) ; <nl> - else if ( name = = " OSIn " ) return new FunctionOSIn ( context . getDictionaries ( ) . getTechDataHierarchy ( ) ) ; <nl> - else if ( name = = " SEIn " ) return new FunctionSEIn ( context . getDictionaries ( ) . getTechDataHierarchy ( ) ) ; <nl> - else if ( name = = " categoryIn " ) return new FunctionCategoryIn ( context . getDictionaries ( ) . getCategoriesHierarchy ( ) ) ; <nl> - else if ( name = = " regionHierarchy " ) return new FunctionRegionHierarchy ( context . getDictionaries ( ) . getRegionsHierarchies ( ) ) ; <nl> - else if ( name = = " OSHierarchy " ) return new FunctionOSHierarchy ( context . getDictionaries ( ) . getTechDataHierarchy ( ) ) ; <nl> - else if ( name = = " SEHierarchy " ) return new FunctionSEHierarchy ( context . getDictionaries ( ) . getTechDataHierarchy ( ) ) ; <nl> - else if ( name = = " categoryHierarchy " ) return new FunctionCategoryHierarchy ( context . getDictionaries ( ) . getCategoriesHierarchy ( ) ) ; <nl> - else if ( name = = " regionToName " ) return new FunctionRegionToName ( context . getDictionaries ( ) . getRegionsNames ( ) ) ; <nl> - <nl> - else if ( name = = " visitParamHas " ) return new FunctionVisitParamHas ; <nl> - else if ( name = = " visitParamExtractUInt " ) return new FunctionVisitParamExtractUInt ; <nl> - else if ( name = = " visitParamExtractInt " ) return new FunctionVisitParamExtractInt ; <nl> - else if ( name = = " visitParamExtractFloat " ) return new FunctionVisitParamExtractFloat ; <nl> - else if ( name = = " visitParamExtractBool " ) return new FunctionVisitParamExtractBool ; <nl> - else if ( name = = " visitParamExtractRaw " ) return new FunctionVisitParamExtractRaw ; <nl> - else if ( name = = " visitParamExtractString " ) return new FunctionVisitParamExtractString ; <nl> + static const std : : unordered_map < <nl> + std : : string , <nl> + std : : function < IFunction * ( const Context & context ) > > functions = <nl> + { <nl> + # define F [ ] ( const Context & context ) <nl> + { " plus " , F { return new FunctionPlus ; } } , <nl> + { " minus " , F { return new FunctionMinus ; } } , <nl> + { " multiply " , F { return new FunctionMultiply ; } } , <nl> + { " divide " , F { return new FunctionDivideFloating ; } } , <nl> + { " intDiv " , F { return new FunctionDivideIntegral ; } } , <nl> + { " modulo " , F { return new FunctionModulo ; } } , <nl> + { " negate " , F { return new FunctionNegate ; } } , <nl> + { " bitAnd " , F { return new FunctionBitAnd ; } } , <nl> + { " bitOr " , F { return new FunctionBitOr ; } } , <nl> + { " bitXor " , F { return new FunctionBitXor ; } } , <nl> + { " bitNot " , F { return new FunctionBitNot ; } } , <nl> + { " bitShiftLeft " , F { return new FunctionBitShiftLeft ; } } , <nl> + { " bitShiftRight " , F { return new FunctionBitShiftRight ; } } , <nl> <nl> + { " equals " , F { return new FunctionEquals ; } } , <nl> + { " notEquals " , F { return new FunctionNotEquals ; } } , <nl> + { " less " , F { return new FunctionLess ; } } , <nl> + { " greater " , F { return new FunctionGreater ; } } , <nl> + { " lessOrEquals " , F { return new FunctionLessOrEquals ; } } , <nl> + { " greaterOrEquals " , F { return new FunctionGreaterOrEquals ; } } , <nl> + <nl> + { " and " , F { return new FunctionAnd ; } } , <nl> + { " or " , F { return new FunctionOr ; } } , <nl> + { " xor " , F { return new FunctionXor ; } } , <nl> + { " not " , F { return new FunctionNot ; } } , <nl> + <nl> + { " roundToExp2 " , F { return new FunctionRoundToExp2 ; } } , <nl> + { " roundDuration " , F { return new FunctionRoundDuration ; } } , <nl> + { " roundAge " , F { return new FunctionRoundAge ; } } , <nl> + <nl> + { " empty " , F { return new FunctionEmpty ; } } , <nl> + { " notEmpty " , F { return new FunctionNotEmpty ; } } , <nl> + { " length " , F { return new FunctionLength ; } } , <nl> + { " lengthUTF8 " , F { return new FunctionLengthUTF8 ; } } , <nl> + { " lower " , F { return new FunctionLower ; } } , <nl> + { " upper " , F { return new FunctionUpper ; } } , <nl> + { " lowerUTF8 " , F { return new FunctionLowerUTF8 ; } } , <nl> + { " upperUTF8 " , F { return new FunctionUpperUTF8 ; } } , <nl> + { " reverse " , F { return new FunctionReverse ; } } , <nl> + { " reverseUTF8 " , F { return new FunctionReverseUTF8 ; } } , <nl> + { " concat " , F { return new FunctionConcat ; } } , <nl> + { " substring " , F { return new FunctionSubstring ; } } , <nl> + { " replaceOne " , F { return new FunctionReplaceOne ; } } , <nl> + { " replaceAll " , F { return new FunctionReplaceAll ; } } , <nl> + { " replaceRegexpOne " , F { return new FunctionReplaceRegexpOne ; } } , <nl> + { " replaceRegexpAll " , F { return new FunctionReplaceRegexpAll ; } } , <nl> + { " substringUTF8 " , F { return new FunctionSubstringUTF8 ; } } , <nl> + <nl> + { " toUInt8 " , F { return new FunctionToUInt8 ; } } , <nl> + { " toUInt16 " , F { return new FunctionToUInt16 ; } } , <nl> + { " toUInt32 " , F { return new FunctionToUInt32 ; } } , <nl> + { " toUInt64 " , F { return new FunctionToUInt64 ; } } , <nl> + { " toInt8 " , F { return new FunctionToInt8 ; } } , <nl> + { " toInt16 " , F { return new FunctionToInt16 ; } } , <nl> + { " toInt32 " , F { return new FunctionToInt32 ; } } , <nl> + { " toInt64 " , F { return new FunctionToInt64 ; } } , <nl> + { " toFloat32 " , F { return new FunctionToFloat32 ; } } , <nl> + { " toFloat64 " , F { return new FunctionToFloat64 ; } } , <nl> + { " toDate " , F { return new FunctionToDate ; } } , <nl> + { " toDateTime " , F { return new FunctionToDateTime ; } } , <nl> + { " toString " , F { return new FunctionToString ; } } , <nl> + { " toFixedString " , F { return new FunctionToFixedString ; } } , <nl> + { " toStringCutToZero " , F { return new FunctionToStringCutToZero ; } } , <nl> + <nl> + { " reinterpretAsUInt8 " , F { return new FunctionReinterpretAsUInt8 ; } } , <nl> + { " reinterpretAsUInt16 " , F { return new FunctionReinterpretAsUInt16 ; } } , <nl> + { " reinterpretAsUInt32 " , F { return new FunctionReinterpretAsUInt32 ; } } , <nl> + { " reinterpretAsUInt64 " , F { return new FunctionReinterpretAsUInt64 ; } } , <nl> + { " reinterpretAsInt8 " , F { return new FunctionReinterpretAsInt8 ; } } , <nl> + { " reinterpretAsInt16 " , F { return new FunctionReinterpretAsInt16 ; } } , <nl> + { " reinterpretAsInt32 " , F { return new FunctionReinterpretAsInt32 ; } } , <nl> + { " reinterpretAsInt64 " , F { return new FunctionReinterpretAsInt64 ; } } , <nl> + { " reinterpretAsFloat32 " , F { return new FunctionReinterpretAsFloat32 ; } } , <nl> + { " reinterpretAsFloat64 " , F { return new FunctionReinterpretAsFloat64 ; } } , <nl> + { " reinterpretAsDate " , F { return new FunctionReinterpretAsDate ; } } , <nl> + { " reinterpretAsDateTime " , F { return new FunctionReinterpretAsDateTime ; } } , <nl> + { " reinterpretAsString " , F { return new FunctionReinterpretAsString ; } } , <nl> + <nl> + { " toYear " , F { return new FunctionToYear ; } } , <nl> + { " toMonth " , F { return new FunctionToMonth ; } } , <nl> + { " toDayOfMonth " , F { return new FunctionToDayOfMonth ; } } , <nl> + { " toDayOfWeek " , F { return new FunctionToDayOfWeek ; } } , <nl> + { " toHour " , F { return new FunctionToHour ; } } , <nl> + { " toMinute " , F { return new FunctionToMinute ; } } , <nl> + { " toSecond " , F { return new FunctionToSecond ; } } , <nl> + { " toMonday " , F { return new FunctionToMonday ; } } , <nl> + { " toStartOfMonth " , F { return new FunctionToStartOfMonth ; } } , <nl> + { " toStartOfQuarter " , F { return new FunctionToStartOfQuarter ; } } , <nl> + { " toStartOfYear " , F { return new FunctionToStartOfYear ; } } , <nl> + { " toStartOfMinute " , F { return new FunctionToStartOfMinute ; } } , <nl> + { " toStartOfHour " , F { return new FunctionToStartOfHour ; } } , <nl> + { " toRelativeYearNum " , F { return new FunctionToRelativeYearNum ; } } , <nl> + { " toRelativeMonthNum " , F { return new FunctionToRelativeMonthNum ; } } , <nl> + { " toRelativeWeekNum " , F { return new FunctionToRelativeWeekNum ; } } , <nl> + { " toRelativeDayNum " , F { return new FunctionToRelativeDayNum ; } } , <nl> + { " toRelativeHourNum " , F { return new FunctionToRelativeHourNum ; } } , <nl> + { " toRelativeMinuteNum " , F { return new FunctionToRelativeMinuteNum ; } } , <nl> + { " toRelativeSecondNum " , F { return new FunctionToRelativeSecondNum ; } } , <nl> + { " toTime " , F { return new FunctionToTime ; } } , <nl> + { " now " , F { return new FunctionNow ; } } , <nl> + { " timeSlot " , F { return new FunctionTimeSlot ; } } , <nl> + { " timeSlots " , F { return new FunctionTimeSlots ; } } , <nl> + <nl> + { " position " , F { return new FunctionPosition ; } } , <nl> + { " positionUTF8 " , F { return new FunctionPositionUTF8 ; } } , <nl> + { " match " , F { return new FunctionMatch ; } } , <nl> + { " like " , F { return new FunctionLike ; } } , <nl> + { " notLike " , F { return new FunctionNotLike ; } } , <nl> + { " extract " , F { return new FunctionExtract ; } } , <nl> + { " extractAll " , F { return new FunctionExtractAll ; } } , <nl> + <nl> + { " halfMD5 " , F { return new FunctionHalfMD5 ; } } , <nl> + { " sipHash64 " , F { return new FunctionSipHash64 ; } } , <nl> + { " cityHash64 " , F { return new FunctionCityHash64 ; } } , <nl> + { " intHash32 " , F { return new FunctionIntHash32 ; } } , <nl> + { " intHash64 " , F { return new FunctionIntHash64 ; } } , <nl> + <nl> + { " IPv4NumToString " , F { return new FunctionIPv4NumToString ; } } , <nl> + { " IPv4StringToNum " , F { return new FunctionIPv4StringToNum ; } } , <nl> + { " hex " , F { return new FunctionHex ; } } , <nl> + { " unhex " , F { return new FunctionUnhex ; } } , <nl> + { " bitmaskToList " , F { return new FunctionBitmaskToList ; } } , <nl> + { " bitmaskToArray " , F { return new FunctionBitmaskToArray ; } } , <nl> + <nl> + { " rand " , F { return new FunctionRand ; } } , <nl> + { " rand64 " , F { return new FunctionRand64 ; } } , <nl> + <nl> + { " protocol " , F { return new FunctionProtocol ; } } , <nl> + { " domain " , F { return new FunctionDomain ; } } , <nl> + { " domainWithoutWWW " , F { return new FunctionDomainWithoutWWW ; } } , <nl> + { " topLevelDomain " , F { return new FunctionTopLevelDomain ; } } , <nl> + { " path " , F { return new FunctionPath ; } } , <nl> + { " queryString " , F { return new FunctionQueryString ; } } , <nl> + { " fragment " , F { return new FunctionFragment ; } } , <nl> + { " queryStringAndFragment " , F { return new FunctionQueryStringAndFragment ; } } , <nl> + { " extractURLParameter " , F { return new FunctionExtractURLParameter ; } } , <nl> + { " extractURLParameters " , F { return new FunctionExtractURLParameters ; } } , <nl> + { " extractURLParameterNames " , F { return new FunctionExtractURLParameterNames ; } } , <nl> + { " URLHierarchy " , F { return new FunctionURLHierarchy ; } } , <nl> + { " URLPathHierarchy " , F { return new FunctionURLPathHierarchy ; } } , <nl> + { " cutWWW " , F { return new FunctionCutWWW ; } } , <nl> + { " cutQueryString " , F { return new FunctionCutQueryString ; } } , <nl> + { " cutFragment " , F { return new FunctionCutFragment ; } } , <nl> + { " cutQueryStringAndFragment " , F { return new FunctionCutQueryStringAndFragment ; } } , <nl> + { " cutURLParameter " , F { return new FunctionCutURLParameter ; } } , <nl> + <nl> + { " hostName " , F { return new FunctionHostName ; } } , <nl> + { " visibleWidth " , F { return new FunctionVisibleWidth ; } } , <nl> + { " bar " , F { return new FunctionBar ; } } , <nl> + { " toTypeName " , F { return new FunctionToTypeName ; } } , <nl> + { " blockSize " , F { return new FunctionBlockSize ; } } , <nl> + { " sleep " , F { return new FunctionSleep ; } } , <nl> + { " materialize " , F { return new FunctionMaterialize ; } } , <nl> + { " ignore " , F { return new FunctionIgnore ; } } , <nl> + { " arrayJoin " , F { return new FunctionArrayJoin ; } } , <nl> + <nl> + { " tuple " , F { return new FunctionTuple ; } } , <nl> + { " tupleElement " , F { return new FunctionTupleElement ; } } , <nl> + { " in " , F { return new FunctionIn ( false , false ) ; } } , <nl> + { " notIn " , F { return new FunctionIn ( true , false ) ; } } , <nl> + { " globalIn " , F { return new FunctionIn ( false , true ) ; } } , <nl> + { " globalNotIn " , F { return new FunctionIn ( true , true ) ; } } , <nl> + <nl> + { " array " , F { return new FunctionArray ; } } , <nl> + { " arrayElement " , F { return new FunctionArrayElement ; } } , <nl> + { " has " , F { return new FunctionHas ; } } , <nl> + { " indexOf " , F { return new FunctionIndexOf ; } } , <nl> + { " countEqual " , F { return new FunctionCountEqual ; } } , <nl> + { " arrayEnumerate " , F { return new FunctionArrayEnumerate ; } } , <nl> + { " arrayEnumerateUniq " , F { return new FunctionArrayEnumerateUniq ; } } , <nl> + <nl> + { " arrayMap " , F { return new FunctionArrayMap ; } } , <nl> + { " arrayFilter " , F { return new FunctionArrayFilter ; } } , <nl> + { " arrayCount " , F { return new FunctionArrayCount ; } } , <nl> + { " arrayExists " , F { return new FunctionArrayExists ; } } , <nl> + { " arrayAll " , F { return new FunctionArrayAll ; } } , <nl> + { " arraySum " , F { return new FunctionArraySum ; } } , <nl> + <nl> + { " alphaTokens " , F { return new FunctionAlphaTokens ; } } , <nl> + { " splitByChar " , F { return new FunctionSplitByChar ; } } , <nl> + { " splitByString " , F { return new FunctionSplitByString ; } } , <nl> + <nl> + { " if " , F { return new FunctionIf ; } } , <nl> + <nl> + { " regionToCity " , F { return new FunctionRegionToCity ( context . getDictionaries ( ) . getRegionsHierarchies ( ) ) ; } } , <nl> + { " regionToArea " , F { return new FunctionRegionToArea ( context . getDictionaries ( ) . getRegionsHierarchies ( ) ) ; } } , <nl> + { " regionToCountry " , F { return new FunctionRegionToCountry ( context . getDictionaries ( ) . getRegionsHierarchies ( ) ) ; } } , <nl> + { " regionToContinent " , F { return new FunctionRegionToContinent ( context . getDictionaries ( ) . getRegionsHierarchies ( ) ) ; } } , <nl> + { " OSToRoot " , F { return new FunctionOSToRoot ( context . getDictionaries ( ) . getTechDataHierarchy ( ) ) ; } } , <nl> + { " SEToRoot " , F { return new FunctionSEToRoot ( context . getDictionaries ( ) . getTechDataHierarchy ( ) ) ; } } , <nl> + { " categoryToRoot " , F { return new FunctionCategoryToRoot ( context . getDictionaries ( ) . getCategoriesHierarchy ( ) ) ; } } , <nl> + { " categoryToSecondLevel " , F { return new FunctionCategoryToSecondLevel ( context . getDictionaries ( ) . getCategoriesHierarchy ( ) ) ; } } , <nl> + { " regionIn " , F { return new FunctionRegionIn ( context . getDictionaries ( ) . getRegionsHierarchies ( ) ) ; } } , <nl> + { " OSIn " , F { return new FunctionOSIn ( context . getDictionaries ( ) . getTechDataHierarchy ( ) ) ; } } , <nl> + { " SEIn " , F { return new FunctionSEIn ( context . getDictionaries ( ) . getTechDataHierarchy ( ) ) ; } } , <nl> + { " categoryIn " , F { return new FunctionCategoryIn ( context . getDictionaries ( ) . getCategoriesHierarchy ( ) ) ; } } , <nl> + { " regionHierarchy " , F { return new FunctionRegionHierarchy ( context . getDictionaries ( ) . getRegionsHierarchies ( ) ) ; } } , <nl> + { " OSHierarchy " , F { return new FunctionOSHierarchy ( context . getDictionaries ( ) . getTechDataHierarchy ( ) ) ; } } , <nl> + { " SEHierarchy " , F { return new FunctionSEHierarchy ( context . getDictionaries ( ) . getTechDataHierarchy ( ) ) ; } } , <nl> + { " categoryHierarchy " , F { return new FunctionCategoryHierarchy ( context . getDictionaries ( ) . getCategoriesHierarchy ( ) ) ; } } , <nl> + { " regionToName " , F { return new FunctionRegionToName ( context . getDictionaries ( ) . getRegionsNames ( ) ) ; } } , <nl> + <nl> + { " visitParamHas " , F { return new FunctionVisitParamHas ; } } , <nl> + { " visitParamExtractUInt " , F { return new FunctionVisitParamExtractUInt ; } } , <nl> + { " visitParamExtractInt " , F { return new FunctionVisitParamExtractInt ; } } , <nl> + { " visitParamExtractFloat " , F { return new FunctionVisitParamExtractFloat ; } } , <nl> + { " visitParamExtractBool " , F { return new FunctionVisitParamExtractBool ; } } , <nl> + { " visitParamExtractRaw " , F { return new FunctionVisitParamExtractRaw ; } } , <nl> + { " visitParamExtractString " , F { return new FunctionVisitParamExtractString ; } } , <nl> + } ; <nl> + <nl> + auto it = functions . find ( name ) ; <nl> + if ( functions . end ( ) ! = it ) <nl> + return it - > second ( context ) ; <nl> else <nl> throw Exception ( " Unknown function " + name , ErrorCodes : : UNKNOWN_FUNCTION ) ; <nl> } <nl> | dbms : little better [ # METR - 2944 ] . | ClickHouse/ClickHouse | 6a3f2047059b00b99b6db8097a47d2b7ebf1122c | 2014-08-18T00:07:05Z |
mmm a / fdbrpc / FlowTransport . actor . cpp <nl> ppp b / fdbrpc / FlowTransport . actor . cpp <nl> struct EndpointNotFoundReceiver final : NetworkMessageReceiver { <nl> EndpointNotFoundReceiver ( EndpointMap & endpoints ) { <nl> endpoints . insertWellKnown ( this , WLTOKEN_ENDPOINT_NOT_FOUND , TaskPriority : : DefaultEndpoint ) ; <nl> } <nl> + <nl> void receive ( ArenaObjectReader & reader ) override { <nl> - / / Remote machine tells us it doesn ' t have endpoint e <nl> Endpoint e ; <nl> reader . deserialize ( e ) ; <nl> IFailureMonitor : : failureMonitor ( ) . endpointNotFound ( e ) ; <nl> mmm a / fdbserver / SimulatedCluster . actor . cpp <nl> ppp b / fdbserver / SimulatedCluster . actor . cpp <nl> void setupSimulatedSystem ( vector < Future < Void > > * systemActors , std : : string baseFo <nl> } <nl> <nl> void checkTestConf ( const char * testFile , int & extraDB , int & minimumReplication , int & minimumRegions , <nl> + < < < < < < < HEAD <nl> int & configureLocked , int & logAntiQuorum , bool & startIncompatibleProcess ) { <nl> + = = = = = = = <nl> + int & configureLocked , bool & startIncompatibleProcess ) { <nl> + > > > > > > > 8c96763ea96f39c55a881b391d95a717207a5683 <nl> std : : ifstream ifs ; <nl> ifs . open ( testFile , std : : ifstream : : in ) ; <nl> if ( ! ifs . good ( ) ) <nl> ACTOR void setupAndRun ( std : : string dataFolder , const char * testFile , bool reboot <nl> else { <nl> g_expect_full_pointermap = 1 ; <nl> setupSimulatedSystem ( & systemActors , dataFolder , & testerCount , & connFile , & startingConfiguration , extraDB , <nl> + < < < < < < < HEAD <nl> minimumReplication , minimumRegions , whitelistBinPaths , configureLocked , logAntiQuorum , protocolVersion ) ; <nl> + = = = = = = = <nl> + minimumReplication , minimumRegions , whitelistBinPaths , configureLocked , protocolVersion ) ; <nl> + > > > > > > > 8c96763ea96f39c55a881b391d95a717207a5683 <nl> wait ( delay ( 1 . 0 ) ) ; / / FIXME : WHY ! ! ! / / wait for machines to boot <nl> } <nl> std : : string clusterFileDir = joinPath ( dataFolder , deterministicRandom ( ) - > randomUniqueID ( ) . toString ( ) ) ; <nl> | fix merge conflicts | apple/foundationdb | f2a8687c7c2e69ac4d99e57035c044c88f1bb503 | 2020-10-19T17:00:41Z |
mmm a / tests / cpp - tests / Classes / ShaderTest / ShaderTest . cpp <nl> ppp b / tests / cpp - tests / Classes / ShaderTest / ShaderTest . cpp <nl> <nl> <nl> static int sceneIdx = - 1 ; <nl> <nl> - # define MAX_LAYER 9 <nl> + # define MAX_LAYER 8 <nl> <nl> static Layer * createShaderLayer ( int nIndex ) <nl> { <nl> static Layer * createShaderLayer ( int nIndex ) <nl> case 5 : return new ShaderPlasma ( ) ; <nl> case 6 : return new ShaderBlur ( ) ; <nl> case 7 : return new ShaderRetroEffect ( ) ; <nl> - case 8 : return new ShaderFail ( ) ; <nl> } <nl> <nl> return NULL ; <nl> std : : string ShaderRetroEffect : : subtitle ( ) const <nl> return " sin ( ) effect with moving colors " ; <nl> } <nl> <nl> - / / ShaderFail <nl> - const GLchar * shader_frag_fail = " \ n \ <nl> - # ifdef GL_ES \ n \ <nl> - precision lowp float ; \ n \ <nl> - # endif \ n \ <nl> - \ n \ <nl> - varying vec2 v_texCoord ; \ n \ <nl> - uniform sampler2D CC_Texture0 ; \ n \ <nl> - \ n \ <nl> - vec4 colors [ 10 ] ; \ n \ <nl> - \ n \ <nl> - void main ( void ) \ n \ <nl> - { \ n \ <nl> - colors [ 0 ] = vec4 ( 1 , 0 , 0 , 1 ) ; \ n \ <nl> - colors [ 1 ] = vec4 ( 0 , 1 , 0 , 1 ) ; \ n \ <nl> - colors [ 2 ] = vec4 ( 0 , 0 , 1 , 1 ) ; \ n \ <nl> - colors [ 3 ] = vec4 ( 0 , 1 , 1 , 1 ) ; \ n \ <nl> - colors [ 4 ] = vec4 ( 1 , 0 , 1 , 1 ) ; \ n \ <nl> - colors [ 5 ] = vec4 ( 1 , 1 , 0 , 1 ) ; \ n \ <nl> - colors [ 6 ] = vec4 ( 1 , 1 , 1 , 1 ) ; \ n \ <nl> - colors [ 7 ] = vec4 ( 1 , 0 . 5 , 0 , 1 ) ; \ n \ <nl> - colors [ 8 ] = vec4 ( 1 , 0 . 5 , 0 . 5 , 1 ) ; \ n \ <nl> - colors [ 9 ] = vec4 ( 0 . 5 , 0 . 5 , 1 , 1 ) ; \ n \ <nl> - \ n \ <nl> - int y = int ( mod ( gl_FragCoord . y / 3 . 0 , 10 . 0 ) ) ; \ n \ <nl> - gl_FragColor = colors [ z ] * texture2D ( CC_Texture0 , v_texCoord ) ; \ n \ <nl> - } \ n \ <nl> - \ n " ; <nl> - <nl> - ShaderFail : : ShaderFail ( ) <nl> - { <nl> - auto p = new GLProgram ( ) ; <nl> - p - > initWithByteArrays ( ccPositionTexture_vert , shader_frag_fail ) ; <nl> - <nl> - p - > bindAttribLocation ( GLProgram : : ATTRIBUTE_NAME_POSITION , GLProgram : : VERTEX_ATTRIB_POSITION ) ; <nl> - p - > bindAttribLocation ( GLProgram : : ATTRIBUTE_NAME_TEX_COORD , GLProgram : : VERTEX_ATTRIB_TEX_COORDS ) ; <nl> - <nl> - p - > link ( ) ; <nl> - p - > updateUniforms ( ) ; <nl> - p - > release ( ) ; <nl> - } <nl> - <nl> - std : : string ShaderFail : : title ( ) const <nl> - { <nl> - return " Shader : Invalid shader " ; <nl> - } <nl> - <nl> - std : : string ShaderFail : : subtitle ( ) const <nl> - { <nl> - return " See console for output with useful error log " ; <nl> - } <nl> - <nl> / / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> / / <nl> / / ShaderTestScene <nl> mmm a / tests / cpp - tests / Classes / ShaderTest / ShaderTest . h <nl> ppp b / tests / cpp - tests / Classes / ShaderTest / ShaderTest . h <nl> class ShaderNode : public Node <nl> CustomCommand _customCommand ; <nl> } ; <nl> <nl> - class ShaderFail : public ShaderTestDemo <nl> - { <nl> - public : <nl> - ShaderFail ( ) ; <nl> - virtual std : : string title ( ) const override ; <nl> - virtual std : : string subtitle ( ) const override ; <nl> - } ; <nl> - <nl> class ShaderTestScene : public TestScene <nl> { <nl> public : <nl> | Merge pull request from shujunqiao / testcpp - shader | cocos2d/cocos2d-x | 0db1bbdf68a17edc5c23d1a4cc6869a5e32286a8 | 2014-04-08T07:47:01Z |
mmm a / tools / make - package / config . json <nl> ppp b / tools / make - package / config . json <nl> <nl> " zip_file_path " : " . . / cocos2d - console " , <nl> " extract_to_zip_path " : " tools / cocos2d - console " <nl> } <nl> - ] , <nl> - " extra_dirs " : <nl> - [ <nl> - " tools / fbx - conv " <nl> ] <nl> } <nl> mmm a / tools / make - package / git - archive - all <nl> ppp b / tools / make - package / git - archive - all <nl> class GitArchiver ( object ) : <nl> extra_folder_path = os . path . join ( self . main_repo_abspath , extra_folder_name ) <nl> extra_folders . append ( extra_folder_path ) <nl> extra_file_paths = self . unpack_zipfile ( zip_file_path , self . main_repo_abspath ) <nl> + <nl> + key_move_dirs = " move_dirs " <nl> for file_path in extra_file_paths : <nl> if file_path . find ( extra_folder_path ) = = - 1 : <nl> raise Exception ( " Couldn ' t find extra folder path ( % s ) in ( % s ) ! " % ( extra_folder_path , file_path ) ) <nl> <nl> path_in_zip = extra_to_zip_file + file_path [ ( len ( extra_folder_path ) ) : ] <nl> + if key_move_dirs in zip_config : <nl> + move_dirs = zip_config [ key_move_dirs ] <nl> + related_path = os . path . relpath ( file_path , extra_folder_path ) <nl> + temp_rel_path = related_path . replace ( ' \ \ ' , ' / ' ) <nl> + for move_dir in move_dirs : <nl> + if temp_rel_path . startswith ( move_dir ) : <nl> + move_to_dir = move_dirs [ move_dir ] <nl> + path_in_zip = os . path . join ( move_to_dir , related_path ) <nl> + break <nl> <nl> try : <nl> add ( file_path , path_in_zip ) <nl> class GitArchiver ( object ) : <nl> print ( ' add % s failed . ' % file_path ) <nl> pass <nl> <nl> - outfile_name , outfile_ext = path . splitext ( output_path ) <nl> - for extra_dir in config_data [ " extra_dirs " ] : <nl> - dir_path = path . join ( self . main_repo_abspath , extra_dir ) <nl> - list_dirs = os . walk ( dir_path ) <nl> - for root , dirs , files in list_dirs : <nl> - for f in files : <nl> - file_path = path . join ( root , f ) <nl> - path_in_zip = file_path [ ( len ( self . main_repo_abspath ) + 1 ) : ] <nl> - try : <nl> - add ( file_path , path_in_zip ) <nl> - except : <nl> - print ( ' add % s failed . ' % file_path ) <nl> - pass <nl> + key_extra_dirs = " extra_dirs " <nl> + if key_extra_dirs in config_data : <nl> + for extra_dir in config_data [ key_extra_dirs ] : <nl> + dir_path = path . join ( self . main_repo_abspath , extra_dir ) <nl> + list_dirs = os . walk ( dir_path ) <nl> + for root , dirs , files in list_dirs : <nl> + for f in files : <nl> + file_path = path . join ( root , f ) <nl> + path_in_zip = file_path [ ( len ( self . main_repo_abspath ) + 1 ) : ] <nl> + try : <nl> + add ( file_path , path_in_zip ) <nl> + except : <nl> + print ( ' add % s failed . ' % file_path ) <nl> + pass <nl> <nl> if not dry_run : <nl> archive . close ( ) <nl> | Solve the error in git - archive - all tools . | cocos2d/cocos2d-x | 6a61f1de400b6085694009d3b78241f18de56bd2 | 2015-06-25T03:23:27Z |
mmm a / language / English / strings . po <nl> ppp b / language / English / strings . po <nl> msgctxt " # 170 " <nl> msgid " Adjust display refresh rate to match video " <nl> msgstr " " <nl> <nl> - # empty string with id 171 <nl> + # : xbmc / playlists / SmartPlayList . cpp <nl> + # : xbmc / utils / SortUtils . cpp <nl> + msgctxt " # 171 " <nl> + msgid " Sort title " <nl> + msgstr " " <nl> <nl> msgctxt " # 172 " <nl> msgid " Release date " <nl> mmm a / xbmc / playlists / SmartPlayList . cpp <nl> ppp b / xbmc / playlists / SmartPlayList . cpp <nl> static const translateField fields [ ] = { <nl> { " type " , FieldAlbumType , SortByAlbumType , CSmartPlaylistRule : : TEXT_FIELD , false , 564 } , <nl> { " label " , FieldMusicLabel , SortByNone , CSmartPlaylistRule : : TEXT_FIELD , false , 21899 } , <nl> { " title " , FieldTitle , SortByTitle , CSmartPlaylistRule : : TEXT_FIELD , true , 556 } , <nl> - { " sorttitle " , FieldSortTitle , SortBySortTitle , CSmartPlaylistRule : : TEXT_FIELD , false , 556 } , <nl> + { " sorttitle " , FieldSortTitle , SortBySortTitle , CSmartPlaylistRule : : TEXT_FIELD , false , 171 } , <nl> { " year " , FieldYear , SortByYear , CSmartPlaylistRule : : NUMERIC_FIELD , true , 562 } , <nl> { " time " , FieldTime , SortByTime , CSmartPlaylistRule : : SECONDS_FIELD , false , 180 } , <nl> { " playcount " , FieldPlaycount , SortByPlaycount , CSmartPlaylistRule : : NUMERIC_FIELD , false , 567 } , <nl> mmm a / xbmc / utils / SortUtils . cpp <nl> ppp b / xbmc / utils / SortUtils . cpp <nl> const sort_map table [ ] = { <nl> { SortByFile , SORT_METHOD_FILE , SortAttributeIgnoreFolders , 561 } , <nl> { SortByRating , SORT_METHOD_SONG_RATING , SortAttributeNone , 563 } , <nl> { SortByRating , SORT_METHOD_VIDEO_RATING , SortAttributeIgnoreFolders , 563 } , <nl> - { SortBySortTitle , SORT_METHOD_VIDEO_SORT_TITLE , SortAttributeIgnoreFolders , 556 } , <nl> - { SortBySortTitle , SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE , ( SortAttribute ) ( SortAttributeIgnoreFolders | SortAttributeIgnoreArticle ) , 556 } , <nl> + { SortBySortTitle , SORT_METHOD_VIDEO_SORT_TITLE , SortAttributeIgnoreFolders , 171 } , <nl> + { SortBySortTitle , SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE , ( SortAttribute ) ( SortAttributeIgnoreFolders | SortAttributeIgnoreArticle ) , 171 } , <nl> { SortByYear , SORT_METHOD_YEAR , SortAttributeIgnoreFolders , 562 } , <nl> { SortByProductionCode , SORT_METHOD_PRODUCTIONCODE , SortAttributeNone , 20368 } , <nl> { SortByProgramCount , SORT_METHOD_PROGRAM_COUNT , SortAttributeNone , 567 } , / / label is " play count " <nl> | add new language string for sort title | xbmc/xbmc | 20862a150e8bfc43294c0630e76b12ac5ea8c6fe | 2013-09-08T17:52:33Z |
mmm a / CHANGELOG <nl> ppp b / CHANGELOG <nl> <nl> v3 . 0 . 0 ( XXXX - XX - XX ) <nl> mmmmmmmmmmmmmmmmmm - <nl> <nl> + * renamed arangob tool to arangobench <nl> + <nl> * added AQL string comparison operator ` LIKE ` <nl> <nl> The operator can be used to compare strings like this : <nl> mmm a / CMakeLists . txt <nl> ppp b / CMakeLists . txt <nl> set ( ARANGODB_CONTACT " hackers @ arangodb . com " ) <nl> set ( ARANGODB_FRIENDLY_STRING " ArangoDB - the multi - model database " ) <nl> <nl> # MSVC <nl> - set ( ARANGOB_FRIENDLY_STRING " arangob - stress test program " ) <nl> + set ( ARANGO_BENCH_FRIENDLY_STRING " arangobench - stress test program " ) <nl> set ( ARANGO_DUMP_FRIENDLY_STRING " arangodump - export " ) <nl> set ( ARANGO_RESTORE_FRIENDLY_STRING " arangrestore - importer " ) <nl> set ( ARANGO_IMP_FRIENDLY_STRING " arangoimp - TSV / CSV / JSON importer " ) <nl> set ( LIB_ARANGO arango ) <nl> set ( LIB_ARANGO_V8 arango_v8 ) <nl> <nl> # binaries <nl> - set ( BIN_ARANGOB arangob ) <nl> + set ( BIN_ARANGOBENCH arangobench ) <nl> set ( BIN_ARANGOD arangod ) <nl> set ( BIN_ARANGODUMP arangodump ) <nl> set ( BIN_ARANGOIMP arangoimp ) <nl> if ( USE_BOOST_UNITTESTS ) <nl> endif ( ) <nl> add_subdirectory ( Documentation ) <nl> <nl> - add_dependencies ( arangob zlibstatic ) <nl> + add_dependencies ( arangobench zlibstatic ) <nl> add_dependencies ( arangod ev zlibstatic ) <nl> add_dependencies ( arangodump zlibstatic ) <nl> add_dependencies ( arangoimp zlibstatic ) <nl> add_dependencies ( arangorestore zlibstatic ) <nl> add_dependencies ( arangosh zlibstatic ) <nl> <nl> if ( NOT USE_PRECOMPILED_V8 ) <nl> - add_dependencies ( arangob v8_build ) <nl> + # all binaries depend on v8_build because it contains ICU as well <nl> + add_dependencies ( arangobench v8_build ) <nl> add_dependencies ( arangod v8_build ) <nl> add_dependencies ( arangodump v8_build ) <nl> add_dependencies ( arangoimp v8_build ) <nl> similarity index 94 % <nl> rename from Documentation / Books / Users / Advanced / Arangob . mdpp <nl> rename to Documentation / Books / Users / Advanced / Arangobench . mdpp <nl> mmm a / Documentation / Books / Users / Advanced / Arangob . mdpp <nl> ppp b / Documentation / Books / Users / Advanced / Arangobench . mdpp <nl> <nl> - ! CHAPTER Arangob <nl> + ! CHAPTER Arangobench <nl> <nl> - Arangob is ArangoDB ' s benchmark and test tool . It can be used to issue test <nl> + Arangobench is ArangoDB ' s benchmark and test tool . It can be used to issue test <nl> requests to the database for performance and server function testing . <nl> It supports parallel querying and batch requests . <nl> <nl> Related blog posts : <nl> <nl> ! SUBSECTION Examples <nl> <nl> - arangob <nl> + arangobench <nl> <nl> - Starts Arangob with the default user and server endpoint . <nl> + Starts Arangobench with the default user and server endpoint . <nl> <nl> - - test - case version - - requests 1000 - - concurrency 1 <nl> <nl> mmm a / Documentation / Books / Users / SUMMARY . md <nl> ppp b / Documentation / Books / Users / SUMMARY . md <nl> <nl> * [ Using jsUnity ] ( UsingJsUnity / README . md ) <nl> * [ Administrating ArangoDB ] ( AdministratingArango / README . md ) <nl> * [ Advanced ] ( Advanced / README . md ) <nl> - * [ Arangob ] ( Advanced / Arangob . md ) <nl> + * [ Arangobench ] ( Advanced / Arangobench . md ) <nl> * [ Write - ahead log ] ( Advanced / WriteAheadLog . md ) <nl> * [ Server Internals ] ( Advanced / ServerInternals . md ) <nl> * [ Datafile Debugger ] ( Advanced / DatafileDebugger . md ) <nl> mmm a / Documentation / CMakeLists . txt <nl> ppp b / Documentation / CMakeLists . txt <nl> add_custom_target ( examples <nl> # manual pages <nl> if ( USE_MAINTAINER_MODE ) <nl> set ( MAN_NAMES <nl> - man1 / arangob . 1 <nl> + man1 / arangobench . 1 <nl> man1 / arangodump . 1 <nl> man1 / arangoimp . 1 <nl> man1 / arangorestore . 1 <nl> similarity index 76 % <nl> rename from Documentation / man / man1 / arangob . 1 <nl> rename to Documentation / man / man1 / arangobench . 1 <nl> mmm a / Documentation / man / man1 / arangob . 1 <nl> ppp b / Documentation / man / man1 / arangobench . 1 <nl> <nl> - . TH arangob 1 " 3 . 0 . x - devel " " ArangoDB " " ArangoDB " <nl> + . TH arangobench 1 " 3 . 0 . x - devel " " ArangoDB " " ArangoDB " <nl> . SH NAME <nl> - arangob - the ArangoDB benchmark and test tool <nl> + arangobench - the ArangoDB benchmark and test tool <nl> . SH SYNOPSIS <nl> - arangob [ options ] <nl> + arangobench [ options ] <nl> . SH DESCRIPTION <nl> The arangob binary can be used to issue test requests to the <nl> ArangoDB database . It can be used for benchmarks or server function <nl> similarity index 100 % <nl> rename from Documentation / man1 / arangob . 1 <nl> rename to Documentation / man1 / arangobench . 1 <nl> mmm a / arangosh / Benchmark / BenchFeature . cpp <nl> ppp b / arangosh / Benchmark / BenchFeature . cpp <nl> <nl> # include " SimpleHttpClient / SimpleHttpResult . h " <nl> <nl> using namespace arangodb ; <nl> - using namespace arangodb : : arangob ; <nl> + using namespace arangodb : : arangobench ; <nl> using namespace arangodb : : basics ; <nl> using namespace arangodb : : httpclient ; <nl> using namespace arangodb : : options ; <nl> using namespace arangodb : : rest ; <nl> / / / We use an evil global pointer here . <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - BenchFeature * ARANGOB ; <nl> + BenchFeature * ARANGOBENCH ; <nl> # include " Benchmark / test - cases . h " <nl> <nl> BenchFeature : : BenchFeature ( application_features : : ApplicationServer * server , <nl> void BenchFeature : : start ( ) { <nl> int ret = EXIT_SUCCESS ; <nl> <nl> * _result = ret ; <nl> - ARANGOB = this ; <nl> + ARANGOBENCH = this ; <nl> <nl> std : : unique_ptr < BenchmarkOperation > benchmark ( GetTestCase ( _testCase ) ) ; <nl> <nl> if ( benchmark = = nullptr ) { <nl> - ARANGOB = nullptr ; <nl> + ARANGOBENCH = nullptr ; <nl> LOG ( FATAL ) < < " invalid test case name ' " < < _testCase < < " ' " ; <nl> FATAL_ERROR_EXIT ( ) ; <nl> } <nl> void BenchFeature : : start ( ) { <nl> < < std : : endl ; <nl> <nl> if ( failures > 0 ) { <nl> - LOG ( WARN ) < < " WARNING : " < < failures < < " arangob request ( s ) failed ! " ; <nl> + LOG ( WARN ) < < " WARNING : " < < failures < < " arangobench request ( s ) failed ! " ; <nl> } <nl> if ( incomplete > 0 ) { <nl> LOG ( WARN ) < < " WARNING : " < < incomplete <nl> - < < " arangob requests with incomplete results ! " ; <nl> + < < " arangobench requests with incomplete results ! " ; <nl> } <nl> <nl> benchmark - > tearDown ( ) ; <nl> void BenchFeature : : start ( ) { <nl> } <nl> <nl> void BenchFeature : : stop ( ) { <nl> - ARANGOB = nullptr ; <nl> + ARANGOBENCH = nullptr ; <nl> } <nl> mmm a / arangosh / Benchmark / BenchmarkCounter . h <nl> ppp b / arangosh / Benchmark / BenchmarkCounter . h <nl> <nl> # include " Basics / MutexLocker . h " <nl> <nl> namespace arangodb { <nl> - namespace arangob { <nl> + namespace arangobench { <nl> <nl> template < class T > <nl> class BenchmarkCounter { <nl> mmm a / arangosh / Benchmark / BenchmarkOperation . h <nl> ppp b / arangosh / Benchmark / BenchmarkOperation . h <nl> <nl> # include " SimpleHttpClient / SimpleHttpClient . h " <nl> <nl> namespace arangodb { <nl> - namespace arangob { <nl> + namespace arangobench { <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief simple interface for benchmark operations <nl> mmm a / arangosh / Benchmark / BenchmarkThread . h <nl> ppp b / arangosh / Benchmark / BenchmarkThread . h <nl> <nl> # include " SimpleHttpClient / SimpleHttpResult . h " <nl> <nl> namespace arangodb { <nl> - namespace arangob { <nl> + namespace arangobench { <nl> <nl> class BenchmarkThread : public arangodb : : Thread { <nl> public : <nl> class BenchmarkThread : public arangodb : : Thread { <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> static std : : string rewriteLocation ( void * data , std : : string const & location ) { <nl> - auto t = static_cast < arangob : : BenchmarkThread * > ( data ) ; <nl> + auto t = static_cast < arangobench : : BenchmarkThread * > ( data ) ; <nl> <nl> TRI_ASSERT ( t ! = nullptr ) ; <nl> <nl> class BenchmarkThread : public arangodb : : Thread { <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> void executeBatchRequest ( const unsigned long numOperations ) { <nl> - static char const boundary [ ] = " XXXarangob - benchmarkXXX " ; <nl> + static char const boundary [ ] = " XXXarangobench - benchmarkXXX " ; <nl> size_t blen = strlen ( boundary ) ; <nl> <nl> basics : : StringBuffer batchPayload ( TRI_UNKNOWN_MEM_ZONE ) ; <nl> class BenchmarkThread : public arangodb : : Thread { <nl> / / / @ brief the operation to benchmark <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - arangob : : BenchmarkOperation * _operation ; <nl> + arangobench : : BenchmarkOperation * _operation ; <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief condition variable <nl> class BenchmarkThread : public arangodb : : Thread { <nl> / / / @ brief benchmark counter <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> - arangob : : BenchmarkCounter < unsigned long > * _operationsCounter ; <nl> + arangobench : : BenchmarkCounter < unsigned long > * _operationsCounter ; <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> / / / @ brief client feature <nl> similarity index 91 % <nl> rename from arangosh / Benchmark / arangob . cpp <nl> rename to arangosh / Benchmark / arangobench . cpp <nl> mmm a / arangosh / Benchmark / arangob . cpp <nl> ppp b / arangosh / Benchmark / arangobench . cpp <nl> int main ( int argc , char * argv [ ] ) { <nl> context . installHup ( ) ; <nl> <nl> std : : shared_ptr < options : : ProgramOptions > options ( new options : : ProgramOptions ( <nl> - argv [ 0 ] , " Usage : arangob [ < options > ] " , " For more information use : " ) ) ; <nl> + argv [ 0 ] , " Usage : arangobench [ < options > ] " , " For more information use : " ) ) ; <nl> <nl> ApplicationServer server ( options ) ; <nl> <nl> int main ( int argc , char * argv [ ] ) { <nl> <nl> server . addFeature ( new BenchFeature ( & server , & ret ) ) ; <nl> server . addFeature ( new ClientFeature ( & server ) ) ; <nl> - server . addFeature ( new ConfigFeature ( & server , " arangob " ) ) ; <nl> + server . addFeature ( new ConfigFeature ( & server , " arangobench " ) ) ; <nl> server . addFeature ( new LoggerFeature ( & server , false ) ) ; <nl> server . addFeature ( new RandomFeature ( & server ) ) ; <nl> server . addFeature ( new ShutdownFeature ( & server , " Bench " ) ) ; <nl> - server . addFeature ( new TempFeature ( & server , " arangob " ) ) ; <nl> + server . addFeature ( new TempFeature ( & server , " arangobench " ) ) ; <nl> server . addFeature ( new VersionFeature ( & server ) ) ; <nl> <nl> server . run ( argc , argv ) ; <nl> mmm a / arangosh / Benchmark / test - cases . h <nl> ppp b / arangosh / Benchmark / test - cases . h <nl> struct DocumentCrudAppendTest : public BenchmarkOperation { <nl> ~ DocumentCrudAppendTest ( ) { } <nl> <nl> bool setUp ( SimpleHttpClient * client ) override { <nl> - return DeleteCollection ( client , ARANGOB - > collection ( ) ) & & <nl> - CreateCollection ( client , ARANGOB - > collection ( ) , 2 ) ; <nl> + return DeleteCollection ( client , ARANGOBENCH - > collection ( ) ) & & <nl> + CreateCollection ( client , ARANGOBENCH - > collection ( ) , 2 ) ; <nl> } <nl> <nl> void tearDown ( ) override { } <nl> struct DocumentCrudAppendTest : public BenchmarkOperation { <nl> size_t const mod = globalCounter % 4 ; <nl> <nl> if ( mod = = 0 ) { <nl> - return std : : string ( " / _api / document ? collection = " + ARANGOB - > collection ( ) ) ; <nl> + return std : : string ( " / _api / document ? collection = " + ARANGOBENCH - > collection ( ) ) ; <nl> } else { <nl> size_t keyId = ( size_t ) ( globalCounter / 4 ) ; <nl> std : : string const key = " testkey " + StringUtils : : itoa ( keyId ) ; <nl> <nl> - return std : : string ( " / _api / document / " + ARANGOB - > collection ( ) + " / " + key ) ; <nl> + return std : : string ( " / _api / document / " + ARANGOBENCH - > collection ( ) + " / " + key ) ; <nl> } <nl> } <nl> <nl> struct DocumentCrudAppendTest : public BenchmarkOperation { <nl> size_t const mod = globalCounter % 4 ; <nl> <nl> if ( mod = = 0 | | mod = = 2 ) { <nl> - uint64_t const n = ARANGOB - > complexity ( ) ; <nl> + uint64_t const n = ARANGOBENCH - > complexity ( ) ; <nl> TRI_string_buffer_t * buffer ; <nl> <nl> buffer = TRI_CreateSizedStringBuffer ( TRI_UNKNOWN_MEM_ZONE , 256 ) ; <nl> struct DocumentCrudWriteReadTest : public BenchmarkOperation { <nl> ~ DocumentCrudWriteReadTest ( ) { } <nl> <nl> bool setUp ( SimpleHttpClient * client ) override { <nl> - return DeleteCollection ( client , ARANGOB - > collection ( ) ) & & <nl> - CreateCollection ( client , ARANGOB - > collection ( ) , 2 ) ; <nl> + return DeleteCollection ( client , ARANGOBENCH - > collection ( ) ) & & <nl> + CreateCollection ( client , ARANGOBENCH - > collection ( ) , 2 ) ; <nl> } <nl> <nl> void tearDown ( ) override { } <nl> struct DocumentCrudWriteReadTest : public BenchmarkOperation { <nl> size_t const mod = globalCounter % 2 ; <nl> <nl> if ( mod = = 0 ) { <nl> - return std : : string ( " / _api / document ? collection = " + ARANGOB - > collection ( ) ) ; <nl> + return std : : string ( " / _api / document ? collection = " + ARANGOBENCH - > collection ( ) ) ; <nl> } else { <nl> size_t keyId = ( size_t ) ( globalCounter / 2 ) ; <nl> std : : string const key = " testkey " + StringUtils : : itoa ( keyId ) ; <nl> <nl> - return std : : string ( " / _api / document / " + ARANGOB - > collection ( ) + " / " + key ) ; <nl> + return std : : string ( " / _api / document / " + ARANGOBENCH - > collection ( ) + " / " + key ) ; <nl> } <nl> } <nl> <nl> struct DocumentCrudWriteReadTest : public BenchmarkOperation { <nl> size_t const mod = globalCounter % 2 ; <nl> <nl> if ( mod = = 0 ) { <nl> - uint64_t const n = ARANGOB - > complexity ( ) ; <nl> + uint64_t const n = ARANGOBENCH - > complexity ( ) ; <nl> TRI_string_buffer_t * buffer ; <nl> <nl> buffer = TRI_CreateSizedStringBuffer ( TRI_UNKNOWN_MEM_ZONE , 256 ) ; <nl> struct ShapesTest : public BenchmarkOperation { <nl> ~ ShapesTest ( ) { } <nl> <nl> bool setUp ( SimpleHttpClient * client ) override { <nl> - return DeleteCollection ( client , ARANGOB - > collection ( ) ) & & <nl> - CreateCollection ( client , ARANGOB - > collection ( ) , 2 ) ; <nl> + return DeleteCollection ( client , ARANGOBENCH - > collection ( ) ) & & <nl> + CreateCollection ( client , ARANGOBENCH - > collection ( ) , 2 ) ; <nl> } <nl> <nl> void tearDown ( ) override { } <nl> struct ShapesTest : public BenchmarkOperation { <nl> size_t const mod = globalCounter % 3 ; <nl> <nl> if ( mod = = 0 ) { <nl> - return std : : string ( " / _api / document ? collection = " + ARANGOB - > collection ( ) ) ; <nl> + return std : : string ( " / _api / document ? collection = " + ARANGOBENCH - > collection ( ) ) ; <nl> } else { <nl> size_t keyId = ( size_t ) ( globalCounter / 3 ) ; <nl> std : : string const key = " testkey " + StringUtils : : itoa ( keyId ) ; <nl> <nl> - return std : : string ( " / _api / document / " + ARANGOB - > collection ( ) + " / " + key ) ; <nl> + return std : : string ( " / _api / document / " + ARANGOBENCH - > collection ( ) + " / " + key ) ; <nl> } <nl> } <nl> <nl> struct ShapesTest : public BenchmarkOperation { <nl> size_t const mod = globalCounter % 3 ; <nl> <nl> if ( mod = = 0 ) { <nl> - uint64_t const n = ARANGOB - > complexity ( ) ; <nl> + uint64_t const n = ARANGOBENCH - > complexity ( ) ; <nl> TRI_string_buffer_t * buffer ; <nl> <nl> buffer = TRI_CreateSizedStringBuffer ( TRI_UNKNOWN_MEM_ZONE , 256 ) ; <nl> struct ShapesTest : public BenchmarkOperation { <nl> TRI_AppendStringStringBuffer ( buffer , " \ " " ) ; <nl> <nl> for ( uint64_t i = 1 ; i < = n ; + + i ) { <nl> - uint64_t mod = ARANGOB - > operations ( ) / 10 ; <nl> + uint64_t mod = ARANGOBENCH - > operations ( ) / 10 ; <nl> if ( mod < 100 ) { <nl> mod = 100 ; <nl> } <nl> struct ShapesAppendTest : public BenchmarkOperation { <nl> ~ ShapesAppendTest ( ) { } <nl> <nl> bool setUp ( SimpleHttpClient * client ) override { <nl> - return DeleteCollection ( client , ARANGOB - > collection ( ) ) & & <nl> - CreateCollection ( client , ARANGOB - > collection ( ) , 2 ) ; <nl> + return DeleteCollection ( client , ARANGOBENCH - > collection ( ) ) & & <nl> + CreateCollection ( client , ARANGOBENCH - > collection ( ) , 2 ) ; <nl> } <nl> <nl> void tearDown ( ) override { } <nl> struct ShapesAppendTest : public BenchmarkOperation { <nl> size_t const mod = globalCounter % 2 ; <nl> <nl> if ( mod = = 0 ) { <nl> - return std : : string ( " / _api / document ? collection = " + ARANGOB - > collection ( ) ) ; <nl> + return std : : string ( " / _api / document ? collection = " + ARANGOBENCH - > collection ( ) ) ; <nl> } else { <nl> size_t keyId = ( size_t ) ( globalCounter / 2 ) ; <nl> std : : string const key = " testkey " + StringUtils : : itoa ( keyId ) ; <nl> <nl> - return std : : string ( " / _api / document / " + ARANGOB - > collection ( ) + " / " + key ) ; <nl> + return std : : string ( " / _api / document / " + ARANGOBENCH - > collection ( ) + " / " + key ) ; <nl> } <nl> } <nl> <nl> struct ShapesAppendTest : public BenchmarkOperation { <nl> size_t const mod = globalCounter % 2 ; <nl> <nl> if ( mod = = 0 ) { <nl> - uint64_t const n = ARANGOB - > complexity ( ) ; <nl> + uint64_t const n = ARANGOBENCH - > complexity ( ) ; <nl> TRI_string_buffer_t * buffer ; <nl> <nl> buffer = TRI_CreateSizedStringBuffer ( TRI_UNKNOWN_MEM_ZONE , 256 ) ; <nl> struct ShapesAppendTest : public BenchmarkOperation { <nl> TRI_AppendStringStringBuffer ( buffer , " \ " " ) ; <nl> <nl> for ( uint64_t i = 1 ; i < = n ; + + i ) { <nl> - uint64_t mod = ARANGOB - > operations ( ) / 10 ; <nl> + uint64_t mod = ARANGOBENCH - > operations ( ) / 10 ; <nl> if ( mod < 100 ) { <nl> mod = 100 ; <nl> } <nl> struct RandomShapesTest : public BenchmarkOperation { <nl> ~ RandomShapesTest ( ) { } <nl> <nl> bool setUp ( SimpleHttpClient * client ) override { <nl> - return DeleteCollection ( client , ARANGOB - > collection ( ) ) & & <nl> - CreateCollection ( client , ARANGOB - > collection ( ) , 2 ) ; <nl> + return DeleteCollection ( client , ARANGOBENCH - > collection ( ) ) & & <nl> + CreateCollection ( client , ARANGOBENCH - > collection ( ) , 2 ) ; <nl> } <nl> <nl> void tearDown ( ) override { } <nl> struct RandomShapesTest : public BenchmarkOperation { <nl> size_t const mod = globalCounter % 3 ; <nl> <nl> if ( mod = = 0 ) { <nl> - return std : : string ( " / _api / document ? collection = " ) + ARANGOB - > collection ( ) ; <nl> + return std : : string ( " / _api / document ? collection = " ) + ARANGOBENCH - > collection ( ) ; <nl> } else { <nl> size_t keyId = ( size_t ) ( globalCounter / 3 ) ; <nl> std : : string const key = " testkey " + StringUtils : : itoa ( keyId ) ; <nl> <nl> - return std : : string ( " / _api / document / " ) + ARANGOB - > collection ( ) + <nl> + return std : : string ( " / _api / document / " ) + ARANGOBENCH - > collection ( ) + <nl> std : : string ( " / " ) + key ; <nl> } <nl> } <nl> struct RandomShapesTest : public BenchmarkOperation { <nl> size_t const mod = globalCounter % 3 ; <nl> <nl> if ( mod = = 0 ) { <nl> - uint64_t const n = ARANGOB - > complexity ( ) ; <nl> + uint64_t const n = ARANGOBENCH - > complexity ( ) ; <nl> TRI_string_buffer_t * buffer ; <nl> <nl> buffer = TRI_CreateSizedStringBuffer ( TRI_UNKNOWN_MEM_ZONE , 256 ) ; <nl> struct DocumentCrudTest : public BenchmarkOperation { <nl> ~ DocumentCrudTest ( ) { } <nl> <nl> bool setUp ( SimpleHttpClient * client ) override { <nl> - return DeleteCollection ( client , ARANGOB - > collection ( ) ) & & <nl> - CreateCollection ( client , ARANGOB - > collection ( ) , 2 ) ; <nl> + return DeleteCollection ( client , ARANGOBENCH - > collection ( ) ) & & <nl> + CreateCollection ( client , ARANGOBENCH - > collection ( ) , 2 ) ; <nl> } <nl> <nl> void tearDown ( ) override { } <nl> struct DocumentCrudTest : public BenchmarkOperation { <nl> size_t const mod = globalCounter % 5 ; <nl> <nl> if ( mod = = 0 ) { <nl> - return std : : string ( " / _api / document ? collection = " + ARANGOB - > collection ( ) ) ; <nl> + return std : : string ( " / _api / document ? collection = " + ARANGOBENCH - > collection ( ) ) ; <nl> } else { <nl> size_t keyId = ( size_t ) ( globalCounter / 5 ) ; <nl> std : : string const key = " testkey " + StringUtils : : itoa ( keyId ) ; <nl> <nl> - return std : : string ( " / _api / document / " + ARANGOB - > collection ( ) + " / " + key ) ; <nl> + return std : : string ( " / _api / document / " + ARANGOBENCH - > collection ( ) + " / " + key ) ; <nl> } <nl> } <nl> <nl> struct DocumentCrudTest : public BenchmarkOperation { <nl> size_t const mod = globalCounter % 5 ; <nl> <nl> if ( mod = = 0 | | mod = = 2 ) { <nl> - uint64_t const n = ARANGOB - > complexity ( ) ; <nl> + uint64_t const n = ARANGOBENCH - > complexity ( ) ; <nl> TRI_string_buffer_t * buffer ; <nl> <nl> buffer = TRI_CreateSizedStringBuffer ( TRI_UNKNOWN_MEM_ZONE , 256 ) ; <nl> struct EdgeCrudTest : public BenchmarkOperation { <nl> ~ EdgeCrudTest ( ) { } <nl> <nl> bool setUp ( SimpleHttpClient * client ) override { <nl> - return DeleteCollection ( client , ARANGOB - > collection ( ) ) & & <nl> - CreateCollection ( client , ARANGOB - > collection ( ) , 3 ) ; <nl> + return DeleteCollection ( client , ARANGOBENCH - > collection ( ) ) & & <nl> + CreateCollection ( client , ARANGOBENCH - > collection ( ) , 3 ) ; <nl> } <nl> <nl> void tearDown ( ) override { } <nl> struct EdgeCrudTest : public BenchmarkOperation { <nl> size_t const mod = globalCounter % 4 ; <nl> <nl> if ( mod = = 0 ) { <nl> - return std : : string ( " / _api / document ? collection = " + ARANGOB - > collection ( ) ) ; <nl> + return std : : string ( " / _api / document ? collection = " + ARANGOBENCH - > collection ( ) ) ; <nl> } else { <nl> size_t keyId = ( size_t ) ( globalCounter / 4 ) ; <nl> std : : string const key = " testkey " + StringUtils : : itoa ( keyId ) ; <nl> <nl> - return std : : string ( " / _api / document / " + ARANGOB - > collection ( ) + " / " + key ) ; <nl> + return std : : string ( " / _api / document / " + ARANGOBENCH - > collection ( ) + " / " + key ) ; <nl> } <nl> } <nl> <nl> struct EdgeCrudTest : public BenchmarkOperation { <nl> size_t const mod = globalCounter % 4 ; <nl> <nl> if ( mod = = 0 | | mod = = 2 ) { <nl> - uint64_t const n = ARANGOB - > complexity ( ) ; <nl> + uint64_t const n = ARANGOBENCH - > complexity ( ) ; <nl> TRI_string_buffer_t * buffer ; <nl> <nl> buffer = TRI_CreateSizedStringBuffer ( TRI_UNKNOWN_MEM_ZONE , 256 ) ; <nl> struct EdgeCrudTest : public BenchmarkOperation { <nl> if ( mod = = 0 ) { <nl> / / append edge information <nl> TRI_AppendStringStringBuffer ( buffer , " , \ " _from \ " : \ " " ) ; <nl> - TRI_AppendStringStringBuffer ( buffer , ARANGOB - > collection ( ) . c_str ( ) ) ; <nl> + TRI_AppendStringStringBuffer ( buffer , ARANGOBENCH - > collection ( ) . c_str ( ) ) ; <nl> TRI_AppendStringStringBuffer ( buffer , " / testfrom " ) ; <nl> TRI_AppendUInt64StringBuffer ( buffer , globalCounter ) ; <nl> TRI_AppendStringStringBuffer ( buffer , " \ " , \ " _to \ " : \ " " ) ; <nl> - TRI_AppendStringStringBuffer ( buffer , ARANGOB - > collection ( ) . c_str ( ) ) ; <nl> + TRI_AppendStringStringBuffer ( buffer , ARANGOBENCH - > collection ( ) . c_str ( ) ) ; <nl> TRI_AppendStringStringBuffer ( buffer , " / testto " ) ; <nl> TRI_AppendUInt64StringBuffer ( buffer , globalCounter ) ; <nl> TRI_AppendStringStringBuffer ( buffer , " \ " " ) ; <nl> struct SkiplistTest : public BenchmarkOperation { <nl> ~ SkiplistTest ( ) { } <nl> <nl> bool setUp ( SimpleHttpClient * client ) override { <nl> - return DeleteCollection ( client , ARANGOB - > collection ( ) ) & & <nl> - CreateCollection ( client , ARANGOB - > collection ( ) , 2 ) & & <nl> - CreateIndex ( client , ARANGOB - > collection ( ) , " skiplist " , <nl> + return DeleteCollection ( client , ARANGOBENCH - > collection ( ) ) & & <nl> + CreateCollection ( client , ARANGOBENCH - > collection ( ) , 2 ) & & <nl> + CreateIndex ( client , ARANGOBENCH - > collection ( ) , " skiplist " , <nl> " [ \ " value \ " ] " ) ; <nl> } <nl> <nl> struct SkiplistTest : public BenchmarkOperation { <nl> size_t const mod = globalCounter % 4 ; <nl> <nl> if ( mod = = 0 ) { <nl> - return std : : string ( " / _api / document ? collection = " + ARANGOB - > collection ( ) ) ; <nl> + return std : : string ( " / _api / document ? collection = " + ARANGOBENCH - > collection ( ) ) ; <nl> } else { <nl> size_t keyId = ( size_t ) ( globalCounter / 4 ) ; <nl> std : : string const key = " testkey " + StringUtils : : itoa ( keyId ) ; <nl> <nl> - return std : : string ( " / _api / document / " + ARANGOB - > collection ( ) + " / " + key ) ; <nl> + return std : : string ( " / _api / document / " + ARANGOBENCH - > collection ( ) + " / " + key ) ; <nl> } <nl> } <nl> <nl> struct HashTest : public BenchmarkOperation { <nl> ~ HashTest ( ) { } <nl> <nl> bool setUp ( SimpleHttpClient * client ) override { <nl> - return DeleteCollection ( client , ARANGOB - > collection ( ) ) & & <nl> - CreateCollection ( client , ARANGOB - > collection ( ) , 2 ) & & <nl> - CreateIndex ( client , ARANGOB - > collection ( ) , " hash " , " [ \ " value \ " ] " ) ; <nl> + return DeleteCollection ( client , ARANGOBENCH - > collection ( ) ) & & <nl> + CreateCollection ( client , ARANGOBENCH - > collection ( ) , 2 ) & & <nl> + CreateIndex ( client , ARANGOBENCH - > collection ( ) , " hash " , " [ \ " value \ " ] " ) ; <nl> } <nl> <nl> void tearDown ( ) override { } <nl> struct HashTest : public BenchmarkOperation { <nl> size_t const mod = globalCounter % 4 ; <nl> <nl> if ( mod = = 0 ) { <nl> - return std : : string ( " / _api / document ? collection = " + ARANGOB - > collection ( ) ) ; <nl> + return std : : string ( " / _api / document ? collection = " + ARANGOBENCH - > collection ( ) ) ; <nl> } else { <nl> size_t keyId = ( size_t ) ( globalCounter / 4 ) ; <nl> std : : string const key = " testkey " + StringUtils : : itoa ( keyId ) ; <nl> <nl> - return std : : string ( " / _api / document / " + ARANGOB - > collection ( ) + " / " + key ) ; <nl> + return std : : string ( " / _api / document / " + ARANGOBENCH - > collection ( ) + " / " + key ) ; <nl> } <nl> } <nl> <nl> struct HashTest : public BenchmarkOperation { <nl> struct DocumentImportTest : public BenchmarkOperation { <nl> DocumentImportTest ( ) : BenchmarkOperation ( ) , _url ( ) , _buffer ( 0 ) { <nl> _url = <nl> - " / _api / import ? collection = " + ARANGOB - > collection ( ) + " & type = documents " ; <nl> + " / _api / import ? collection = " + ARANGOBENCH - > collection ( ) + " & type = documents " ; <nl> <nl> - uint64_t const n = ARANGOB - > complexity ( ) ; <nl> + uint64_t const n = ARANGOBENCH - > complexity ( ) ; <nl> <nl> _buffer = TRI_CreateSizedStringBuffer ( TRI_UNKNOWN_MEM_ZONE , 16384 ) ; <nl> for ( uint64_t i = 0 ; i < n ; + + i ) { <nl> struct DocumentImportTest : public BenchmarkOperation { <nl> ~ DocumentImportTest ( ) { TRI_FreeStringBuffer ( TRI_UNKNOWN_MEM_ZONE , _buffer ) ; } <nl> <nl> bool setUp ( SimpleHttpClient * client ) override { <nl> - return DeleteCollection ( client , ARANGOB - > collection ( ) ) & & <nl> - CreateCollection ( client , ARANGOB - > collection ( ) , 2 ) ; <nl> + return DeleteCollection ( client , ARANGOBENCH - > collection ( ) ) & & <nl> + CreateCollection ( client , ARANGOBENCH - > collection ( ) , 2 ) ; <nl> } <nl> <nl> void tearDown ( ) override { } <nl> struct DocumentImportTest : public BenchmarkOperation { <nl> <nl> struct DocumentCreationTest : public BenchmarkOperation { <nl> DocumentCreationTest ( ) : BenchmarkOperation ( ) , _url ( ) , _buffer ( 0 ) { <nl> - _url = " / _api / document ? collection = " + ARANGOB - > collection ( ) ; <nl> + _url = " / _api / document ? collection = " + ARANGOBENCH - > collection ( ) ; <nl> <nl> - uint64_t const n = ARANGOB - > complexity ( ) ; <nl> + uint64_t const n = ARANGOBENCH - > complexity ( ) ; <nl> <nl> _buffer = TRI_CreateSizedStringBuffer ( TRI_UNKNOWN_MEM_ZONE , 4096 ) ; <nl> TRI_AppendCharStringBuffer ( _buffer , ' { ' ) ; <nl> struct DocumentCreationTest : public BenchmarkOperation { <nl> } <nl> <nl> bool setUp ( SimpleHttpClient * client ) override { <nl> - return DeleteCollection ( client , ARANGOB - > collection ( ) ) & & <nl> - CreateCollection ( client , ARANGOB - > collection ( ) , 2 ) ; <nl> + return DeleteCollection ( client , ARANGOBENCH - > collection ( ) ) & & <nl> + CreateCollection ( client , ARANGOBENCH - > collection ( ) , 2 ) ; <nl> } <nl> <nl> void tearDown ( ) override { } <nl> struct CollectionCreationTest : public BenchmarkOperation { <nl> return 0 ; <nl> } <nl> TRI_AppendStringStringBuffer ( buffer , " { \ " name \ " : \ " " ) ; <nl> - TRI_AppendStringStringBuffer ( buffer , ARANGOB - > collection ( ) . c_str ( ) ) ; <nl> + TRI_AppendStringStringBuffer ( buffer , ARANGOBENCH - > collection ( ) . c_str ( ) ) ; <nl> TRI_AppendUInt64StringBuffer ( buffer , + + _counter ) ; <nl> TRI_AppendStringStringBuffer ( buffer , " \ " } " ) ; <nl> <nl> struct TransactionAqlTest : public BenchmarkOperation { <nl> ~ TransactionAqlTest ( ) { } <nl> <nl> bool setUp ( SimpleHttpClient * client ) override { <nl> - _c1 = std : : string ( ARANGOB - > collection ( ) + " 1 " ) ; <nl> - _c2 = std : : string ( ARANGOB - > collection ( ) + " 2 " ) ; <nl> - _c3 = std : : string ( ARANGOB - > collection ( ) + " 3 " ) ; <nl> + _c1 = std : : string ( ARANGOBENCH - > collection ( ) + " 1 " ) ; <nl> + _c2 = std : : string ( ARANGOBENCH - > collection ( ) + " 2 " ) ; <nl> + _c3 = std : : string ( ARANGOBENCH - > collection ( ) + " 3 " ) ; <nl> <nl> return DeleteCollection ( client , _c1 ) & & DeleteCollection ( client , _c2 ) & & <nl> DeleteCollection ( client , _c3 ) & & CreateCollection ( client , _c1 , 2 ) & & <nl> struct TransactionCountTest : public BenchmarkOperation { <nl> ~ TransactionCountTest ( ) { } <nl> <nl> bool setUp ( SimpleHttpClient * client ) override { <nl> - return DeleteCollection ( client , ARANGOB - > collection ( ) ) & & <nl> - CreateCollection ( client , ARANGOB - > collection ( ) , 2 ) ; <nl> + return DeleteCollection ( client , ARANGOBENCH - > collection ( ) ) & & <nl> + CreateCollection ( client , ARANGOBENCH - > collection ( ) , 2 ) ; <nl> } <nl> <nl> void tearDown ( ) override { } <nl> struct TransactionCountTest : public BenchmarkOperation { <nl> buffer = TRI_CreateSizedStringBuffer ( TRI_UNKNOWN_MEM_ZONE , 256 ) ; <nl> <nl> TRI_AppendStringStringBuffer ( buffer , " { \ " collections \ " : { \ " write \ " : \ " " ) ; <nl> - TRI_AppendStringStringBuffer ( buffer , ARANGOB - > collection ( ) . c_str ( ) ) ; <nl> + TRI_AppendStringStringBuffer ( buffer , ARANGOBENCH - > collection ( ) . c_str ( ) ) ; <nl> TRI_AppendStringStringBuffer ( buffer , <nl> " \ " } , \ " action \ " : \ " function ( ) { var c = " <nl> " require ( \ \ \ " internal \ \ \ " ) . db [ \ \ \ " " ) ; <nl> - TRI_AppendStringStringBuffer ( buffer , ARANGOB - > collection ( ) . c_str ( ) ) ; <nl> + TRI_AppendStringStringBuffer ( buffer , ARANGOBENCH - > collection ( ) . c_str ( ) ) ; <nl> TRI_AppendStringStringBuffer ( buffer , <nl> " \ \ \ " ] ; var startcount = c . count ( ) ; for ( var " <nl> " i = 0 ; i < 50 ; + + i ) { if ( startcount + i ! = = " <nl> struct TransactionDeadlockTest : public BenchmarkOperation { <nl> ~ TransactionDeadlockTest ( ) { } <nl> <nl> bool setUp ( SimpleHttpClient * client ) override { <nl> - _c1 = std : : string ( ARANGOB - > collection ( ) + " 1 " ) ; <nl> - _c2 = std : : string ( ARANGOB - > collection ( ) + " 2 " ) ; <nl> + _c1 = std : : string ( ARANGOBENCH - > collection ( ) + " 1 " ) ; <nl> + _c2 = std : : string ( ARANGOBENCH - > collection ( ) + " 2 " ) ; <nl> <nl> return DeleteCollection ( client , _c1 ) & & DeleteCollection ( client , _c2 ) & & <nl> CreateCollection ( client , _c1 , 2 ) & & <nl> struct TransactionMultiTest : public BenchmarkOperation { <nl> ~ TransactionMultiTest ( ) { } <nl> <nl> bool setUp ( SimpleHttpClient * client ) override { <nl> - _c1 = std : : string ( ARANGOB - > collection ( ) + " 1 " ) ; <nl> - _c2 = std : : string ( ARANGOB - > collection ( ) + " 2 " ) ; <nl> + _c1 = std : : string ( ARANGOBENCH - > collection ( ) + " 1 " ) ; <nl> + _c2 = std : : string ( ARANGOBENCH - > collection ( ) + " 2 " ) ; <nl> <nl> return DeleteCollection ( client , _c1 ) & & DeleteCollection ( client , _c2 ) & & <nl> CreateCollection ( client , _c1 , 2 ) & & <nl> struct TransactionMultiCollectionTest : public BenchmarkOperation { <nl> ~ TransactionMultiCollectionTest ( ) { } <nl> <nl> bool setUp ( SimpleHttpClient * client ) override { <nl> - _c1 = std : : string ( ARANGOB - > collection ( ) + " 1 " ) ; <nl> - _c2 = std : : string ( ARANGOB - > collection ( ) + " 2 " ) ; <nl> + _c1 = std : : string ( ARANGOBENCH - > collection ( ) + " 1 " ) ; <nl> + _c2 = std : : string ( ARANGOBENCH - > collection ( ) + " 2 " ) ; <nl> <nl> return DeleteCollection ( client , _c1 ) & & DeleteCollection ( client , _c2 ) & & <nl> CreateCollection ( client , _c1 , 2 ) & & CreateCollection ( client , _c2 , 2 ) ; <nl> struct TransactionMultiCollectionTest : public BenchmarkOperation { <nl> TRI_AppendStringStringBuffer ( buffer , " \ \ \ " ] ; " ) ; <nl> <nl> TRI_AppendStringStringBuffer ( buffer , " var doc = { " ) ; <nl> - uint64_t const n = ARANGOB - > complexity ( ) ; <nl> + uint64_t const n = ARANGOBENCH - > complexity ( ) ; <nl> for ( uint64_t i = 0 ; i < n ; + + i ) { <nl> if ( i > 0 ) { <nl> TRI_AppendStringStringBuffer ( buffer , " , " ) ; <nl> struct AqlInsertTest : public BenchmarkOperation { <nl> ~ AqlInsertTest ( ) { } <nl> <nl> bool setUp ( SimpleHttpClient * client ) override { <nl> - return DeleteCollection ( client , ARANGOB - > collection ( ) ) & & <nl> - CreateCollection ( client , ARANGOB - > collection ( ) , 2 ) ; <nl> + return DeleteCollection ( client , ARANGOBENCH - > collection ( ) ) & & <nl> + CreateCollection ( client , ARANGOBENCH - > collection ( ) , 2 ) ; <nl> } <nl> <nl> void tearDown ( ) override { } <nl> struct AqlInsertTest : public BenchmarkOperation { <nl> TRI_AppendInt64StringBuffer ( buffer , ( int64_t ) globalCounter ) ; <nl> TRI_AppendStringStringBuffer ( buffer , " \ \ \ " " ) ; <nl> <nl> - uint64_t const n = ARANGOB - > complexity ( ) ; <nl> + uint64_t const n = ARANGOBENCH - > complexity ( ) ; <nl> for ( uint64_t i = 1 ; i < = n ; + + i ) { <nl> TRI_AppendStringStringBuffer ( buffer , " , \ \ \ " value " ) ; <nl> TRI_AppendUInt64StringBuffer ( buffer , i ) ; <nl> struct AqlInsertTest : public BenchmarkOperation { <nl> } <nl> <nl> TRI_AppendStringStringBuffer ( buffer , " } INTO " ) ; <nl> - TRI_AppendStringStringBuffer ( buffer , ARANGOB - > collection ( ) . c_str ( ) ) ; <nl> + TRI_AppendStringStringBuffer ( buffer , ARANGOBENCH - > collection ( ) . c_str ( ) ) ; <nl> TRI_AppendStringStringBuffer ( buffer , " \ " } " ) ; <nl> <nl> * length = TRI_LengthStringBuffer ( buffer ) ; <nl> struct AqlV8Test : public BenchmarkOperation { <nl> ~ AqlV8Test ( ) { } <nl> <nl> bool setUp ( SimpleHttpClient * client ) override { <nl> - return DeleteCollection ( client , ARANGOB - > collection ( ) ) & & <nl> - CreateCollection ( client , ARANGOB - > collection ( ) , 2 ) ; <nl> + return DeleteCollection ( client , ARANGOBENCH - > collection ( ) ) & & <nl> + CreateCollection ( client , ARANGOBENCH - > collection ( ) , 2 ) ; <nl> } <nl> <nl> void tearDown ( ) override { } <nl> struct AqlV8Test : public BenchmarkOperation { <nl> TRI_AppendInt64StringBuffer ( buffer , ( int64_t ) globalCounter ) ; <nl> TRI_AppendStringStringBuffer ( buffer , " \ \ \ " " ) ; <nl> <nl> - uint64_t const n = ARANGOB - > complexity ( ) ; <nl> + uint64_t const n = ARANGOBENCH - > complexity ( ) ; <nl> for ( uint64_t i = 1 ; i < = n ; + + i ) { <nl> TRI_AppendStringStringBuffer ( buffer , " , \ \ \ " value " ) ; <nl> TRI_AppendUInt64StringBuffer ( buffer , i ) ; <nl> struct AqlV8Test : public BenchmarkOperation { <nl> } <nl> <nl> TRI_AppendStringStringBuffer ( buffer , " } INTO " ) ; <nl> - TRI_AppendStringStringBuffer ( buffer , ARANGOB - > collection ( ) . c_str ( ) ) ; <nl> + TRI_AppendStringStringBuffer ( buffer , ARANGOBENCH - > collection ( ) . c_str ( ) ) ; <nl> TRI_AppendStringStringBuffer ( buffer , " \ " } " ) ; <nl> <nl> * length = TRI_LengthStringBuffer ( buffer ) ; <nl> mmm a / arangosh / CMakeLists . txt <nl> ppp b / arangosh / CMakeLists . txt <nl> include_directories ( . ) <nl> set ( CMAKE_RUNTIME_OUTPUT_DIRECTORY " $ { PROJECT_BINARY_DIR } / bin / " ) <nl> <nl> # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl> - # # arangob <nl> + # # arangobench <nl> # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl> <nl> if ( MSVC ) <nl> - generate_product_version ( ProductVersionFiles_arangob <nl> - NAME arangob <nl> - FILE_DESCRIPTION $ { ARANGOB_FRIENDLY_STRING } <nl> + generate_product_version ( ProductVersionFiles_arangobench <nl> + NAME arangobench <nl> + FILE_DESCRIPTION $ { ARANGOBENCH_FRIENDLY_STRING } <nl> ICON $ { ARANGO_ICON } <nl> VERSION_MAJOR $ { CPACK_PACKAGE_VERSION_MAJOR } <nl> VERSION_MINOR $ { CPACK_PACKAGE_VERSION_MINOR } <nl> if ( MSVC ) <nl> ) <nl> endif ( ) <nl> <nl> - add_executable ( $ { BIN_ARANGOB } <nl> - $ { ProductVersionFiles_arangob } <nl> + add_executable ( $ { BIN_ARANGOBENCH } <nl> + $ { ProductVersionFiles_arangobench } <nl> $ { PROJECT_SOURCE_DIR } / lib / Basics / WorkMonitorDummy . cpp <nl> Benchmark / BenchFeature . cpp <nl> - Benchmark / arangob . cpp <nl> + Benchmark / arangobench . cpp <nl> ) <nl> <nl> - target_link_libraries ( $ { BIN_ARANGOB } <nl> + target_link_libraries ( $ { BIN_ARANGOBENCH } <nl> $ { LIB_ARANGO } <nl> $ { LINENOISE_LIBS } <nl> $ { MSVC_LIBS } <nl> target_link_libraries ( $ { BIN_ARANGOB } <nl> ) <nl> <nl> install ( <nl> - TARGETS $ { BIN_ARANGOB } <nl> + TARGETS $ { BIN_ARANGOBENCH } <nl> RUNTIME DESTINATION $ { CMAKE_INSTALL_BINDIR } ) <nl> <nl> - install_config ( arangob ) <nl> + install_config ( arangobench ) <nl> <nl> if ( NOT USE_PRECOMPILED_V8 ) <nl> - add_dependencies ( arangob zlibstatic v8_build ) # v8_build includes ICU build <nl> + add_dependencies ( arangobench zlibstatic v8_build ) # v8_build includes ICU build <nl> else ( ) <nl> - add_dependencies ( arangob zlibstatic ) <nl> + add_dependencies ( arangobench zlibstatic ) <nl> endif ( ) <nl> <nl> # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # <nl> similarity index 76 % <nl> rename from etc / arangodb / arangob . conf . in <nl> rename to etc / arangodb / arangobench . conf . in <nl> mmm a / etc / arangodb / arangob . conf . in <nl> ppp b / etc / arangodb / arangobench . conf . in <nl> <nl> - # config file for arangob <nl> + # config file for arangobench <nl> <nl> keep - alive = true <nl> progress = true <nl> similarity index 100 % <nl> rename from etc / relative / arangob . conf <nl> rename to etc / relative / arangobench . conf <nl> mmm a / js / client / modules / @ arangodb / testing . js <nl> ppp b / js / client / modules / @ arangodb / testing . js <nl> <nl> const functionsDocumentation = { <nl> " all " : " run all tests ( marked with [ x ] ) " , <nl> " agency " : " run agency tests " , <nl> - " arangob " : " arangob tests " , <nl> + " arangobench " : " arangobench tests " , <nl> " arangosh " : " arangosh exit codes tests " , <nl> " authentication " : " authentication tests " , <nl> " authentication_parameters " : " authentication parameters tests " , <nl> const optionsDocumentation = [ <nl> ' - ` force ` : if set to true the tests are continued even if one fails ' , <nl> ' ' , <nl> ' - ` skipAql ` : if set to true the AQL tests are skipped ' , <nl> - ' - ` skipArangoBNonConnKeepAlive ` : if set to true benchmark do not use keep - alive ' , <nl> - ' - ` skipArangoB ` : if set to true benchmark tests are skipped ' , <nl> + ' - ` skipArangoBenchNonConnKeepAlive ` : if set to true benchmark do not use keep - alive ' , <nl> + ' - ` skipArangoBench ` : if set to true benchmark tests are skipped ' , <nl> ' - ` skipAuthenication : testing authentication and authentication_paramaters will be skipped . ' , <nl> ' - ` skipBoost ` : if set to true the boost unittests are skipped ' , <nl> ' - ` skipConfig ` : omit the noisy configuration tests ' , <nl> const optionsDocumentation = [ <nl> ' - ` cleanup ` : if set to true ( the default ) , the cluster data files ' , <nl> ' and logs are removed after termination of the test . ' , <nl> ' ' , <nl> - ' - ` benchargs ` : additional commandline arguments to arangob ' , <nl> + ' - ` benchargs ` : additional commandline arguments to arangobench ' , <nl> ' ' , <nl> ' - ` build ` : the directory containing the binaries ' , <nl> ' - ` buildType ` : Windows build type ( Debug , Release ) , leave empty on linux ' , <nl> const optionsDefaults = { <nl> " ruby " : " " , <nl> " sanitizer " : false , <nl> " skipAql " : false , <nl> - " skipArangoB " : false , <nl> - " skipArangoBNonConnKeepAlive " : true , <nl> + " skipArangoBench " : false , <nl> + " skipArangoBenchNonConnKeepAlive " : true , <nl> " skipAuthenication " : false , <nl> " skipBoost " : false , <nl> " skipGeo " : false , <nl> const TOP_DIR = ( function findTopDir ( ) { <nl> <nl> let BIN_DIR ; <nl> let CONFIG_DIR ; <nl> - let ARANGOB_BIN ; <nl> + let ARANGOBENCH_BIN ; <nl> let ARANGODUMP_BIN ; <nl> let ARANGOD_BIN ; <nl> let ARANGOIMP_BIN ; <nl> function runArangoDumpRestore ( options , instanceInfo , which , database ) { <nl> } <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief runs arangob <nl> + / / / @ brief runs arangobench <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> function runArangoBenchmark ( options , instanceInfo , cmds ) { <nl> function runArangoBenchmark ( options , instanceInfo , cmds ) { <nl> args [ " flatCommands " ] = [ " - - quiet " ] ; <nl> } <nl> <nl> - return executeAndWait ( ARANGOB_BIN , toArgv ( args ) , options ) ; <nl> + return executeAndWait ( ARANGOBENCH_BIN , toArgv ( args ) , options ) ; <nl> } <nl> <nl> function shutdownArangod ( arangod , options ) { <nl> let allTests = [ <nl> " shell_server_aql " , <nl> " ssl_server " , <nl> " upgrade " , <nl> - " arangob " <nl> + " arangobench " <nl> ] ; <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> testFuncs . arangosh = function ( options ) { <nl> } ; <nl> <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> - / / / @ brief TEST : arangob <nl> + / / / @ brief TEST : arangobench <nl> / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / <nl> <nl> const benchTodos = [ { <nl> const benchTodos = [ { <nl> " transaction " : true <nl> } ] ; <nl> <nl> - testFuncs . arangob = function ( options ) { <nl> - if ( options . skipArangoB = = = true ) { <nl> + testFuncs . arangobench = function ( options ) { <nl> + if ( options . skipArangoBench = = = true ) { <nl> print ( " skipping Benchmark tests ! " ) ; <nl> return { <nl> - arangob : { <nl> + arangobench : { <nl> status : true , <nl> skipped : true <nl> } <nl> } ; <nl> } <nl> <nl> - print ( CYAN + " arangob tests . . . " + RESET ) ; <nl> + print ( CYAN + " arangobench tests . . . " + RESET ) ; <nl> <nl> - let instanceInfo = startInstance ( " tcp " , options , { } , " arangob " ) ; <nl> + let instanceInfo = startInstance ( " tcp " , options , { } , " arangobench " ) ; <nl> <nl> if ( instanceInfo = = = false ) { <nl> return { <nl> - arangob : { <nl> + arangobench : { <nl> status : false , <nl> message : " failed to start server ! " <nl> } <nl> testFuncs . arangob = function ( options ) { <nl> const benchTodo = benchTodos [ i ] ; <nl> const name = " case " + i ; <nl> <nl> - if ( ( options . skipArangoBNonConnKeepAlive ) & & <nl> + if ( ( options . skipArangoBenchNonConnKeepAlive ) & & <nl> benchTodo . hasOwnProperty ( ' keep - alive ' ) & & <nl> ( benchTodo [ ' keep - alive ' ] = = = " false " ) ) { <nl> benchTodo [ ' keep - alive ' ] = true ; <nl> testFuncs . config = function ( options ) { <nl> } ; <nl> <nl> const ts = [ " arangod " , <nl> - " arangob " , <nl> + " arangobench " , <nl> " arangodump " , <nl> " arangoimp " , <nl> " arangorestore " , <nl> function unitTest ( cases , options ) { <nl> } <nl> <nl> CONFIG_DIR = fs . join ( TOP_DIR , builddir , " etc " , " arangodb " ) ; <nl> - ARANGOB_BIN = fs . join ( BIN_DIR , " arangob " ) ; <nl> + ARANGOBENCH_BIN = fs . join ( BIN_DIR , " arangobench " ) ; <nl> ARANGODUMP_BIN = fs . join ( BIN_DIR , " arangodump " ) ; <nl> ARANGOD_BIN = fs . join ( BIN_DIR , " arangod " ) ; <nl> ARANGOIMP_BIN = fs . join ( BIN_DIR , " arangoimp " ) ; <nl> | renamed arangob to arangobench | arangodb/arangodb | 5ec9cff9042dd9c4cee6a712881b32090f887147 | 2016-04-27T10:15:19Z |
mmm a / folly / String . h <nl> ppp b / folly / String . h <nl> <nl> # include < vector > <nl> <nl> # include < boost / regex / pending / unicode_iterator . hpp > <nl> - # include < boost / type_traits . hpp > <nl> <nl> # include < folly / Conv . h > <nl> # include < folly / ExceptionString . h > <nl> | folly / String : drop unneeded type_traits header | facebook/folly | faed3cec5b41944acb8effc057ece03e1153553a | 2018-03-16T20:55:54Z |
mmm a / cmake / OpenCVUtils . cmake <nl> ppp b / cmake / OpenCVUtils . cmake <nl> if ( NOT COMMAND find_host_program ) <nl> endmacro ( ) <nl> endif ( ) <nl> <nl> + # assert macro <nl> + # Note : it doesn ' t support lists in arguments <nl> + # Usage samples : <nl> + # ocv_assert ( MyLib_FOUND ) <nl> + # ocv_assert ( DEFINED MyLib_INCLUDE_DIRS ) <nl> + macro ( ocv_assert ) <nl> + if ( NOT ( $ { ARGN } ) ) <nl> + string ( REPLACE " ; " " " __assert_msg " $ { ARGN } " ) <nl> + message ( AUTHOR_WARNING " Assertion failed : $ { __assert_msg } " ) <nl> + endif ( ) <nl> + endmacro ( ) <nl> + <nl> macro ( ocv_check_environment_variables ) <nl> foreach ( _var $ { ARGN } ) <nl> if ( NOT DEFINED $ { _var } AND DEFINED ENV { $ { _var } } ) <nl> mmm a / modules / java / CMakeLists . txt <nl> ppp b / modules / java / CMakeLists . txt <nl> add_library ( $ { the_module } SHARED $ { handwrittren_h_sources } $ { handwrittren_cpp_so <nl> " $ { JAR_FILE } " " $ { JAR_FILE } . dephelper " ) <nl> if ( BUILD_FAT_JAVA_LIB ) <nl> set ( __deps $ { OPENCV_MODULE_ $ { the_module } _DEPS } $ { OPENCV_MODULES_BUILD } ) <nl> - list ( REMOVE_ITEM __deps $ { the_module } opencv_ts ) <nl> + foreach ( m $ { OPENCV_MODULES_BUILD } ) # filterout INTERNAL ( like opencv_ts ) and BINDINGS ( like opencv_python ) modules <nl> + ocv_assert ( DEFINED OPENCV_MODULE_ $ { m } _CLASS ) <nl> + if ( NOT OPENCV_MODULE_ $ { m } _CLASS STREQUAL " PUBLIC " ) <nl> + list ( REMOVE_ITEM __deps $ { m } ) <nl> + endif ( ) <nl> + endforeach ( ) <nl> ocv_list_unique ( __deps ) <nl> set ( __extradeps $ { __deps } ) <nl> ocv_list_filterout ( __extradeps " ^ opencv_ " ) <nl> | cmake : fix linker dependencies for opencv_java | opencv/opencv | 4b17d073c07c1b73480833bd0c8f03f17d8d9502 | 2013-10-24T15:04:59Z |
mmm a / lib / SILOptimizer / Differentiation / Thunk . cpp <nl> ppp b / lib / SILOptimizer / Differentiation / Thunk . cpp <nl> CanSILFunctionType buildThunkType ( SILFunction * fn , <nl> fn - > getASTContext ( ) ) ; <nl> } <nl> <nl> + / / / Forward function arguments , handling ownership convention mismatches . <nl> + / / / Adapted from ` forwardFunctionArguments ` in SILGenPoly . cpp . <nl> + / / / <nl> + / / / Forwarded arguments are appended to ` forwardedArgs ` . <nl> + / / / <nl> + / / / Local allocations are appended to ` localAllocations ` . They need to be <nl> + / / / deallocated via ` dealloc_stack ` . <nl> + / / / <nl> + / / / Local values requiring cleanup are appended to ` valuesToCleanup ` . <nl> + static void forwardFunctionArgumentsConvertingOwnership ( <nl> + SILBuilder & builder , SILLocation loc , CanSILFunctionType fromTy , <nl> + CanSILFunctionType toTy , ArrayRef < SILArgument * > originalArgs , <nl> + SmallVectorImpl < SILValue > & forwardedArgs , <nl> + SmallVectorImpl < AllocStackInst * > & localAllocations , <nl> + SmallVectorImpl < SILValue > & valuesToCleanup ) { <nl> + auto fromParameters = fromTy - > getParameters ( ) ; <nl> + auto toParameters = toTy - > getParameters ( ) ; <nl> + assert ( fromParameters . size ( ) = = toParameters . size ( ) ) ; <nl> + assert ( fromParameters . size ( ) = = originalArgs . size ( ) ) ; <nl> + for ( auto index : indices ( originalArgs ) ) { <nl> + auto & arg = originalArgs [ index ] ; <nl> + auto fromParam = fromParameters [ index ] ; <nl> + auto toParam = toParameters [ index ] ; <nl> + / / To convert guaranteed argument to be owned , create a copy . <nl> + if ( fromParam . isConsumed ( ) & & ! toParam . isConsumed ( ) ) { <nl> + / / If the argument has an object type , create a ` copy_value ` . <nl> + if ( arg - > getType ( ) . isObject ( ) ) { <nl> + auto argCopy = builder . emitCopyValueOperation ( loc , arg ) ; <nl> + forwardedArgs . push_back ( argCopy ) ; <nl> + continue ; <nl> + } <nl> + / / If the argument has an address type , create a local allocation and <nl> + / / ` copy_addr ` its contents to the local allocation . <nl> + auto * alloc = builder . createAllocStack ( loc , arg - > getType ( ) ) ; <nl> + builder . createCopyAddr ( loc , arg , alloc , IsNotTake , IsInitialization ) ; <nl> + localAllocations . push_back ( alloc ) ; <nl> + forwardedArgs . push_back ( alloc ) ; <nl> + continue ; <nl> + } <nl> + / / To convert owned argument to be guaranteed , borrow the argument . <nl> + if ( fromParam . isGuaranteed ( ) & & ! toParam . isGuaranteed ( ) ) { <nl> + auto bbi = builder . emitBeginBorrowOperation ( loc , arg ) ; <nl> + forwardedArgs . push_back ( bbi ) ; <nl> + valuesToCleanup . push_back ( bbi ) ; <nl> + valuesToCleanup . push_back ( arg ) ; <nl> + continue ; <nl> + } <nl> + / / Otherwise , simply forward the argument . <nl> + forwardedArgs . push_back ( arg ) ; <nl> + } <nl> + } <nl> + <nl> SILFunction * getOrCreateReabstractionThunk ( SILOptFunctionBuilder & fb , <nl> SILModule & module , SILLocation loc , <nl> SILFunction * caller , <nl> SILFunction * getOrCreateReabstractionThunk ( SILOptFunctionBuilder & fb , <nl> thunkType , fromInterfaceType , toInterfaceType , Type ( ) , <nl> module . getSwiftModule ( ) ) ; <nl> <nl> - / / FIXME ( TF - 989 ) : Mark reabstraction thunks as transparent . This requires <nl> - / / generating ossa reabstraction thunks so that they can be inlined during <nl> - / / mandatory inlining when ` - enable - strip - ownership - after - serialization ` is <nl> - / / true and ownership model eliminator is not run after differentiation . <nl> auto * thunk = fb . getOrCreateSharedFunction ( <nl> - loc , name , thunkDeclType , IsBare , IsNotTransparent , IsSerialized , <nl> + loc , name , thunkDeclType , IsBare , IsTransparent , IsSerialized , <nl> ProfileCounter ( ) , IsReabstractionThunk , IsNotDynamic ) ; <nl> if ( ! thunk - > empty ( ) ) <nl> return thunk ; <nl> <nl> thunk - > setGenericEnvironment ( genericEnv ) ; <nl> - thunk - > setOwnershipEliminated ( ) ; <nl> auto * entry = thunk - > createBasicBlock ( ) ; <nl> SILBuilder builder ( entry ) ; <nl> createEntryArguments ( thunk ) ; <nl> SILFunction * getOrCreateReabstractionThunk ( SILOptFunctionBuilder & fb , <nl> SILFunctionConventions toConv ( toType , module ) ; <nl> assert ( toConv . useLoweredAddresses ( ) ) ; <nl> <nl> - auto * fnArg = thunk - > getArgumentsWithoutIndirectResults ( ) . back ( ) ; <nl> + / / Forward thunk arguments , handling ownership convention mismatches . <nl> + SmallVector < SILValue , 4 > forwardedArgs ; <nl> + for ( auto indRes : thunk - > getIndirectResults ( ) ) <nl> + forwardedArgs . push_back ( indRes ) ; <nl> + SmallVector < AllocStackInst * , 4 > localAllocations ; <nl> + SmallVector < SILValue , 4 > valuesToCleanup ; <nl> + forwardFunctionArgumentsConvertingOwnership ( <nl> + builder , loc , fromType , toType , <nl> + thunk - > getArgumentsWithoutIndirectResults ( ) . drop_back ( ) , forwardedArgs , <nl> + localAllocations , valuesToCleanup ) ; <nl> <nl> SmallVector < SILValue , 4 > arguments ; <nl> - auto toArgIter = thunk - > getArguments ( ) . begin ( ) ; <nl> + auto toArgIter = forwardedArgs . begin ( ) ; <nl> auto useNextArgument = [ & ] ( ) { arguments . push_back ( * toArgIter + + ) ; } ; <nl> <nl> - SmallVector < AllocStackInst * , 4 > localAllocations ; <nl> auto createAllocStack = [ & ] ( SILType type ) { <nl> auto * alloc = builder . createAllocStack ( loc , type ) ; <nl> localAllocations . push_back ( alloc ) ; <nl> SILFunction * getOrCreateReabstractionThunk ( SILOptFunctionBuilder & fb , <nl> if ( ! paramTy . hasArchetype ( ) ) <nl> paramTy = thunk - > mapTypeIntoContext ( paramTy ) ; <nl> assert ( paramTy . isAddress ( ) ) ; <nl> - auto * toArg = * toArgIter + + ; <nl> + auto toArg = * toArgIter + + ; <nl> auto * buf = createAllocStack ( toArg - > getType ( ) ) ; <nl> - builder . createStore ( loc , toArg , buf , <nl> - StoreOwnershipQualifier : : Unqualified ) ; <nl> + toArg = builder . emitCopyValueOperation ( loc , toArg ) ; <nl> + builder . emitStoreValueOperation ( loc , toArg , buf , <nl> + StoreOwnershipQualifier : : Init ) ; <nl> + valuesToCleanup . push_back ( buf ) ; <nl> arguments . push_back ( buf ) ; <nl> continue ; <nl> } <nl> / / Convert direct parameter to indirect parameter . <nl> assert ( toParam . isFormalIndirect ( ) ) ; <nl> - auto * toArg = * toArgIter + + ; <nl> - auto * load = <nl> - builder . createLoad ( loc , toArg , LoadOwnershipQualifier : : Unqualified ) ; <nl> + auto toArg = * toArgIter + + ; <nl> + auto load = builder . emitLoadBorrowOperation ( loc , toArg ) ; <nl> + if ( isa < LoadBorrowInst > ( load ) ) <nl> + valuesToCleanup . push_back ( load ) ; <nl> arguments . push_back ( load ) ; <nl> } <nl> <nl> + auto * fnArg = thunk - > getArgumentsWithoutIndirectResults ( ) . back ( ) ; <nl> auto * apply = builder . createApply ( loc , fnArg , SubstitutionMap ( ) , arguments , <nl> / * isNonThrowing * / false ) ; <nl> <nl> SILFunction * getOrCreateReabstractionThunk ( SILOptFunctionBuilder & fb , <nl> / / Load direct results from indirect results . <nl> if ( fromRes . isFormalIndirect ( ) ) { <nl> auto indRes = * fromIndResultsIter + + ; <nl> - auto * load = <nl> - builder . createLoad ( loc , indRes , LoadOwnershipQualifier : : Unqualified ) ; <nl> + auto load = builder . emitLoadValueOperation ( loc , indRes , <nl> + LoadOwnershipQualifier : : Take ) ; <nl> results . push_back ( load ) ; <nl> continue ; <nl> } <nl> SILFunction * getOrCreateReabstractionThunk ( SILOptFunctionBuilder & fb , <nl> assert ( resultTy . isAddress ( ) ) ; <nl> # endif <nl> auto indRes = * toIndResultsIter + + ; <nl> - builder . createStore ( loc , * fromDirResultsIter + + , indRes , <nl> - StoreOwnershipQualifier : : Unqualified ) ; <nl> + auto dirRes = * fromDirResultsIter + + ; <nl> + builder . emitStoreValueOperation ( loc , dirRes , indRes , <nl> + StoreOwnershipQualifier : : Init ) ; <nl> } <nl> auto retVal = joinElements ( results , builder , loc ) ; <nl> <nl> + / / Clean up local values . <nl> + / / Guaranteed values need an ` end_borrow ` . <nl> + / / Owned values need to be destroyed . <nl> + for ( auto arg : valuesToCleanup ) { <nl> + switch ( arg . getOwnershipKind ( ) ) { <nl> + case ValueOwnershipKind : : Guaranteed : <nl> + builder . emitEndBorrowOperation ( loc , arg ) ; <nl> + break ; <nl> + case ValueOwnershipKind : : Owned : <nl> + case ValueOwnershipKind : : Unowned : <nl> + case ValueOwnershipKind : : None : <nl> + builder . emitDestroyOperation ( loc , arg ) ; <nl> + break ; <nl> + } <nl> + } <nl> + <nl> / / Deallocate local allocations . <nl> for ( auto * alloc : llvm : : reverse ( localAllocations ) ) <nl> builder . createDeallocStack ( loc , alloc ) ; <nl> getOrCreateSubsetParametersThunkForLinearMap ( <nl> auto * buf = builder . createAllocStack ( loc , zeroSILObjType ) ; <nl> localAllocations . push_back ( buf ) ; <nl> emitZeroIntoBuffer ( builder , zeroType , buf , loc ) ; <nl> - if ( zeroSILType . isAddress ( ) ) <nl> + if ( zeroSILType . isAddress ( ) ) { <nl> arguments . push_back ( buf ) ; <nl> - else { <nl> - auto * arg = <nl> - builder . createLoad ( loc , buf , LoadOwnershipQualifier : : Unqualified ) ; <nl> + } else { <nl> + auto arg = builder . emitLoadValueOperation ( loc , buf , <nl> + LoadOwnershipQualifier : : Take ) ; <nl> arguments . push_back ( arg ) ; <nl> } <nl> break ; <nl> getOrCreateSubsetParametersThunkForDerivativeFunction ( <nl> if ( ! thunk - > empty ( ) ) <nl> return { thunk , interfaceSubs } ; <nl> <nl> - / / TODO ( TF - 1206 ) : Enable ownership in all differentiation thunks . <nl> - thunk - > setOwnershipEliminated ( ) ; <nl> thunk - > setGenericEnvironment ( genericEnv ) ; <nl> auto * entry = thunk - > createBasicBlock ( ) ; <nl> SILBuilder builder ( entry ) ; <nl> | [ AutoDiff ] Generate transparent ossa reabstraction thunks . ( ) | apple/swift | 14e63380f26a74417c2129f6433a5a2abe2d9ce6 | 2020-09-09T01:04:04Z |
mmm a / caffe2 / core / test_utils . h <nl> ppp b / caffe2 / core / test_utils . h <nl> caffe2 : : OperatorDef * createOperator ( <nl> const std : : vector < string > & outputs , <nl> caffe2 : : NetDef * net ) ; <nl> <nl> + / / Fill data from a vector to a tensor . <nl> + template < typename T > <nl> + void fillTensor ( <nl> + const vector < int64_t > & shape , <nl> + const vector < T > & data , <nl> + TensorCPU * tensor ) { <nl> + tensor - > Resize ( shape ) ; <nl> + CAFFE_ENFORCE_EQ ( data . size ( ) , tensor - > numel ( ) ) ; <nl> + auto ptr = tensor - > mutable_data < T > ( ) ; <nl> + for ( int i = 0 ; i < tensor - > numel ( ) ; + + i ) { <nl> + ptr [ i ] = data [ i ] ; <nl> + } <nl> + } <nl> + <nl> + / / Create a tensor and fill data . <nl> + template < typename T > <nl> + caffe2 : : Tensor * createTensorAndFill ( <nl> + const string & name , <nl> + const vector < int64_t > & shape , <nl> + const vector < T > & data , <nl> + Workspace * workspace ) { <nl> + auto * tensor = createTensor ( name , workspace ) ; <nl> + fillTensor < T > ( shape , data , tensor ) ; <nl> + return tensor ; <nl> + } <nl> + <nl> + / / Fill a constant to a tensor . <nl> + template < typename T > <nl> + void constantFillTensor ( <nl> + const vector < int64_t > & shape , <nl> + const T & data , <nl> + TensorCPU * tensor ) { <nl> + tensor - > Resize ( shape ) ; <nl> + auto ptr = tensor - > mutable_data < T > ( ) ; <nl> + for ( int i = 0 ; i < tensor - > numel ( ) ; + + i ) { <nl> + ptr [ i ] = data ; <nl> + } <nl> + } <nl> + <nl> + / / Create a tensor and fill a constant . <nl> + template < typename T > <nl> + caffe2 : : Tensor * createTensorAndConstantFill ( <nl> + const string & name , <nl> + const vector < int64_t > & shape , <nl> + const T & data , <nl> + Workspace * workspace ) { <nl> + auto * tensor = createTensor ( name , workspace ) ; <nl> + constantFillTensor < T > ( shape , data , tensor ) ; <nl> + return tensor ; <nl> + } <nl> + <nl> / / Coincise util class to mutate a net in a chaining fashion . <nl> class NetMutator { <nl> public : <nl> class NetMutator { <nl> caffe2 : : NetDef * net_ ; <nl> } ; <nl> <nl> + / / Coincise util class to mutate a workspace in a chaining fashion . <nl> + class WorkspaceMutator { <nl> + public : <nl> + explicit WorkspaceMutator ( caffe2 : : Workspace * workspace ) <nl> + : workspace_ ( workspace ) { } <nl> + <nl> + / / New tensor filled by a data vector . <nl> + template < typename T > <nl> + WorkspaceMutator & newTensor ( <nl> + const string & name , <nl> + const vector < int64_t > & shape , <nl> + const vector < T > & data ) { <nl> + createTensorAndFill < T > ( name , shape , data , workspace_ ) ; <nl> + return * this ; <nl> + } <nl> + <nl> + / / New tensor filled by a constant . <nl> + template < typename T > <nl> + WorkspaceMutator & newTensorConst ( <nl> + const string & name , <nl> + const vector < int64_t > & shape , <nl> + const T & data ) { <nl> + createTensorAndConstantFill < T > ( name , shape , data , workspace_ ) ; <nl> + return * this ; <nl> + } <nl> + <nl> + private : <nl> + caffe2 : : Workspace * workspace_ ; <nl> + } ; <nl> + <nl> } / / namespace testing <nl> } / / namespace caffe2 <nl> <nl> | caffe2 - easy - test utils to fill tensors ( ) | pytorch/pytorch | a0f68646acc2d9dfbcf70087b0f0f3569cadc723 | 2018-12-14T04:45:44Z |
mmm a / tensorflow / core / grappler / optimizers / constant_folding . cc <nl> ppp b / tensorflow / core / grappler / optimizers / constant_folding . cc <nl> string AsControlDependency ( const NodeDef & node ) { <nl> ConstantFolding : : ConstantFolding ( ) { <nl> ops_to_preserve_ = std : : regex ( <nl> " Placeholder . * | Const | . * Save . * | . * Restore . * | . * Reader | Enter | Exit | " <nl> - " NextIteration " ) ; <nl> + " NextIteration | . * Quantized . * " ) ; <nl> } <nl> <nl> string ConstantFolding : : AddControlDependency ( const string & input_name ) { <nl> | Blacklist the quantized ops since they have too many issues ( incorrect shape | tensorflow/tensorflow | 436eacd5de98783cc8e23f5da9161182aeeaf487 | 2017-06-22T01:13:10Z |
mmm a / contrib / Python / cntk / graph . py <nl> ppp b / contrib / Python / cntk / graph . py <nl> def _get_input_node ( list_of_tensors , has_sequence_dimension , * * kw ) : <nl> # followed by a reshape node that has the dims ' 2 : 3 ' . So we have 2 * 3 = 6 <nl> # dimensions when flattened out for the reader . <nl> dims = int ( np . multiply . reduce ( cntk_shape ) ) <nl> - node = cntk1_ops . Input ( dims , * * kw ) <nl> + node = cntk1_ops . Input ( cntk_shape , * * kw ) <nl> node . reader = CNTKTextFormatReader ( tf . name ) <nl> node . reader . add_input ( node , alias , dims ) <nl> <nl> - if len ( cntk_shape ) > 1 : <nl> - node = cntk1_ops . NewReshape ( node , <nl> - dims = cntk_shape ) <nl> - <nl> return node <nl> <nl> <nl> | remove the reshape after input | microsoft/CNTK | 53d9c9095d518936397387551fbfa47b6434e400 | 2016-04-12T09:51:17Z |
mmm a / . travis . yml <nl> ppp b / . travis . yml <nl> os : <nl> - osx <nl> julia : <nl> - 0 . 4 <nl> + - 0 . 5 <nl> - nightly <nl> <nl> # dependent apt packages <nl> | nightly is v0 . 6 | apache/incubator-mxnet | 2c36a5debbfb7122ea68b65807d7e5a911669fd2 | 2016-08-11T01:40:50Z |
mmm a / tensorflow / core / util / tensor_bundle / tensor_bundle . cc <nl> ppp b / tensorflow / core / util / tensor_bundle / tensor_bundle . cc <nl> Status ReadInputByChunk ( const RandomAccessFile * file , size_t offset , <nl> <nl> } / / namespace <nl> <nl> - string DataFilename ( const string & prefix , int32 shard_id , int32 num_shards ) { <nl> + string DataFilename ( StringPiece prefix , int32 shard_id , int32 num_shards ) { <nl> DCHECK_GT ( num_shards , 0 ) ; <nl> DCHECK_LT ( shard_id , num_shards ) ; <nl> - return strings : : Printf ( " % s . data - % 05d - of - % 05d " , prefix . c_str ( ) , shard_id , <nl> - num_shards ) ; <nl> + return strings : : Printf ( " % . * s . data - % 05d - of - % 05d " , <nl> + static_cast < int > ( prefix . size ( ) ) , prefix . data ( ) , <nl> + shard_id , num_shards ) ; <nl> } <nl> <nl> - string MetaFilename ( const string & prefix ) { <nl> - return strings : : Printf ( " % s . index " , prefix . c_str ( ) ) ; <nl> + string MetaFilename ( StringPiece prefix ) { <nl> + return strings : : Printf ( " % . * s . index " , static_cast < int > ( prefix . size ( ) ) , <nl> + prefix . data ( ) ) ; <nl> } <nl> <nl> - BundleWriter : : BundleWriter ( Env * env , const string & prefix ) <nl> - : env_ ( env ) , prefix_ ( prefix ) , out_ ( nullptr ) , size_ ( 0 ) { <nl> + BundleWriter : : BundleWriter ( Env * env , StringPiece prefix ) <nl> + : env_ ( env ) , prefix_ ( prefix . ToString ( ) ) , out_ ( nullptr ) , size_ ( 0 ) { <nl> status_ = <nl> env_ - > CreateDir ( io : : Dirname ( prefix_ ) . ToString ( ) ) ; / / Ignores errors . <nl> const string filename = DataFilename ( prefix_ , 0 , 1 ) ; <nl> BundleWriter : : BundleWriter ( Env * env , const string & prefix ) <nl> <nl> BundleWriter : : ~ BundleWriter ( ) { CHECK ( out_ = = nullptr ) ; } <nl> <nl> - Status BundleWriter : : Add ( const string & key , const Tensor & val ) { <nl> + Status BundleWriter : : Add ( StringPiece key , const Tensor & val ) { <nl> CHECK_NE ( key , kHeaderEntryKey ) ; <nl> + const string key_string = key . ToString ( ) ; <nl> if ( ! status_ . ok ( ) ) return status_ ; <nl> - if ( entries_ . find ( key ) ! = entries_ . end ( ) ) { <nl> + if ( entries_ . find ( key_string ) ! = entries_ . end ( ) ) { <nl> status_ = errors : : InvalidArgument ( " Adding duplicate key : " , key ) ; <nl> return status_ ; <nl> } <nl> <nl> - BundleEntryProto * entry = & entries_ [ key ] ; <nl> + BundleEntryProto * entry = & entries_ [ key_string ] ; <nl> entry - > set_dtype ( val . dtype ( ) ) ; <nl> val . shape ( ) . AsProto ( entry - > mutable_shape ( ) ) ; <nl> entry - > set_shard_id ( 0 ) ; <nl> Status BundleWriter : : Add ( const string & key , const Tensor & val ) { <nl> return status_ ; <nl> } <nl> <nl> - Status BundleWriter : : AddSlice ( const string & full_tensor_key , <nl> + Status BundleWriter : : AddSlice ( StringPiece full_tensor_key , <nl> const TensorShape & full_tensor_shape , <nl> const TensorSlice & slice_spec , <nl> const Tensor & slice_tensor ) { <nl> Status BundleWriter : : AddSlice ( const string & full_tensor_key , <nl> / / In the case of a sharded save , MergeBundles ( ) is responsible for merging <nl> / / the " slices " field of multiple metadata entries corresponding to the same <nl> / / full tensor . <nl> - BundleEntryProto * full_entry = & entries_ [ full_tensor_key ] ; <nl> + const string full_tensor_key_string = full_tensor_key . ToString ( ) ; <nl> + BundleEntryProto * full_entry = & entries_ [ full_tensor_key_string ] ; <nl> if ( full_entry - > dtype ( ) ! = DT_INVALID ) { <nl> CHECK_EQ ( full_entry - > dtype ( ) , slice_tensor . dtype ( ) ) ; <nl> } <nl> Status BundleWriter : : AddSlice ( const string & full_tensor_key , <nl> / / The slice itself is handled by a regular Add ( ) , which includes adding its <nl> / / own metadata entry , and writing out the slice ' s values . <nl> const string slice_name = <nl> - checkpoint : : EncodeTensorNameSlice ( full_tensor_key , slice_spec ) ; <nl> + checkpoint : : EncodeTensorNameSlice ( full_tensor_key_string , slice_spec ) ; <nl> status_ = Add ( slice_name , slice_tensor ) ; <nl> return status_ ; <nl> } <nl> struct MergeState { <nl> <nl> / / Merges entries of " prefix " into the accumulator state " merge " . <nl> / / Returns OK iff the merge succeeds . <nl> - static Status MergeOneBundle ( Env * env , const string & prefix , <nl> + static Status MergeOneBundle ( Env * env , StringPiece prefix , <nl> MergeState * merge_state ) { <nl> VLOG ( 1 ) < < " Merging bundle : " < < prefix ; <nl> - const string & filename = MetaFilename ( prefix ) ; <nl> + const string filename = MetaFilename ( prefix ) ; <nl> uint64 file_size ; <nl> TF_RETURN_IF_ERROR ( env - > GetFileSize ( filename , & file_size ) ) ; <nl> std : : unique_ptr < RandomAccessFile > file ; <nl> static Status MergeOneBundle ( Env * env , const string & prefix , <nl> } <nl> <nl> Status MergeBundles ( Env * env , gtl : : ArraySlice < string > prefixes , <nl> - const string & merged_prefix ) { <nl> + StringPiece merged_prefix ) { <nl> / / Merges all metadata tables . <nl> / / TODO ( zhifengc ) : KeyValue sorter if it becomes too big . <nl> MergeState merge ; <nl> Status MergeBundles ( Env * env , gtl : : ArraySlice < string > prefixes , <nl> <nl> / / Interface for reading a tensor bundle . <nl> <nl> - BundleReader : : BundleReader ( Env * env , const string & prefix ) <nl> + BundleReader : : BundleReader ( Env * env , StringPiece prefix ) <nl> : env_ ( env ) , <nl> - prefix_ ( prefix ) , <nl> + prefix_ ( prefix . ToString ( ) ) , <nl> metadata_ ( nullptr ) , <nl> table_ ( nullptr ) , <nl> iter_ ( nullptr ) { <nl> - const string & filename = MetaFilename ( prefix_ ) ; <nl> + const string filename = MetaFilename ( prefix_ ) ; <nl> uint64 file_size ; <nl> status_ = env_ - > GetFileSize ( filename , & file_size ) ; <nl> if ( ! status_ . ok ( ) ) return ; <nl> BundleReader : : ~ BundleReader ( ) { <nl> gtl : : STLDeleteValues ( & tensor_slices_ ) ; <nl> } <nl> <nl> - Status BundleReader : : GetBundleEntryProto ( const string & key , <nl> + Status BundleReader : : GetBundleEntryProto ( StringPiece key , <nl> BundleEntryProto * entry ) { <nl> entry - > Clear ( ) ; <nl> TF_CHECK_OK ( status_ ) ; <nl> Status BundleReader : : GetValue ( const BundleEntryProto & entry , Tensor * val ) { <nl> return Status : : OK ( ) ; <nl> } <nl> <nl> - Status BundleReader : : Lookup ( const string & key , Tensor * val ) { <nl> + Status BundleReader : : Lookup ( StringPiece key , Tensor * val ) { <nl> BundleEntryProto entry ; <nl> TF_RETURN_IF_ERROR ( GetBundleEntryProto ( key , & entry ) ) ; <nl> <nl> Status BundleReader : : Lookup ( const string & key , Tensor * val ) { <nl> } <nl> } <nl> <nl> - Status BundleReader : : LookupSlice ( const string & full_tensor_key , <nl> + Status BundleReader : : LookupSlice ( StringPiece full_tensor_key , <nl> const TensorSlice & slice_spec , Tensor * val ) { <nl> BundleEntryProto entry ; <nl> TF_RETURN_IF_ERROR ( GetBundleEntryProto ( full_tensor_key , & entry ) ) ; <nl> return GetSliceValue ( full_tensor_key , entry , slice_spec , val ) ; <nl> } <nl> <nl> - Status BundleReader : : GetSliceValue ( const string & full_tensor_key , <nl> + Status BundleReader : : GetSliceValue ( StringPiece full_tensor_key , <nl> const BundleEntryProto & full_tensor_entry , <nl> const TensorSlice & slice_spec , Tensor * val ) { <nl> using checkpoint : : TensorSliceSet ; <nl> Status BundleReader : : GetSliceValue ( const string & full_tensor_key , <nl> <nl> const TensorShape full_shape ( TensorShape ( full_tensor_entry . shape ( ) ) ) ; <nl> std : : vector < std : : pair < TensorSlice , string > > details ; <nl> + const string full_tensor_key_string = full_tensor_key . ToString ( ) ; <nl> const TensorSliceSet * tss = <nl> - gtl : : FindPtrOrNull ( tensor_slices_ , full_tensor_key ) ; <nl> + gtl : : FindPtrOrNull ( tensor_slices_ , full_tensor_key_string ) ; <nl> <nl> / / Populates the " full tensor key - > TensorSliceSet " cache . <nl> if ( tss = = nullptr ) { <nl> Status BundleReader : : GetSliceValue ( const string & full_tensor_key , <nl> / / Special case : a writer has saved a tensor fully , but the reader wants <nl> / / to read in slices . We therefore register the full slice on - demand here <nl> / / without further complicating the on - disk bundle format . <nl> - RegisterTensorSlice ( <nl> - full_tensor_key , full_shape , full_tensor_entry . dtype ( ) , / * tag * / " " , <nl> - / * full slice * / TensorSlice ( full_shape . dims ( ) ) , & tensor_slices_ ) ; <nl> + RegisterTensorSlice ( full_tensor_key_string , full_shape , <nl> + full_tensor_entry . dtype ( ) , / * tag * / " " , <nl> + / * full slice * / TensorSlice ( full_shape . dims ( ) ) , <nl> + & tensor_slices_ ) ; <nl> } <nl> for ( const TensorSliceProto & slice : full_tensor_entry . slices ( ) ) { <nl> - RegisterTensorSlice ( full_tensor_key , full_shape , <nl> + RegisterTensorSlice ( full_tensor_key_string , full_shape , <nl> full_tensor_entry . dtype ( ) , <nl> / * tag * / " " , TensorSlice ( slice ) , & tensor_slices_ ) ; <nl> } <nl> - tss = gtl : : FindPtrOrNull ( tensor_slices_ , full_tensor_key ) ; <nl> + tss = gtl : : FindPtrOrNull ( tensor_slices_ , full_tensor_key_string ) ; <nl> CHECK_NE ( tss , nullptr ) ; <nl> } <nl> if ( ! tss - > QueryMeta ( slice_spec , & details ) ) { <nl> Status BundleReader : : GetSliceValue ( const string & full_tensor_key , <nl> / / We already have the entry for the full tensor , so don ' t query again if <nl> / / the slice is full . <nl> if ( ! stored_slice . IsFull ( ) ) { <nl> - const string & encoded_stored_slice_name = <nl> - checkpoint : : EncodeTensorNameSlice ( full_tensor_key , stored_slice ) ; <nl> + const string encoded_stored_slice_name = <nl> + checkpoint : : EncodeTensorNameSlice ( full_tensor_key_string , <nl> + stored_slice ) ; <nl> status_ = <nl> GetBundleEntryProto ( encoded_stored_slice_name , & stored_slice_entry ) ; <nl> if ( ! status_ . ok ( ) ) return status_ ; <nl> Status BundleReader : : GetSliceValue ( const string & full_tensor_key , <nl> } <nl> <nl> bool BundleReader : : Contains ( StringPiece key ) { <nl> - Seek ( key . ToString ( ) ) ; <nl> + Seek ( key ) ; <nl> return Valid ( ) & & ( this - > key ( ) = = key ) ; <nl> } <nl> <nl> - Status BundleReader : : LookupTensorShape ( const string & key , TensorShape * shape ) { <nl> + Status BundleReader : : LookupTensorShape ( StringPiece key , TensorShape * shape ) { <nl> BundleEntryProto entry ; <nl> TF_RETURN_IF_ERROR ( GetBundleEntryProto ( key , & entry ) ) ; <nl> <nl> mmm a / tensorflow / core / util / tensor_bundle / tensor_bundle . h <nl> ppp b / tensorflow / core / util / tensor_bundle / tensor_bundle . h <nl> extern const char * const kHeaderEntryKey ; <nl> / / All threads accessing the same BundleWriter must synchronize . <nl> class BundleWriter { <nl> public : <nl> - BundleWriter ( Env * env , const string & prefix ) ; <nl> + BundleWriter ( Env * env , StringPiece prefix ) ; <nl> ~ BundleWriter ( ) ; <nl> <nl> / / Adds the tensor " val " under key " key " . <nl> / / Across calls " key " must be unique but can be added in any order . <nl> - Status Add ( const string & key , const Tensor & val ) ; <nl> + Status Add ( StringPiece key , const Tensor & val ) ; <nl> <nl> / / Partitioned variables support . <nl> / / A slice of a full tensor is stored in two entries in the metadata table : <nl> class BundleWriter { <nl> / / consistent entry for " full_tensor_key " is produced . <nl> / / <nl> / / Returns an error if the same slice is added the second time . <nl> - Status AddSlice ( const string & full_tensor_key , <nl> + Status AddSlice ( StringPiece full_tensor_key , <nl> const TensorShape & full_tensor_shape , <nl> const TensorSlice & slice_spec , const Tensor & slice_tensor ) ; <nl> <nl> class BundleWriter { <nl> / / Once merged , makes a best effort to delete the old metadata files . <nl> / / Returns OK iff all bundles are successfully merged . <nl> Status MergeBundles ( Env * env , gtl : : ArraySlice < string > prefixes , <nl> - const string & merged_prefix ) ; <nl> + StringPiece merged_prefix ) ; <nl> <nl> / / On construction , silently attempts to read the metadata associated with <nl> / / " prefix " . If caller intends to call any function afterwards , " status ( ) " <nl> Status MergeBundles ( Env * env , gtl : : ArraySlice < string > prefixes , <nl> / / All threads accessing the same BundleReader must synchronize . <nl> class BundleReader { <nl> public : <nl> - BundleReader ( Env * const env , const string & prefix ) ; <nl> + BundleReader ( Env * const env , StringPiece prefix ) ; <nl> ~ BundleReader ( ) ; <nl> <nl> / / Is ok ( ) iff the reader construction is successful ( completed the read of <nl> class BundleReader { <nl> / / Looks up the shape of the tensor keyed by " key " . <nl> / / Clears " shape " if not found . <nl> / / REQUIRES : status ( ) . ok ( ) <nl> - Status LookupTensorShape ( const string & key , <nl> + Status LookupTensorShape ( StringPiece key , <nl> TensorShape * shape ) TF_MUST_USE_RESULT ; <nl> <nl> / / Looks up the tensor keyed by " key " . If " key " refers to a partitioned <nl> class BundleReader { <nl> / / <nl> / / Validates the stored crc32c checksum against the restored bytes . <nl> / / REQUIRES : status ( ) . ok ( ) <nl> - Status Lookup ( const string & key , Tensor * val ) TF_MUST_USE_RESULT ; <nl> + Status Lookup ( StringPiece key , Tensor * val ) TF_MUST_USE_RESULT ; <nl> <nl> / / Looks up a specific slice of a partitioned tensor . <nl> / / It is only required that the stored slices cover the requested slice , <nl> / / namely " slice_spec " is a subset of the union of the stored slices . <nl> / / REQUIRES : status ( ) . ok ( ) <nl> - Status LookupSlice ( const string & full_tensor_key , <nl> - const TensorSlice & slice_spec , <nl> + Status LookupSlice ( StringPiece full_tensor_key , const TensorSlice & slice_spec , <nl> Tensor * val ) TF_MUST_USE_RESULT ; <nl> <nl> / / Seeks to the first position in the bundle whose key is no less than " key " . <nl> / / REQUIRES : status ( ) . ok ( ) <nl> - void Seek ( const string & key ) { return iter_ - > Seek ( key ) ; } <nl> + void Seek ( StringPiece key ) { return iter_ - > Seek ( key ) ; } <nl> / / Moves to the next position in the bundle . <nl> / / REQUIRES : status ( ) . ok ( ) <nl> void Next ( ) const { iter_ - > Next ( ) ; } <nl> class BundleReader { <nl> / / Seeks for " key " and reads the metadata proto . <nl> / / On non - OK return , clears " entry " for the caller . <nl> / / REQUIRES : status ( ) . ok ( ) <nl> - Status GetBundleEntryProto ( const string & key , <nl> + Status GetBundleEntryProto ( StringPiece key , <nl> BundleEntryProto * entry ) TF_MUST_USE_RESULT ; <nl> <nl> / / Reads the tensor value described by the metadata proto " entry " . <nl> class BundleReader { <nl> / / Reads the slice described by " slice_spec " . The corresponding full tensor <nl> / / has key " ful_tensor_key " and metadata proto " full_tensor_entry " . <nl> / / REQUIRES : full_tensor_entry . slices_size ( ) > 0 <nl> - Status GetSliceValue ( const string & full_tensor_key , <nl> + Status GetSliceValue ( StringPiece full_tensor_key , <nl> const BundleEntryProto & full_tensor_entry , <nl> const TensorSlice & slice_spec , <nl> Tensor * val ) TF_MUST_USE_RESULT ; <nl> class FileOutputBuffer { <nl> } ; <nl> <nl> / / Pattern : " < prefix > . data - < padded shard_id > - of - < padded num_shards > " . <nl> - string DataFilename ( const string & prefix , int32 shard_id , int32 num_shards ) ; <nl> + string DataFilename ( StringPiece prefix , int32 shard_id , int32 num_shards ) ; <nl> / / Pattern : " < prefix > . index . " <nl> - string MetaFilename ( const string & prefix ) ; <nl> + string MetaFilename ( StringPiece prefix ) ; <nl> <nl> } / / namespace tensorflow <nl> <nl> | tensor_bundle interface : accept StringPiece everywhere . | tensorflow/tensorflow | 754b5b207d5e24834c914fa2396d184c0bedf21d | 2016-10-03T18:49:21Z |
mmm a / src / compiler . cc <nl> ppp b / src / compiler . cc <nl> MaybeHandle < Code > Compiler : : GetUnoptimizedCode ( Handle < JSFunction > function ) { <nl> <nl> <nl> MaybeHandle < Code > Compiler : : GetLazyCode ( Handle < JSFunction > function ) { <nl> - DCHECK ( ! function - > GetIsolate ( ) - > has_pending_exception ( ) ) ; <nl> + Isolate * isolate = function - > GetIsolate ( ) ; <nl> + DCHECK ( ! isolate - > has_pending_exception ( ) ) ; <nl> DCHECK ( ! function - > is_compiled ( ) ) ; <nl> - <nl> - if ( FLAG_turbo_asm & & function - > shared ( ) - > asm_function ( ) ) { <nl> + / / If the debugger is active , do not compile with turbofan unless we can <nl> + / / deopt from turbofan code . <nl> + if ( FLAG_turbo_asm & & function - > shared ( ) - > asm_function ( ) & & <nl> + ( FLAG_turbo_deoptimization | | ! isolate - > debug ( ) - > is_active ( ) ) ) { <nl> CompilationInfoWithZone info ( function ) ; <nl> <nl> - VMState < COMPILER > state ( info . isolate ( ) ) ; <nl> - PostponeInterruptsScope postpone ( info . isolate ( ) ) ; <nl> + VMState < COMPILER > state ( isolate ) ; <nl> + PostponeInterruptsScope postpone ( isolate ) ; <nl> <nl> info . SetOptimizing ( BailoutId : : None ( ) , <nl> Handle < Code > ( function - > shared ( ) - > code ( ) ) ) ; <nl> MaybeHandle < Code > Compiler : : GetLazyCode ( Handle < JSFunction > function ) { <nl> info . MarkAsTypingEnabled ( ) ; <nl> info . MarkAsInliningDisabled ( ) ; <nl> <nl> - if ( GetOptimizedCodeNow ( & info ) ) return info . code ( ) ; <nl> + if ( GetOptimizedCodeNow ( & info ) ) { <nl> + DCHECK ( function - > shared ( ) - > is_compiled ( ) ) ; <nl> + return info . code ( ) ; <nl> + } <nl> } <nl> <nl> if ( function - > shared ( ) - > is_compiled ( ) ) { <nl> MaybeHandle < Code > Compiler : : GetLazyCode ( Handle < JSFunction > function ) { <nl> <nl> CompilationInfoWithZone info ( function ) ; <nl> Handle < Code > result ; <nl> - ASSIGN_RETURN_ON_EXCEPTION ( info . isolate ( ) , result , <nl> - GetUnoptimizedCodeCommon ( & info ) , Code ) ; <nl> + ASSIGN_RETURN_ON_EXCEPTION ( isolate , result , GetUnoptimizedCodeCommon ( & info ) , <nl> + Code ) ; <nl> <nl> - if ( FLAG_always_opt & & <nl> - info . isolate ( ) - > use_crankshaft ( ) & & <nl> + if ( FLAG_always_opt & & isolate - > use_crankshaft ( ) & & <nl> ! info . shared_info ( ) - > optimization_disabled ( ) & & <nl> - ! info . isolate ( ) - > DebuggerHasBreakPoints ( ) ) { <nl> + ! isolate - > DebuggerHasBreakPoints ( ) ) { <nl> Handle < Code > opt_code ; <nl> if ( Compiler : : GetOptimizedCode ( <nl> function , result , <nl> | Do not compile with Turbofan if we cannot deopt for debugging . | v8/v8 | ba1aef3fabbe563b44a660f51c8dc8e8e526f263 | 2014-10-30T14:40:44Z |
mmm a / extensions / proj . linux / Makefile <nl> ppp b / extensions / proj . linux / Makefile <nl> SOURCES = . . / CCBReader / CCBFileLoader . cpp \ <nl> . . / CocoStudio / Armature / utils / CCTransformHelp . cpp \ <nl> . . / CocoStudio / Armature / utils / CCTweenFunction . cpp \ <nl> . . / CocoStudio / Armature / utils / CCUtilMath . cpp \ <nl> + . . / CocoStudio / Components / CCComAttribute . cpp \ <nl> + . . / CocoStudio / Components / CCComAudio . cpp \ <nl> + . . / CocoStudio / Components / CCComController . cpp \ <nl> + . . / CocoStudio / Components / CCComRender . cpp \ <nl> + . . / CocoStudio / Components / CCInputDelegate . cpp \ <nl> . . / CocoStudio / GUI / Action / UIAction . cpp \ <nl> . . / CocoStudio / GUI / Action / UIActionFrame . cpp \ <nl> . . / CocoStudio / GUI / Action / UIActionManager . cpp \ <nl> SOURCES = . . / CCBReader / CCBFileLoader . cpp \ <nl> . . / CocoStudio / GUI / BaseClasses / UIRootWidget . cpp \ <nl> . . / CocoStudio / GUI / BaseClasses / UIWidget . cpp \ <nl> . . / CocoStudio / GUI / Layouts / Layout . cpp \ <nl> - . . / CocoStudio / GUI / Layouts / LayoutExecutant . cpp \ . . / CocoStudio / GUI / Layouts / LayoutParameter . cpp \ . . / CocoStudio / GUI / Layouts / UILayoutDefine . cpp \ <nl> - . . / CocoStudio / GUI / System / CocosGUI . cpp \ . . / CocoStudio / GUI / System / UIHelper . cpp \ . . / CocoStudio / GUI / System / UIInputManager . cpp \ . . / CocoStudio / GUI / System / UILayer . cpp \ <nl> - . . / CocoStudio / GUI / UIWidgets / UIButton . cpp \ . . / CocoStudio / GUI / UIWidgets / UICheckBox . cpp \ . . / CocoStudio / GUI / UIWidgets / UIImageView . cpp \ . . / CocoStudio / GUI / UIWidgets / UILabel . cpp \ . . / CocoStudio / GUI / UIWidgets / UILabelAtlas . cpp \ . . / CocoStudio / GUI / UIWidgets / UILabelBMFont . cpp \ . . / CocoStudio / GUI / UIWidgets / UILoadingBar . cpp \ . . / CocoStudio / GUI / UIWidgets / UISlider . cpp \ . . / CocoStudio / GUI / UIWidgets / UITextField . cpp \ <nl> - . . / CocoStudio / GUI / UIWidgets / ScrollWidget / UIDragPanel . cpp \ . . / CocoStudio / GUI / UIWidgets / ScrollWidget / UIListView . cpp \ . . / CocoStudio / GUI / UIWidgets / ScrollWidget / UIPageView . cpp \ . . / CocoStudio / GUI / UIWidgets / ScrollWidget / UIScrollView . cpp \ <nl> - . . / CocoStudio / Components / CCComAttribute . cpp \ <nl> - . . / CocoStudio / Components / CCComAudio . cpp \ <nl> - . . / CocoStudio / Components / CCComController . cpp \ <nl> - . . / CocoStudio / Components / CCComRender . cpp \ <nl> - . . / CocoStudio / Components / CCInputDelegate . cpp \ <nl> + . . / CocoStudio / GUI / Layouts / LayoutExecutant . cpp \ <nl> + . . / CocoStudio / GUI / Layouts / LayoutParameter . cpp \ <nl> + . . / CocoStudio / GUI / Layouts / UILayoutDefine . cpp \ <nl> + . . / CocoStudio / GUI / System / CocosGUI . cpp \ <nl> + . . / CocoStudio / GUI / System / UIHelper . cpp \ <nl> + . . / CocoStudio / GUI / System / UIInputManager . cpp \ <nl> + . . / CocoStudio / GUI / System / UILayer . cpp \ <nl> + . . / CocoStudio / GUI / UIWidgets / UIButton . cpp \ <nl> + . . / CocoStudio / GUI / UIWidgets / UICheckBox . cpp \ <nl> + . . / CocoStudio / GUI / UIWidgets / UIImageView . cpp \ <nl> + . . / CocoStudio / GUI / UIWidgets / UILabel . cpp \ <nl> + . . / CocoStudio / GUI / UIWidgets / UILabelAtlas . cpp \ <nl> + . . / CocoStudio / GUI / UIWidgets / UILabelBMFont . cpp \ <nl> + . . / CocoStudio / GUI / UIWidgets / UILoadingBar . cpp \ <nl> + . . / CocoStudio / GUI / UIWidgets / UISlider . cpp \ <nl> + . . / CocoStudio / GUI / UIWidgets / UITextField . cpp \ <nl> + . . / CocoStudio / GUI / UIWidgets / ScrollWidget / UIDragPanel . cpp \ <nl> + . . / CocoStudio / GUI / UIWidgets / ScrollWidget / UIListView . cpp \ <nl> + . . / CocoStudio / GUI / UIWidgets / ScrollWidget / UIPageView . cpp \ <nl> + . . / CocoStudio / GUI / UIWidgets / ScrollWidget / UIScrollView . cpp \ <nl> . . / CocoStudio / Json / CSContentJsonDictionary . cpp \ <nl> . . / CocoStudio / Json / DictionaryHelper . cpp \ <nl> - . . / CocoStudio / Json / lib_json / json_value . cpp \ <nl> . . / CocoStudio / Json / lib_json / json_reader . cpp \ <nl> + . . / CocoStudio / Json / lib_json / json_value . cpp \ <nl> . . / CocoStudio / Json / lib_json / json_writer . cpp \ <nl> + . . / CocoStudio / Reader / CCSGUIReader . cpp \ <nl> . . / CocoStudio / Reader / CCSSceneReader . cpp \ <nl> . . / spine / Animation . cpp \ <nl> . . / spine / AnimationState . cpp \ <nl> | [ CocoGUI ] Updating linux makefile . | cocos2d/cocos2d-x | cc413775916480a43692e2021e1594e9a324e689 | 2013-09-16T09:24:25Z |
mmm a / src / net . cpp <nl> ppp b / src / net . cpp <nl> static std : : vector < CAddress > convertSeed6 ( const std : : vector < SeedSpec6 > & vSeedsIn <nl> const int64_t nOneWeek = 7 * 24 * 60 * 60 ; <nl> std : : vector < CAddress > vSeedsOut ; <nl> vSeedsOut . reserve ( vSeedsIn . size ( ) ) ; <nl> - for ( std : : vector < SeedSpec6 > : : const_iterator i ( vSeedsIn . begin ( ) ) ; i ! = vSeedsIn . end ( ) ; + + i ) <nl> - { <nl> + for ( const auto & seed_in : vSeedsIn ) { <nl> struct in6_addr ip ; <nl> - memcpy ( & ip , i - > addr , sizeof ( ip ) ) ; <nl> - CAddress addr ( CService ( ip , i - > port ) , NODE_NETWORK ) ; <nl> + memcpy ( & ip , seed_in . addr , sizeof ( ip ) ) ; <nl> + CAddress addr ( CService ( ip , seed_in . port ) , NODE_NETWORK ) ; <nl> addr . nTime = GetTime ( ) - GetRand ( nOneWeek ) - nOneWeek ; <nl> vSeedsOut . push_back ( addr ) ; <nl> } <nl> bool IsReachable ( const CNetAddr & addr ) <nl> CNode * CConnman : : FindNode ( const CNetAddr & ip ) <nl> { <nl> LOCK ( cs_vNodes ) ; <nl> - for ( CNode * pnode : vNodes ) <nl> - if ( ( CNetAddr ) pnode - > addr = = ip ) <nl> - return ( pnode ) ; <nl> + for ( CNode * pnode : vNodes ) { <nl> + if ( ( CNetAddr ) pnode - > addr = = ip ) { <nl> + return pnode ; <nl> + } <nl> + } <nl> return nullptr ; <nl> } <nl> <nl> CNode * CConnman : : FindNode ( const CSubNet & subNet ) <nl> { <nl> LOCK ( cs_vNodes ) ; <nl> - for ( CNode * pnode : vNodes ) <nl> - if ( subNet . Match ( ( CNetAddr ) pnode - > addr ) ) <nl> - return ( pnode ) ; <nl> + for ( CNode * pnode : vNodes ) { <nl> + if ( subNet . Match ( ( CNetAddr ) pnode - > addr ) ) { <nl> + return pnode ; <nl> + } <nl> + } <nl> return nullptr ; <nl> } <nl> <nl> CNode * CConnman : : FindNode ( const std : : string & addrName ) <nl> LOCK ( cs_vNodes ) ; <nl> for ( CNode * pnode : vNodes ) { <nl> if ( pnode - > GetAddrName ( ) = = addrName ) { <nl> - return ( pnode ) ; <nl> + return pnode ; <nl> } <nl> } <nl> return nullptr ; <nl> CNode * CConnman : : FindNode ( const std : : string & addrName ) <nl> CNode * CConnman : : FindNode ( const CService & addr ) <nl> { <nl> LOCK ( cs_vNodes ) ; <nl> - for ( CNode * pnode : vNodes ) <nl> - if ( ( CService ) pnode - > addr = = addr ) <nl> - return ( pnode ) ; <nl> + for ( CNode * pnode : vNodes ) { <nl> + if ( ( CService ) pnode - > addr = = addr ) { <nl> + return pnode ; <nl> + } <nl> + } <nl> return nullptr ; <nl> } <nl> <nl> void CConnman : : ClearBanned ( ) <nl> bool CConnman : : IsBanned ( CNetAddr ip ) <nl> { <nl> LOCK ( cs_setBanned ) ; <nl> - for ( banmap_t : : iterator it = setBanned . begin ( ) ; it ! = setBanned . end ( ) ; it + + ) <nl> - { <nl> - CSubNet subNet = ( * it ) . first ; <nl> - CBanEntry banEntry = ( * it ) . second ; <nl> + for ( const auto & it : setBanned ) { <nl> + CSubNet subNet = it . first ; <nl> + CBanEntry banEntry = it . second ; <nl> <nl> if ( subNet . Match ( ip ) & & GetTime ( ) < banEntry . nBanUntil ) { <nl> return true ; <nl> bool CConnman : : AttemptToEvictConnection ( ) <nl> { <nl> LOCK ( cs_vNodes ) ; <nl> <nl> - for ( CNode * node : vNodes ) { <nl> + for ( const CNode * node : vNodes ) { <nl> if ( node - > fWhitelisted ) <nl> continue ; <nl> if ( ! node - > fInbound ) <nl> bool CConnman : : AttemptToEvictConnection ( ) <nl> / / Disconnect from the network group with the most connections <nl> NodeId evicted = vEvictionCandidates . front ( ) . id ; <nl> LOCK ( cs_vNodes ) ; <nl> - for ( std : : vector < CNode * > : : const_iterator it ( vNodes . begin ( ) ) ; it ! = vNodes . end ( ) ; + + it ) { <nl> - if ( ( * it ) - > GetId ( ) = = evicted ) { <nl> - ( * it ) - > fDisconnect = true ; <nl> + for ( CNode * pnode : vNodes ) { <nl> + if ( pnode - > GetId ( ) = = evicted ) { <nl> + pnode - > fDisconnect = true ; <nl> return true ; <nl> } <nl> } <nl> void CConnman : : AcceptConnection ( const ListenSocket & hListenSocket ) { <nl> bool whitelisted = hListenSocket . whitelisted | | IsWhitelistedRange ( addr ) ; <nl> { <nl> LOCK ( cs_vNodes ) ; <nl> - for ( CNode * pnode : vNodes ) <nl> - if ( pnode - > fInbound ) <nl> - nInbound + + ; <nl> + for ( const CNode * pnode : vNodes ) { <nl> + if ( pnode - > fInbound ) nInbound + + ; <nl> + } <nl> } <nl> <nl> if ( hSocket = = INVALID_SOCKET ) <nl> std : : vector < AddedNodeInfo > CConnman : : GetAddedNodeInfo ( ) <nl> { <nl> LOCK ( cs_vAddedNodes ) ; <nl> ret . reserve ( vAddedNodes . size ( ) ) ; <nl> - for ( const std : : string & strAddNode : vAddedNodes ) <nl> - lAddresses . push_back ( strAddNode ) ; <nl> + std : : copy ( vAddedNodes . cbegin ( ) , vAddedNodes . cend ( ) , std : : back_inserter ( lAddresses ) ) ; <nl> } <nl> <nl> <nl> std : : vector < CAddress > CConnman : : GetAddresses ( ) <nl> bool CConnman : : AddNode ( const std : : string & strNode ) <nl> { <nl> LOCK ( cs_vAddedNodes ) ; <nl> - for ( std : : vector < std : : string > : : const_iterator it = vAddedNodes . begin ( ) ; it ! = vAddedNodes . end ( ) ; + + it ) { <nl> - if ( strNode = = * it ) <nl> - return false ; <nl> + for ( const std : : string & it : vAddedNodes ) { <nl> + if ( strNode = = it ) return false ; <nl> } <nl> <nl> vAddedNodes . push_back ( strNode ) ; <nl> size_t CConnman : : GetNodeCount ( NumConnections flags ) <nl> return vNodes . size ( ) ; <nl> <nl> int nNum = 0 ; <nl> - for ( std : : vector < CNode * > : : const_iterator it = vNodes . begin ( ) ; it ! = vNodes . end ( ) ; + + it ) <nl> - if ( flags & ( ( * it ) - > fInbound ? CONNECTIONS_IN : CONNECTIONS_OUT ) ) <nl> + for ( const auto & pnode : vNodes ) { <nl> + if ( flags & ( pnode - > fInbound ? CONNECTIONS_IN : CONNECTIONS_OUT ) ) { <nl> nNum + + ; <nl> + } <nl> + } <nl> <nl> return nNum ; <nl> } <nl> void CConnman : : GetNodeStats ( std : : vector < CNodeStats > & vstats ) <nl> vstats . clear ( ) ; <nl> LOCK ( cs_vNodes ) ; <nl> vstats . reserve ( vNodes . size ( ) ) ; <nl> - for ( std : : vector < CNode * > : : iterator it = vNodes . begin ( ) ; it ! = vNodes . end ( ) ; + + it ) { <nl> - CNode * pnode = * it ; <nl> + for ( CNode * pnode : vNodes ) { <nl> vstats . emplace_back ( ) ; <nl> pnode - > copyStats ( vstats . back ( ) ) ; <nl> } <nl> | range - based loops and const qualifications in net . cpp | bitcoin/bitcoin | 05cae8aefd160ed83206a6d0f15cc29fd8653755 | 2017-09-12T07:11:22Z |
mmm a / buildscripts / resmokeconfig / suites / aggregation_facet_unwind_passthrough . yml <nl> ppp b / buildscripts / resmokeconfig / suites / aggregation_facet_unwind_passthrough . yml <nl> executor : <nl> mongod_options : <nl> set_parameters : <nl> enableTestCommands : 1 <nl> + # This passthrough wraps entire query result sets in $ facet . Allow a larger - than - normal <nl> + # intermediate document size of 500MB in order to accommodate tests that have a large result <nl> + # set . <nl> + internalQueryFacetMaxOutputDocSizeBytes : 500000000 <nl> mmm a / jstests / aggregation / bugs / server5932 . js <nl> ppp b / jstests / aggregation / bugs / server5932 . js <nl> <nl> / * * <nl> * server - 5932 Cursor - based aggregation <nl> * <nl> - * This test will not work with causal consistency because an aggregate and its subsequent <nl> - * getMores act as one operation , which means that there are no guarantees that future cursor <nl> - * commands will read any writes which occur in between cursor commands . <nl> - * @ tags : [ does_not_support_causal_consistency ] <nl> + * @ tags : [ <nl> + * # This test will not work with causal consistency because an aggregate and its subsequent <nl> + * # getMores act as one operation , which means that there are no guarantees that future cursor <nl> + * # commands will read any writes which occur in between cursor commands . <nl> + * does_not_support_causal_consistency , <nl> + * # The result set produced by this test is large , so when wrapped in a $ facet , the maximum <nl> + * # intermediate document size would be exceeded . <nl> + * do_not_wrap_aggregations_in_facets , <nl> + * ] <nl> * / <nl> <nl> ( function ( ) { <nl> new file mode 100644 <nl> index 000000000000 . . 659f0b027392 <nl> mmm / dev / null <nl> ppp b / jstests / aggregation / sources / facet / facet_memory_consumption . js <nl> <nl> + / * * <nl> + * Test that the $ facet stage fails cleanly without consuming too much memory if the size of the <nl> + * facet ' s output document is large . <nl> + * <nl> + * This test was designed to reproduce SERVER - 40317 . <nl> + * <nl> + * Collections must be unsharded , since this test uses $ lookup and sharded $ lookup is not yet <nl> + * supported . <nl> + * @ tags : [ assumes_unsharded_collection ] <nl> + * / <nl> + ( function ( ) { <nl> + " use strict " ; <nl> + <nl> + const collName = " facet_memory_consumption " ; <nl> + const coll = db [ collName ] ; <nl> + const kFacetOutputTooLargeCode = 4031700 ; <nl> + coll . drop ( ) ; <nl> + <nl> + / / A document that is slightly less than 1MB . <nl> + const doc = { <nl> + str : " x " . repeat ( 1024 * 1024 - 100 ) <nl> + } ; <nl> + <nl> + / / Insert it into the collection twice . <nl> + assert . commandWorked ( coll . insert ( doc ) ) ; <nl> + assert . commandWorked ( coll . insert ( doc ) ) ; <nl> + <nl> + / / Creates a pipeline that chains Cartesian product pipelines to create a pipeline returning <nl> + / / 2 ^ exponent documents ( assuming that there 2 documents in the ' collName ' collection ) . <nl> + function cartesianProductPipeline ( exponent ) { <nl> + let productPipeline = [ ] ; <nl> + for ( let i = 0 ; i < exponent - 1 ; + + i ) { <nl> + productPipeline = productPipeline . concat ( [ <nl> + { $ lookup : { from : collName , pipeline : [ { $ match : { } } ] , as : " join " } } , <nl> + { $ unwind : " $ join " } , <nl> + { $ project : { str : 1 } } , <nl> + ] ) ; <nl> + } <nl> + return productPipeline ; <nl> + } <nl> + <nl> + ( function succeedsWhenWithinMemoryLimit ( ) { <nl> + / / This pipeline uses $ facet to return one document that is just slightly less than the 16MB , <nl> + / / which is within the document size limit . <nl> + const result = coll . aggregate ( [ { $ facet : { product : cartesianProductPipeline ( 4 ) } } ] ) . toArray ( ) ; <nl> + const resultSize = Object . bsonsize ( result ) ; <nl> + <nl> + / / As a sanity check , make sure that the resulting document is somewhere around 16MB in size . <nl> + assert . gt ( resultSize , 15 * 1024 * 1024 , result ) ; <nl> + assert . lt ( resultSize , 16 * 1024 * 1024 , result ) ; <nl> + } ( ) ) ; <nl> + <nl> + ( function failsWhenResultDocumentExeedsMaxBSONSize ( ) { <nl> + / / This pipeline uses $ facet to create a document that is larger than the 16MB max document <nl> + / / size . <nl> + const result = assert . throws ( <nl> + ( ) = > coll . aggregate ( [ { $ facet : { product : cartesianProductPipeline ( 6 ) } } ] ) . toArray ( ) ) ; <nl> + assert . eq ( result . code , ErrorCodes . BSONObjectTooLarge ) ; <nl> + } ( ) ) ; <nl> + <nl> + ( function succeedsWhenIntermediateDocumentExceedsMaxBSONSizeWithUnwind ( ) { <nl> + / / This pipeline uses $ facet to create an intermediate document that is larger than the 16MB <nl> + / / max document size but smaller than the 100MB allowed for an intermediate document . The <nl> + / / $ unwind stage breaks the large document into a bunch of small documents , which is legal . <nl> + const result = <nl> + coll . aggregate ( [ { $ facet : { product : cartesianProductPipeline ( 6 ) } } , { $ unwind : " $ product " } ] ) <nl> + . toArray ( ) ; <nl> + assert . eq ( 64 , result . length , result ) ; <nl> + } ( ) ) ; <nl> + <nl> + ( function failsWhenFacetOutputDocumentTooLarge ( ) { <nl> + / / This pipeline uses $ facet to create a document that is larger than the 100MB maximum size for <nl> + / / an intermediate document . Even with the $ unwind stage , the pipeline should fail , this time <nl> + / / with error code 31034 . <nl> + const result = assert . throws ( <nl> + ( ) = > coll . aggregate ( <nl> + [ { $ facet : { product : cartesianProductPipeline ( 10 ) } } , { $ unwind : " $ product " } ] ) <nl> + . toArray ( ) ) ; <nl> + assert . eq ( result . code , kFacetOutputTooLargeCode ) ; <nl> + } ( ) ) ; <nl> + } ( ) ) ; <nl> mmm a / src / mongo / db / pipeline / document_source_facet . cpp <nl> ppp b / src / mongo / db / pipeline / document_source_facet . cpp <nl> using std : : string ; <nl> using std : : vector ; <nl> <nl> DocumentSourceFacet : : DocumentSourceFacet ( std : : vector < FacetPipeline > facetPipelines , <nl> - const intrusive_ptr < ExpressionContext > & expCtx ) <nl> + const intrusive_ptr < ExpressionContext > & expCtx , <nl> + size_t bufferSizeBytes , <nl> + size_t maxOutputDocBytes ) <nl> : DocumentSource ( kStageName , expCtx ) , <nl> - _teeBuffer ( TeeBuffer : : create ( facetPipelines . size ( ) ) ) , <nl> - _facets ( std : : move ( facetPipelines ) ) { <nl> + _teeBuffer ( TeeBuffer : : create ( facetPipelines . size ( ) , bufferSizeBytes ) ) , <nl> + _facets ( std : : move ( facetPipelines ) ) , <nl> + _maxOutputDocSizeBytes ( maxOutputDocBytes ) { <nl> for ( size_t facetId = 0 ; facetId < _facets . size ( ) ; + + facetId ) { <nl> auto & facet = _facets [ facetId ] ; <nl> facet . pipeline - > addInitialSource ( <nl> REGISTER_DOCUMENT_SOURCE ( facet , <nl> DocumentSourceFacet : : createFromBson ) ; <nl> <nl> intrusive_ptr < DocumentSourceFacet > DocumentSourceFacet : : create ( <nl> - std : : vector < FacetPipeline > facetPipelines , const intrusive_ptr < ExpressionContext > & expCtx ) { <nl> - return new DocumentSourceFacet ( std : : move ( facetPipelines ) , expCtx ) ; <nl> + std : : vector < FacetPipeline > facetPipelines , <nl> + const intrusive_ptr < ExpressionContext > & expCtx , <nl> + size_t bufferSizeBytes , <nl> + size_t maxOutputDocBytes ) { <nl> + return new DocumentSourceFacet ( <nl> + std : : move ( facetPipelines ) , expCtx , bufferSizeBytes , maxOutputDocBytes ) ; <nl> } <nl> <nl> void DocumentSourceFacet : : setSource ( DocumentSource * source ) { <nl> DocumentSource : : GetNextResult DocumentSourceFacet : : doGetNext ( ) { <nl> return GetNextResult : : makeEOF ( ) ; <nl> } <nl> <nl> + const size_t maxBytes = _maxOutputDocSizeBytes ; <nl> + auto ensureUnderMemoryLimit = [ usedBytes = 0ul , & maxBytes ] ( long long additional ) mutable { <nl> + usedBytes + = additional ; <nl> + uassert ( 4031700 , <nl> + str : : stream ( ) < < " document constructed by $ facet is " < < usedBytes <nl> + < < " bytes , which exceeds the limit of " < < maxBytes < < " bytes " , <nl> + usedBytes < = maxBytes ) ; <nl> + } ; <nl> + <nl> vector < vector < Value > > results ( _facets . size ( ) ) ; <nl> bool allPipelinesEOF = false ; <nl> while ( ! allPipelinesEOF ) { <nl> DocumentSource : : GetNextResult DocumentSourceFacet : : doGetNext ( ) { <nl> const auto & pipeline = _facets [ facetId ] . pipeline ; <nl> auto next = pipeline - > getSources ( ) . back ( ) - > getNext ( ) ; <nl> for ( ; next . isAdvanced ( ) ; next = pipeline - > getSources ( ) . back ( ) - > getNext ( ) ) { <nl> + ensureUnderMemoryLimit ( next . getDocument ( ) . getApproximateSize ( ) ) ; <nl> results [ facetId ] . emplace_back ( next . releaseDocument ( ) ) ; <nl> } <nl> allPipelinesEOF = allPipelinesEOF & & next . isEOF ( ) ; <nl> intrusive_ptr < DocumentSource > DocumentSourceFacet : : createFromBson ( <nl> facetPipelines . emplace_back ( facetName , std : : move ( pipeline ) ) ; <nl> } <nl> <nl> - return new DocumentSourceFacet ( std : : move ( facetPipelines ) , expCtx ) ; <nl> + return DocumentSourceFacet : : create ( std : : move ( facetPipelines ) , expCtx ) ; <nl> } <nl> } / / namespace mongo <nl> mmm a / src / mongo / db / pipeline / document_source_facet . h <nl> ppp b / src / mongo / db / pipeline / document_source_facet . h <nl> class DocumentSourceFacet final : public DocumentSource { <nl> <nl> static boost : : intrusive_ptr < DocumentSourceFacet > create ( <nl> std : : vector < FacetPipeline > facetPipelines , <nl> - const boost : : intrusive_ptr < ExpressionContext > & expCtx ) ; <nl> + const boost : : intrusive_ptr < ExpressionContext > & expCtx , <nl> + size_t bufferSizeBytes = internalQueryFacetBufferSizeBytes . load ( ) , <nl> + size_t maxOutputDocBytes = internalQueryFacetMaxOutputDocSizeBytes . load ( ) ) ; <nl> <nl> / * * <nl> * Optimizes inner pipelines . <nl> class DocumentSourceFacet final : public DocumentSource { <nl> <nl> private : <nl> DocumentSourceFacet ( std : : vector < FacetPipeline > facetPipelines , <nl> - const boost : : intrusive_ptr < ExpressionContext > & expCtx ) ; <nl> + const boost : : intrusive_ptr < ExpressionContext > & expCtx , <nl> + size_t bufferSizeBytes , <nl> + size_t maxOutputDocBytes ) ; <nl> <nl> Value serialize ( boost : : optional < ExplainOptions : : Verbosity > explain = boost : : none ) const final ; <nl> <nl> boost : : intrusive_ptr < TeeBuffer > _teeBuffer ; <nl> std : : vector < FacetPipeline > _facets ; <nl> <nl> + const size_t _maxOutputDocSizeBytes ; <nl> + <nl> bool _done = false ; <nl> } ; <nl> } / / namespace mongo <nl> mmm a / src / mongo / db / query / query_knobs . idl <nl> ppp b / src / mongo / db / query / query_knobs . idl <nl> server_parameters : <nl> validator : <nl> gt : 0 <nl> <nl> + internalQueryFacetMaxOutputDocSizeBytes : <nl> + description : " The number of bytes to buffer at once during a $ facet stage . " <nl> + set_at : [ startup , runtime ] <nl> + cpp_varname : " internalQueryFacetMaxOutputDocSizeBytes " <nl> + cpp_vartype : AtomicWord < long long > <nl> + default : <nl> + expr : 100 * 1024 * 1024 <nl> + validator : <nl> + gt : 0 <nl> + <nl> internalLookupStageIntermediateDocumentMaxSizeBytes : <nl> description : " Maximum size of the result set that we cache from the foreign collection during a $ lookup . " <nl> set_at : [ startup , runtime ] <nl> | SERVER - 40317 Fail query when $ facet intermediate output exceeds 100MB | mongodb/mongo | e0bbfe119331514119c6f573eac9998ccf2a3dbe | 2020-08-14T16:29:30Z |
mmm a / addons / skin . estuary / language / resource . language . en_gb / strings . po <nl> ppp b / addons / skin . estuary / language / resource . language . en_gb / strings . po <nl> msgctxt " # 31134 " <nl> msgid " Remaining " <nl> msgstr " " <nl> <nl> - # empty string with id 31135 <nl> + # : / xml / DialogAddonInfo . xml <nl> + msgctxt " # 31135 " <nl> + msgid " Binary " <nl> + msgstr " " <nl> <nl> # : / xml / DialogAddonInfo . xml <nl> msgctxt " # 31136 " <nl> new file mode 100644 <nl> index 000000000000 . . 3c3f84f1bd10 <nl> Binary files / dev / null and b / addons / skin . estuary / media / icons / addonstatus / install - pinned . png differ <nl> Binary files a / addons / skin . estuary / media / icons / addonstatus / install . png and b / addons / skin . estuary / media / icons / addonstatus / install . png differ <nl> new file mode 100644 <nl> index 000000000000 . . 1b05c1599196 <nl> Binary files / dev / null and b / addons / skin . estuary / media / icons / addonstatus / manual - pinned . png differ <nl> new file mode 100644 <nl> index 000000000000 . . 14115dd10ec4 <nl> Binary files / dev / null and b / addons / skin . estuary / media / icons / addonstatus / manual . png differ <nl> new file mode 100644 <nl> index 000000000000 . . 0138c39c29f0 <nl> Binary files / dev / null and b / addons / skin . estuary / media / icons / addonstatus / official - pinned . png differ <nl> new file mode 100644 <nl> index 000000000000 . . f0a203356961 <nl> Binary files / dev / null and b / addons / skin . estuary / media / icons / addonstatus / official . png differ <nl> mmm a / addons / skin . estuary / xml / DialogAddonInfo . xml <nl> ppp b / addons / skin . estuary / xml / DialogAddonInfo . xml <nl> <nl> < control type = " button " id = " 5000 " > <nl> < left > 605 < / left > <nl> < top > 400 < / top > <nl> - < width > 1235 < / width > <nl> + < width > 755 < / width > <nl> < height > 435 < / height > <nl> < label > < / label > <nl> < texturenofocus border = " 21 " > dialogs / dialog - bg . png < / texturenofocus > <nl> <nl> < enable > ! String . IsEmpty ( ListItem . AddonNews ) < / enable > <nl> < / control > <nl> < control type = " textbox " > <nl> - < left > 670 < / left > <nl> + < left > 650 < / left > <nl> < top > 430 < / top > <nl> - < width > 1050 < / width > <nl> + < width > 665 < / width > <nl> < height > 375 < / height > <nl> < label > $ INFO [ ListItem . AddonSummary , [ B ] , [ / B ] [ CR ] ] $ INFO [ ListItem . AddonDescription ] [ CR ] $ VAR [ AddonNewsVar , [ I ] [ CR ] [ CR ] , [ / I ] ] < / label > <nl> < autoscroll delay = " 5000 " repeat = " 7500 " time = " 5000 " > true < / autoscroll > <nl> <nl> < param name = " posy " value = " 280 " / > <nl> < param name = " visible " value = " true " / > <nl> < / include > <nl> + < control type = " group " > <nl> + < control type = " image " > <nl> + < left > 1370 < / left > <nl> + < top > 420 < / top > <nl> + < width > 450 < / width > <nl> + < height > 396 < / height > <nl> + < aspectratio > scale < / aspectratio > <nl> + < texture colordiffuse = " AAFFFFFF " > colors / black . png < / texture > <nl> + < / control > <nl> + < control type = " group " > <nl> + < left > 1340 < / left > <nl> + < top > 430 < / top > <nl> + < control type = " list " > <nl> + < left > 42 < / left > <nl> + < top > 0 < / top > <nl> + < width > 446 < / width > <nl> + < height > 385 < / height > <nl> + < pagecontrol / > <nl> + < itemlayout height = " 75 " > <nl> + < control type = " label " > <nl> + < left > 10 < / left > <nl> + < top > 0 < / top > <nl> + < width > 410 < / width > <nl> + < height > 30 < / height > <nl> + < font > font27_narrow < / font > <nl> + < label > $ INFO [ ListItem . Label , [ COLOR button_focus ] , [ / COLOR ] ] < / label > <nl> + < / control > <nl> + < control type = " label " > <nl> + < left > 10 < / left > <nl> + < top > 30 < / top > <nl> + < width > 380 < / width > <nl> + < height > 30 < / height > <nl> + < font > font27_narrow < / font > <nl> + < label > $ INFO [ ListItem . Label2 ] < / label > <nl> + < / control > <nl> + < control type = " image " > <nl> + < right > 25 < / right > <nl> + < top > 35 < / top > <nl> + < width > 32 < / width > <nl> + < height > 32 < / height > <nl> + < texture > $ INFO [ ListItem . Icon ] < / texture > <nl> + < / control > <nl> + < / itemlayout > <nl> + < focusedlayout height = " 75 " > <nl> + < control type = " label " > <nl> + < left > 10 < / left > <nl> + < top > 0 < / top > <nl> + < width > 410 < / width > <nl> + < height > 30 < / height > <nl> + < font > font27_narrow < / font > <nl> + < label > $ INFO [ ListItem . Label , [ COLOR button_focus ] , [ / COLOR ] ] < / label > <nl> + < scroll > false < / scroll > <nl> + < / control > <nl> + < control type = " label " > <nl> + < left > 10 < / left > <nl> + < top > 30 < / top > <nl> + < width > 380 < / width > <nl> + < height > 30 < / height > <nl> + < font > font27_narrow < / font > <nl> + < label > $ INFO [ ListItem . Label2 ] < / label > <nl> + < scroll > false < / scroll > <nl> + < / control > <nl> + < control type = " image " > <nl> + < right > 25 < / right > <nl> + < top > 35 < / top > <nl> + < width > 32 < / width > <nl> + < height > 32 < / height > <nl> + < texture > $ INFO [ ListItem . Icon ] < / texture > <nl> + < / control > <nl> + < / focusedlayout > <nl> + < content > <nl> + < item > <nl> + < label > $ LOCALIZE [ 21866 ] : < / label > <nl> + < label2 > $ INFO [ ListItem . AddonType ] < / label2 > <nl> + < visible > ! String . IsEmpty ( ListItem . AddonType ) < / visible > <nl> + < / item > <nl> + < item > <nl> + < label > $ LOCALIZE [ 31150 ] : < / label > <nl> + < label2 > $ INFO [ ListItem . AddonOrigin ] < / label2 > <nl> + < icon > $ VAR [ AddonsOriginVar ] < / icon > <nl> + < visible > ! String . IsEmpty ( ListItem . AddonOrigin ) < / visible > <nl> + < / item > <nl> + < item > <nl> + < label > $ LOCALIZE [ 22031 ] : < / label > <nl> + < label2 > $ INFO [ ListItem . AddonSize ] < / label2 > <nl> + < visible > ! String . IsEmpty ( ListItem . AddonSize ) < / visible > <nl> + < / item > <nl> + < item > <nl> + < label > $ LOCALIZE [ 126 ] : < / label > <nl> + < label2 > $ INFO [ ListItem . Property ( Addon . Status ) ] < / label2 > <nl> + < visible > ! String . IsEmpty ( ListItem . Property ( Addon . Status ) ) < / visible > <nl> + < / item > <nl> + < item > <nl> + < label > $ LOCALIZE [ 467 ] : < / label > <nl> + < label2 > $ LOCALIZE [ 31135 ] < / label2 > <nl> + < visible > ListItem . Property ( Addon . IsBinary ) < / visible > <nl> + < / item > <nl> + < / content > <nl> + < / control > <nl> + < / control > <nl> + < / control > <nl> < control type = " grouplist " id = " 9000 " > <nl> < left > 90 < / left > <nl> < top > 840 < / top > <nl> <nl> < font > font36_title < / font > <nl> < / control > <nl> < / control > <nl> - < control type = " image " > <nl> - < left > - 5 < / left > <nl> - < top > 525 < / top > <nl> - < width > 540 < / width > <nl> - < height > 150 < / height > <nl> - < texture > dialogs / dialog - bg - nobo . png < / texture > <nl> - < bordertexture border = " 21 " > overlays / shadow . png < / bordertexture > <nl> - < bordersize > 20 < / bordersize > <nl> - < / control > <nl> - < control type = " grouplist " > <nl> - < left > 30 < / left > <nl> - < top > 555 < / top > <nl> - < control type = " label " > <nl> - < width > 470 < / width > <nl> - < height > 40 < / height > <nl> - < label > $ INFO [ ListItem . AddonOrigin , [ COLOR button_focus ] $ LOCALIZE [ 31150 ] : [ / COLOR ] ] < / label > <nl> - < visible > ! String . IsEmpty ( ListItem . AddonOrigin ) < / visible > <nl> - < / control > <nl> - < control type = " label " > <nl> - < width > 470 < / width > <nl> - < height > 40 < / height > <nl> - < label > $ INFO [ ListItem . AddonSize , [ COLOR button_focus ] $ LOCALIZE [ 22031 ] : [ / COLOR ] , [ CR ] ] < / label > <nl> - < visible > ! String . IsEmpty ( ListItem . AddonSize ) < / visible > <nl> - < / control > <nl> - < / control > <nl> < / control > <nl> < control type = " textbox " > <nl> < left > 150 < / left > <nl> mmm a / addons / skin . estuary / xml / Variables . xml <nl> ppp b / addons / skin . estuary / xml / Variables . xml <nl> <nl> < value condition = " ListItem . Property ( addon . isenabled ) + String . IsEqual ( ListItem . AddonLifecycleType , $ LOCALIZE [ 24171 ] ) " > icons / addonstatus / enabled - broken . png < / value > <nl> < value condition = " ! ListItem . IsParentFolder " > OverlayUnwatched . png < / value > <nl> < / variable > <nl> + < variable name = " AddonsOriginVar " > <nl> + < value condition = " ListItem . Property ( Addon . IsFromOfficialRepo ) + ListItem . IsAutoUpdateable " > icons / addonstatus / official . png < / value > <nl> + < value condition = " ListItem . Property ( Addon . IsFromOfficialRepo ) " > icons / addonstatus / official - pinned . png < / value > <nl> + < value condition = " String . IsEqual ( ListItem . AddonOrigin , $ LOCALIZE [ 25014 ] ) + ListItem . IsAutoUpdateable " > icons / addonstatus / manual . png < / value > <nl> + < value condition = " String . IsEqual ( ListItem . AddonOrigin , $ LOCALIZE [ 25014 ] ) " > icons / addonstatus / manual - pinned . png < / value > <nl> + < value condition = " ListItem . IsAutoUpdateable " > icons / addonstatus / install . png < / value > <nl> + < value > icons / addonstatus / install - pinned . png < / value > <nl> + < / variable > <nl> < variable name = " ResolutionFlagVar " > <nl> < value condition = " ListItem . IsStereoscopic " > flags / videoresolution / 3D . png < / value > <nl> < value > $ INFO [ ListItem . VideoResolution , flags / videoresolution / , . png ] < / value > <nl> mmm a / addons / skin . estuary / xml / View_55_WideList . xml <nl> ppp b / addons / skin . estuary / xml / View_55_WideList . xml <nl> <nl> < control type = " label " > <nl> < left > 75 < / left > <nl> < height > 80 < / height > <nl> - < right > 40 < / right > <nl> + < right > 90 < / right > <nl> < align > right < / align > <nl> < aligny > center < / aligny > <nl> < font > font27 < / font > <nl> < label > $ VAR [ AddonsLabel2Var ] < / label > <nl> < / control > <nl> + < control type = " image " > <nl> + < right > 40 < / right > <nl> + < top > 25 < / top > <nl> + < width > 32 < / width > <nl> + < height > 32 < / height > <nl> + < texture > $ VAR [ AddonsOriginVar ] < / texture > <nl> + < visible > ! ListItem . IsFolder < / visible > <nl> + < / control > <nl> < / focusedlayout > <nl> < itemlayout height = " 80 " condition = " Container . Content ( addons ) " > <nl> < control type = " image " > <nl> <nl> < control type = " label " > <nl> < left > 75 < / left > <nl> < height > 80 < / height > <nl> - < right > 40 < / right > <nl> + < right > 90 < / right > <nl> < align > right < / align > <nl> < aligny > center < / aligny > <nl> < font > font27 < / font > <nl> <nl> < textcolor > grey < / textcolor > <nl> < shadowcolor > text_shadow < / shadowcolor > <nl> < / control > <nl> + < control type = " image " > <nl> + < right > 40 < / right > <nl> + < top > 25 < / top > <nl> + < width > 32 < / width > <nl> + < height > 32 < / height > <nl> + < texture > $ VAR [ AddonsOriginVar ] < / texture > <nl> + < visible > ! ListItem . IsFolder < / visible > <nl> + < / control > <nl> < / itemlayout > <nl> < / include > <nl> < / includes > <nl> | [ Estuary ] display origin in addonbrowser and addoninfo | xbmc/xbmc | 4827f4c5552b19c5b7d8517eb4e8107fbdccd315 | 2020-09-16T14:29:30Z |
mmm a / Telegram / lib_ui <nl> ppp b / Telegram / lib_ui <nl> @ @ - 1 + 1 @ @ <nl> - Subproject commit 124b9880d4c56c019da6bc679de9919cf6779780 <nl> + Subproject commit 8e568a4f15e2642c15ac56a69360e15464b38af2 <nl> | Version 2 . 1 . 1 : Remove font substitutions on Win . | telegramdesktop/tdesktop | 3c1c17ef80043fead409237c9c902d89110b3356 | 2020-05-01T15:59:54Z |
mmm a / README . md <nl> ppp b / README . md <nl> LeetCode <nl> | 65 | [ Add Binary ] ( https : / / oj . leetcode . com / problems / add - binary / ) | [ C + + ] ( . / algorithms / addBinary / addBinary . cpp ) | Easy | <nl> | 64 | [ Merge Two Sorted Lists ] ( https : / / oj . leetcode . com / problems / merge - two - sorted - lists / ) | [ C + + ] ( . / algorithms / mergeTwoSortedList / mergeTwoSortedList . cpp ) | Easy | <nl> | 63 | [ Minimum Path Sum ] ( https : / / oj . leetcode . com / problems / minimum - path - sum / ) | [ C + + ] ( . / algorithms / minimumPathSum / minimumPathSum . cpp ) | Medium | <nl> - | 62 | [ Unique Paths II ] ( https : / / oj . leetcode . com / problems / unique - paths - ii / ) | [ C + + ] ( . / algorithms / uniquePaths / uniquePaths . II . cpp ) | Medium | <nl> + | 62 | [ Unique Paths II ] ( https : / / oj . leetcode . com / problems / unique - paths - ii / ) | [ C + + ] ( . / algorithms / uniquePaths / uniquePaths . II . cpp ) , [ Java ] ( . / algorithms - java / src / dynamicProgramming / uniquePaths / uniquePathsII . java ) | Medium | <nl> | 61 | [ Unique Paths ] ( https : / / oj . leetcode . com / problems / unique - paths / ) | [ C + + ] ( . / algorithms / uniquePaths / uniquePaths . cpp ) , [ Java ] ( . / algorithms - java / src / dynamicProgramming / uniquePaths / uniquePaths . java ) | Medium | <nl> | 60 | [ Rotate List ] ( https : / / oj . leetcode . com / problems / rotate - list / ) | [ C + + ] ( . / algorithms / rotateList / rotateList . cpp ) | Medium | <nl> | 59 | [ Permutation Sequence ] ( https : / / oj . leetcode . com / problems / permutation - sequence / ) | [ C + + ] ( . / algorithms / permutationSequence / permutationSequence . cpp ) | Medium | <nl> LeetCode <nl> | # | Title | Solution | Difficulty | <nl> | mmm | mmm - - | mmmmmm - - | mmmmmmmmm - | <nl> | 1 | [ Search in a big sorted array ] ( http : / / www . lintcode . com / en / problem / search - in - a - big - sorted - array / ) | [ Java ] ( . / algorithms - java / src / searchInABigSortedArray / searchInABigSortedArray . java ) | Medium | <nl> - [ 2 ] [ Search Range in Binary Search Tree ] ( http : / / www . lintcode . com / en / problem / search - range - in - binary - search - tree / ) | [ Java ] ( . / algorithms - java / src / searchRangeInBinarySearchTree / searchRangeInBinarySearchTree . java ) | Medium | <nl> + | 2 | [ Search Range in Binary Search Tree ] ( http : / / www . lintcode . com / en / problem / search - range - in - binary - search - tree / ) | [ Java ] ( . / algorithms - java / src / searchRangeInBinarySearchTree / searchRangeInBinarySearchTree . java ) | Medium | <nl> new file mode 100644 <nl> index 00000000 . . 32e1765f <nl> mmm / dev / null <nl> ppp b / algorithms - java / src / dynamicProgramming / uniquePaths / uniquePathsII . java <nl> <nl> + / / Source : https : / / oj . leetcode . com / problems / unique - paths - ii / <nl> + / / Inspired by : http : / / www . jiuzhang . com / solutions / unique - paths / <nl> + / / Author : Lei Cao <nl> + / / Date : 2015 - 10 - 11 <nl> + <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + * <nl> + * Follow up for " Unique Paths " : <nl> + * <nl> + * Now consider if some obstacles are added to the grids . How many unique paths would there be ? <nl> + * <nl> + * An obstacle and empty space is marked as 1 and 0 respectively in the grid . <nl> + * <nl> + * For example , <nl> + * There is one obstacle in the middle of a 3x3 grid as illustrated below . <nl> + * <nl> + * [ <nl> + * [ 0 , 0 , 0 ] , <nl> + * [ 0 , 1 , 0 ] , <nl> + * [ 0 , 0 , 0 ] <nl> + * ] <nl> + * <nl> + * The total number of unique paths is 2 . <nl> + * <nl> + * Note : m and n will be at most 100 . <nl> + * <nl> + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + package dynamicProgramming . uniquePaths ; <nl> + <nl> + public class uniquePathsII { <nl> + / * * <nl> + * @ param obstacleGrid : A list of lists of integers <nl> + * @ return : An integer <nl> + * / <nl> + public int uniquePathsWithObstacles ( int [ ] [ ] obstacleGrid ) { <nl> + if ( obstacleGrid . length = = 0 | | obstacleGrid [ 0 ] . length = = 0 ) { <nl> + return 0 ; <nl> + } <nl> + if ( obstacleGrid [ 0 ] [ 0 ] = = 1 ) { <nl> + return 0 ; <nl> + } <nl> + int m = obstacleGrid . length ; <nl> + int n = obstacleGrid [ 0 ] . length ; <nl> + / / write your code here <nl> + int [ ] [ ] matrix = new int [ m ] [ n ] ; <nl> + for ( int i = 0 ; i < m ; i + + ) { <nl> + if ( obstacleGrid [ i ] [ 0 ] ! = 1 ) { <nl> + matrix [ i ] [ 0 ] = 1 ; <nl> + } else { <nl> + break ; <nl> + } <nl> + } <nl> + for ( int i = 0 ; i < n ; i + + ) { <nl> + if ( obstacleGrid [ 0 ] [ i ] ! = 1 ) { <nl> + matrix [ 0 ] [ i ] = 1 ; <nl> + } else { <nl> + break ; <nl> + } <nl> + } <nl> + <nl> + for ( int i = 1 ; i < m ; i + + ) { <nl> + for ( int j = 1 ; j < n ; j + + ) { <nl> + if ( obstacleGrid [ i ] [ j ] = = 1 ) { <nl> + matrix [ i ] [ j ] = 0 ; <nl> + } else { <nl> + matrix [ i ] [ j ] = matrix [ i - 1 ] [ j ] + matrix [ i ] [ j - 1 ] ; <nl> + } <nl> + } <nl> + } <nl> + return matrix [ m - 1 ] [ n - 1 ] ; <nl> + } <nl> + } <nl> new file mode 100644 <nl> index 00000000 . . 2510de23 <nl> mmm / dev / null <nl> ppp b / algorithms - java / src / dynamicProgramming / uniquePaths / uniquePathsIITest . java <nl> <nl> + package dynamicProgramming . uniquePaths ; <nl> + <nl> + import org . junit . Test ; <nl> + <nl> + import static org . junit . Assert . * ; <nl> + <nl> + / * * <nl> + * Created by leicao on 11 / 10 / 15 . <nl> + * / <nl> + public class uniquePathsIITest { <nl> + <nl> + @ Test <nl> + public void testUniquePathsWithObstacles ( ) throws Exception { <nl> + int [ ] [ ] [ ] inputs = { <nl> + { <nl> + { 0 , 0 , 0 } , <nl> + { 0 , 1 , 0 } , <nl> + { 0 , 0 , 0 } , <nl> + } <nl> + } ; <nl> + int [ ] results = { 2 } ; <nl> + for ( int i = 0 ; i < inputs . length ; i + + ) { <nl> + uniquePathsII u = new uniquePathsII ( ) ; <nl> + int r = u . uniquePathsWithObstacles ( inputs [ i ] ) ; <nl> + System . out . println ( r ) ; <nl> + assertEquals ( results [ i ] , r ) ; <nl> + } <nl> + } <nl> + } <nl> \ No newline at end of file <nl> | 62 unique path II | haoel/leetcode | 1db9f9a777c2968ff6d2b7a96ede4236e8c39e51 | 2015-10-11T14:03:50Z |
mmm a / cocos / 3d / CCTerrain . cpp <nl> ppp b / cocos / 3d / CCTerrain . cpp <nl> USING_NS_CC ; <nl> <nl> NS_CC_BEGIN <nl> <nl> - / / check a number is power of two . <nl> - static bool isPOT ( int number ) <nl> - { <nl> - bool flag = false ; <nl> - if ( ( number > 0 ) & & ( number & ( number - 1 ) ) = = 0 ) <nl> - flag = true ; <nl> - return flag ; <nl> + namespace { <nl> + / / It ' s used for creating a default texture when lightMap is nullpter <nl> + static unsigned char cc_2x2_white_image [ ] = { <nl> + / / RGBA8888 <nl> + 0xFF , 0xFF , 0xFF , 0xFF , <nl> + 0xFF , 0xFF , 0xFF , 0xFF , <nl> + 0xFF , 0xFF , 0xFF , 0xFF , <nl> + 0xFF , 0xFF , 0xFF , 0xFF <nl> + } ; <nl> + <nl> + / / check a number is power of two . <nl> + static bool isPOT ( int number ) <nl> + { <nl> + bool flag = false ; <nl> + if ( ( number > 0 ) & & ( number & ( number - 1 ) ) = = 0 ) <nl> + flag = true ; <nl> + return flag ; <nl> + } <nl> } <nl> <nl> Terrain * Terrain : : create ( TerrainData & parameter , CrackFixedType fixedType ) <nl> void Terrain : : draw ( cocos2d : : Renderer * renderer , const cocos2d : : Mat4 & transform , <nl> { <nl> int hasLightMap = 0 ; <nl> _programState - > setUniform ( _lightMapCheckLocation , & hasLightMap , sizeof ( hasLightMap ) ) ; <nl> + # ifdef CC_USE_METAL <nl> + _programState - > setTexture ( _lightMapLocation , 5 , _dummyTexture - > getBackendTexture ( ) ) ; <nl> + # endif <nl> } <nl> auto camera = Camera : : getVisitingCamera ( ) ; <nl> <nl> Terrain : : Terrain ( ) <nl> ) ; <nl> Director : : getInstance ( ) - > getEventDispatcher ( ) - > addEventListenerWithFixedPriority ( _backToForegroundListener , 1 ) ; <nl> # endif <nl> + # ifdef CC_USE_METAL <nl> + auto image = new ( std : : nothrow ) Image ( ) ; <nl> + bool CC_UNUSED isOK = image - > initWithRawData ( cc_2x2_white_image , sizeof ( cc_2x2_white_image ) , 2 , 2 , 8 ) ; <nl> + CCASSERT ( isOK , " The 2x2 empty texture was created unsuccessfully . " ) ; <nl> + _dummyTexture = new ( std : : nothrow ) Texture2D ( ) ; <nl> + _dummyTexture - > initWithImage ( image ) ; <nl> + CC_SAFE_RELEASE ( image ) ; <nl> + # endif <nl> } <nl> <nl> void Terrain : : setChunksLOD ( const Vec3 & cameraPos ) <nl> Terrain : : ~ Terrain ( ) <nl> CC_SAFE_RELEASE ( _alphaMap ) ; <nl> CC_SAFE_RELEASE ( _lightMap ) ; <nl> CC_SAFE_RELEASE ( _heightMapImage ) ; <nl> + CC_SAFE_RELEASE ( _dummyTexture ) ; <nl> CC_SAFE_RELEASE_NULL ( _programState ) ; <nl> delete _quadRoot ; <nl> for ( int i = 0 ; i < 4 ; + + i ) <nl> mmm a / cocos / 3d / CCTerrain . h <nl> ppp b / cocos / 3d / CCTerrain . h <nl> class CC_DLL Terrain : public Node <nl> Texture2D * _detailMapTextures [ 4 ] ; <nl> Texture2D * _alphaMap ; <nl> Texture2D * _lightMap ; <nl> + Texture2D * _dummyTexture = nullptr ; <nl> Vec3 _lightDir ; <nl> QuadTree * _quadRoot ; <nl> Chunk * _chunkesArray [ MAX_CHUNKES ] [ MAX_CHUNKES ] ; <nl> | [ Feature ] add dummy texture for metal when lightMap is nullptr | cocos2d/cocos2d-x | df3637538abe4f981da80a36fb81e24a9c114fab | 2019-03-13T08:05:02Z |
mmm a / hphp / test / tools / import_zend_test . py <nl> ppp b / hphp / test / tools / import_zend_test . py <nl> <nl> ' / ext / standard / versioning / php_sapi_name_variation001 . phpt ' , <nl> ) <nl> <nl> - # For marking tests as always failing . Used to keep flaky tests in bad / . <nl> - bad_tests = ( <nl> + # For marking tests as always failing . Used to keep flaky tests in flaky / . <nl> + flaky_tests = ( <nl> # line number is inconsistent on stack overflow <nl> ' / Zend / tests / bug41633_3 . php ' , <nl> <nl> def matches ( patterns ) : <nl> filename = test [ ' name ' ] <nl> good_file = filename . replace ( ' all ' , ' good ' , 1 ) <nl> bad_file = filename . replace ( ' all ' , ' bad ' , 1 ) <nl> + flaky_file = filename . replace ( ' all ' , ' flaky ' , 1 ) <nl> mkdir_p ( os . path . dirname ( good_file ) ) <nl> mkdir_p ( os . path . dirname ( bad_file ) ) <nl> + mkdir_p ( os . path . dirname ( flaky_file ) ) <nl> <nl> good = ( test [ ' status ' ] = = ' passed ' ) <nl> - for test in bad_tests : <nl> + flaky_test = False <nl> + for test in flaky_tests : <nl> if test in filename : <nl> good = False <nl> + flaky_test = True <nl> <nl> needs_norepo = False <nl> if good : <nl> def matches ( patterns ) : <nl> for test in norepo_tests : <nl> if test in filename : <nl> needs_norepo = True <nl> - else : <nl> + elif not flaky_test : <nl> dest_file = bad_file <nl> delete_file = good_file <nl> subpath = ' bad ' <nl> + else : <nl> + delete_file = bad_file <nl> + dest_file = flaky_file <nl> + subpath = ' flaky ' <nl> <nl> exps = glob . glob ( filename + ' . expect * ' ) <nl> if not exps : <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / Zend / tests / bug41633_3 . php <nl> rename to hphp / test / zend / flaky / Zend / tests / bug41633_3 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / Zend / tests / bug41633_3 . php . expectf <nl> rename to hphp / test / zend / flaky / Zend / tests / bug41633_3 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / date / tests / DateTimeZone_listAbbreviations_basic1 . php <nl> rename to hphp / test / zend / flaky / ext / date / tests / DateTimeZone_listAbbreviations_basic1 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / date / tests / DateTimeZone_listAbbreviations_basic1 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / date / tests / DateTimeZone_listAbbreviations_basic1 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / date / tests / bug52290 . php <nl> rename to hphp / test / zend / flaky / ext / date / tests / bug52290 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / date / tests / bug52290 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / date / tests / bug52290 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / date / tests / timezone_abbreviations_list_basic1 . php <nl> rename to hphp / test / zend / flaky / ext / date / tests / timezone_abbreviations_list_basic1 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / date / tests / timezone_abbreviations_list_basic1 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / date / tests / timezone_abbreviations_list_basic1 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / ftp / tests / bug39458 . php <nl> rename to hphp / test / zend / flaky / ext / ftp / tests / bug39458 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / ftp / tests / bug39458 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / ftp / tests / bug39458 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / ftp / tests / bug39458 . php . skipif <nl> rename to hphp / test / zend / flaky / ext / ftp / tests / bug39458 . php . skipif <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / ftp / tests / ftp_alloc_basic1 . php <nl> rename to hphp / test / zend / flaky / ext / ftp / tests / ftp_alloc_basic1 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / ftp / tests / ftp_alloc_basic1 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / ftp / tests / ftp_alloc_basic1 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / ftp / tests / ftp_alloc_basic1 . php . skipif <nl> rename to hphp / test / zend / flaky / ext / ftp / tests / ftp_alloc_basic1 . php . skipif <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / ftp / tests / ftp_alloc_basic2 . php <nl> rename to hphp / test / zend / flaky / ext / ftp / tests / ftp_alloc_basic2 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / ftp / tests / ftp_alloc_basic2 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / ftp / tests / ftp_alloc_basic2 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / ftp / tests / ftp_alloc_basic2 . php . skipif <nl> rename to hphp / test / zend / flaky / ext / ftp / tests / ftp_alloc_basic2 . php . skipif <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / ftp / tests / ftp_nb_fget_basic1 . php <nl> rename to hphp / test / zend / flaky / ext / ftp / tests / ftp_nb_fget_basic1 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / ftp / tests / ftp_nb_fget_basic1 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / ftp / tests / ftp_nb_fget_basic1 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / ftp / tests / ftp_nb_fget_basic1 . php . skipif <nl> rename to hphp / test / zend / flaky / ext / ftp / tests / ftp_nb_fget_basic1 . php . skipif <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / phar / tests / 019 . php <nl> rename to hphp / test / zend / flaky / ext / phar / tests / 019 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / phar / tests / 019 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / phar / tests / 019 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / phar / tests / 019 . php . ini <nl> rename to hphp / test / zend / flaky / ext / phar / tests / 019 . php . ini <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / phar / tests / 019 . php . skipif <nl> rename to hphp / test / zend / flaky / ext / phar / tests / 019 . php . skipif <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / posix / tests / posix_getgrgid . php <nl> rename to hphp / test / zend / flaky / ext / posix / tests / posix_getgrgid . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / posix / tests / posix_getgrgid . php . expectf <nl> rename to hphp / test / zend / flaky / ext / posix / tests / posix_getgrgid . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / posix / tests / posix_getgrgid . php . skipif <nl> rename to hphp / test / zend / flaky / ext / posix / tests / posix_getgrgid . php . skipif <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / session / tests / 027 . php <nl> rename to hphp / test / zend / flaky / ext / session / tests / 027 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / session / tests / 027 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / session / tests / 027 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / session / tests / 027 . php . ini <nl> rename to hphp / test / zend / flaky / ext / session / tests / 027 . php . ini <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / session / tests / 027 . php . skipif <nl> rename to hphp / test / zend / flaky / ext / session / tests / 027 . php . skipif <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / sockets / tests / ipv4loop . php <nl> rename to hphp / test / zend / flaky / ext / sockets / tests / ipv4loop . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / sockets / tests / ipv4loop . php . expectf <nl> rename to hphp / test / zend / flaky / ext / sockets / tests / ipv4loop . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / sockets / tests / ipv4loop . php . skipif <nl> rename to hphp / test / zend / flaky / ext / sockets / tests / ipv4loop . php . skipif <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / sockets / tests / socket_getpeername_ipv6loop . php <nl> rename to hphp / test / zend / flaky / ext / sockets / tests / socket_getpeername_ipv6loop . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / sockets / tests / socket_getpeername_ipv6loop . php . expectf <nl> rename to hphp / test / zend / flaky / ext / sockets / tests / socket_getpeername_ipv6loop . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / sockets / tests / socket_getpeername_ipv6loop . php . skipif <nl> rename to hphp / test / zend / flaky / ext / sockets / tests / socket_getpeername_ipv6loop . php . skipif <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / spl / tests / RecursiveDirectoryIterator_getSubPathname_basic . php <nl> rename to hphp / test / zend / flaky / ext / spl / tests / RecursiveDirectoryIterator_getSubPathname_basic . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / spl / tests / RecursiveDirectoryIterator_getSubPathname_basic . php . expectf <nl> rename to hphp / test / zend / flaky / ext / spl / tests / RecursiveDirectoryIterator_getSubPathname_basic . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / spl / tests / SplFileObject_fgetcsv_delimiter_basic . php <nl> rename to hphp / test / zend / flaky / ext / spl / tests / SplFileObject_fgetcsv_delimiter_basic . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / spl / tests / SplFileObject_fgetcsv_delimiter_basic . php . expectf <nl> rename to hphp / test / zend / flaky / ext / spl / tests / SplFileObject_fgetcsv_delimiter_basic . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / spl / tests / SplFileObject_fgetcsv_enclosure_basic . php <nl> rename to hphp / test / zend / flaky / ext / spl / tests / SplFileObject_fgetcsv_enclosure_basic . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / spl / tests / SplFileObject_fgetcsv_enclosure_basic . php . expectf <nl> rename to hphp / test / zend / flaky / ext / spl / tests / SplFileObject_fgetcsv_enclosure_basic . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / spl / tests / SplFileObject_fgetcsv_escape_basic . php <nl> rename to hphp / test / zend / flaky / ext / spl / tests / SplFileObject_fgetcsv_escape_basic . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / spl / tests / SplFileObject_fgetcsv_escape_basic . php . expectf <nl> rename to hphp / test / zend / flaky / ext / spl / tests / SplFileObject_fgetcsv_escape_basic . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / spl / tests / SplFileObject_fgetcsv_escape_default . php <nl> rename to hphp / test / zend / flaky / ext / spl / tests / SplFileObject_fgetcsv_escape_default . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / spl / tests / SplFileObject_fgetcsv_escape_default . php . expectf <nl> rename to hphp / test / zend / flaky / ext / spl / tests / SplFileObject_fgetcsv_escape_default . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / spl / tests / SplFileObject_setCsvControl_error001 . php <nl> rename to hphp / test / zend / flaky / ext / spl / tests / SplFileObject_setCsvControl_error001 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / spl / tests / SplFileObject_setCsvControl_error001 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / spl / tests / SplFileObject_setCsvControl_error001 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / spl / tests / SplFileObject_setCsvControl_error002 . php <nl> rename to hphp / test / zend / flaky / ext / spl / tests / SplFileObject_setCsvControl_error002 . php <nl> new file mode 100644 <nl> index 00000000000 . . 8764706bbe3 <nl> mmm / dev / null <nl> ppp b / hphp / test / zend / flaky / ext / spl / tests / SplFileObject_setCsvControl_error002 . php . expectf <nl> <nl> + <nl> + Warning : % s <nl> \ No newline at end of file <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / spl / tests / SplFileObject_setCsvControl_error003 . php <nl> rename to hphp / test / zend / flaky / ext / spl / tests / SplFileObject_setCsvControl_error003 . php <nl> new file mode 100644 <nl> index 00000000000 . . 8764706bbe3 <nl> mmm / dev / null <nl> ppp b / hphp / test / zend / flaky / ext / spl / tests / SplFileObject_setCsvControl_error003 . php . expectf <nl> <nl> + <nl> + Warning : % s <nl> \ No newline at end of file <nl> new file mode 100644 <nl> index 00000000000 . . bd0c8f19ce1 <nl> mmm / dev / null <nl> ppp b / hphp / test / zend / flaky / ext / spl / tests / SplFileObject_setCsvControl_error003 . php . ini <nl> @ @ - 0 , 0 + 1 @ @ <nl> + include_path = . <nl> \ No newline at end of file <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / sqlite3 / tests / sqlite3_08_udf . php <nl> rename to hphp / test / zend / flaky / ext / sqlite3 / tests / sqlite3_08_udf . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / sqlite3 / tests / sqlite3_08_udf . php . expectf <nl> rename to hphp / test / zend / flaky / ext / sqlite3 / tests / sqlite3_08_udf . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / sqlite3 / tests / sqlite3_08_udf . php . skipif <nl> rename to hphp / test / zend / flaky / ext / sqlite3 / tests / sqlite3_08_udf . php . skipif <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / sqlite3 / tests / sqlite3_25_create_aggregate . php <nl> rename to hphp / test / zend / flaky / ext / sqlite3 / tests / sqlite3_25_create_aggregate . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / sqlite3 / tests / sqlite3_25_create_aggregate . php . expectf <nl> rename to hphp / test / zend / flaky / ext / sqlite3 / tests / sqlite3_25_create_aggregate . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / sqlite3 / tests / sqlite3_25_create_aggregate . php . skipif <nl> rename to hphp / test / zend / flaky / ext / sqlite3 / tests / sqlite3_25_create_aggregate . php . skipif <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / array / array_next_error2 . php <nl> rename to hphp / test / zend / flaky / ext / standard / tests / array / array_next_error2 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / array / array_next_error2 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / standard / tests / array / array_next_error2 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / array / prev_error3 . php <nl> rename to hphp / test / zend / flaky / ext / standard / tests / array / prev_error3 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / array / prev_error3 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / standard / tests / array / prev_error3 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / class_object / get_object_vars_variation_003 . php <nl> rename to hphp / test / zend / flaky / ext / standard / tests / class_object / get_object_vars_variation_003 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / class_object / get_object_vars_variation_003 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / standard / tests / class_object / get_object_vars_variation_003 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / bug38086 . php <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / bug38086 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / bug38086 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / bug38086 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / bug41655_2 . php <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / bug41655_2 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / bug41655_2 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / bug41655_2 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / bug41655_2 . php . ini <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / bug41655_2 . php . ini <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / disk_free_space_basic . php <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / disk_free_space_basic . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / disk_free_space_basic . php . expectf <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / disk_free_space_basic . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / disk_free_space_basic . php . ini <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / disk_free_space_basic . php . ini <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / disk_free_space_basic . php . skipif <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / disk_free_space_basic . php . skipif <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / fopen_variation12 . php <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / fopen_variation12 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / fopen_variation12 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / fopen_variation12 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / fread_socket_variation1 . php <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / fread_socket_variation1 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / fread_socket_variation1 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / fread_socket_variation1 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / lchgrp_basic . php <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / lchgrp_basic . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / lchgrp_basic . php . expectf <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / lchgrp_basic . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / lchgrp_basic . php . skipif <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / lchgrp_basic . php . skipif <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / mkdir - 001 . php <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / mkdir - 001 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / mkdir - 001 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / mkdir - 001 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / mkdir - 002 . php <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / mkdir - 002 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / mkdir - 002 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / mkdir - 002 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / mkdir - 002 . php . skipif <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / mkdir - 002 . php . skipif <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / mkdir - 003 . php <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / mkdir - 003 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / mkdir - 003 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / mkdir - 003 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / readlink_realpath_variation1 . php <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / readlink_realpath_variation1 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / readlink_realpath_variation1 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / readlink_realpath_variation1 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / readlink_realpath_variation1 . php . skipif <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / readlink_realpath_variation1 . php . skipif <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / rename_variation3 . php <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / rename_variation3 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / rename_variation3 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / rename_variation3 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / rename_variation3 . php . skipif <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / rename_variation3 . php . skipif <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / stream_copy_to_stream . php <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / stream_copy_to_stream . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / stream_copy_to_stream . php . expectf <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / stream_copy_to_stream . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / symlink_link_linkinfo_is_link_variation3 . php <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / symlink_link_linkinfo_is_link_variation3 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / symlink_link_linkinfo_is_link_variation3 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / symlink_link_linkinfo_is_link_variation3 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / symlink_link_linkinfo_is_link_variation3 . php . skipif <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / symlink_link_linkinfo_is_link_variation3 . php . skipif <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / symlink_link_linkinfo_is_link_variation9 . php <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / symlink_link_linkinfo_is_link_variation9 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / symlink_link_linkinfo_is_link_variation9 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / symlink_link_linkinfo_is_link_variation9 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / file / symlink_link_linkinfo_is_link_variation9 . php . skipif <nl> rename to hphp / test / zend / flaky / ext / standard / tests / file / symlink_link_linkinfo_is_link_variation9 . php . skipif <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / general_functions / proc_open02 . php <nl> rename to hphp / test / zend / flaky / ext / standard / tests / general_functions / proc_open02 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / general_functions / proc_open02 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / standard / tests / general_functions / proc_open02 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / general_functions / proc_open02 . php . skipif <nl> rename to hphp / test / zend / flaky / ext / standard / tests / general_functions / proc_open02 . php . skipif <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / network / fsockopen_variation1 . php <nl> rename to hphp / test / zend / flaky / ext / standard / tests / network / fsockopen_variation1 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / network / fsockopen_variation1 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / standard / tests / network / fsockopen_variation1 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / network / shutdown . php <nl> rename to hphp / test / zend / flaky / ext / standard / tests / network / shutdown . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / network / shutdown . php . expectf <nl> rename to hphp / test / zend / flaky / ext / standard / tests / network / shutdown . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / network / shutdown . php . skipif <nl> rename to hphp / test / zend / flaky / ext / standard / tests / network / shutdown . php . skipif <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / streams / bug61115 - 2 . php <nl> rename to hphp / test / zend / flaky / ext / standard / tests / streams / bug61115 - 2 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / streams / bug61115 - 2 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / standard / tests / streams / bug61115 - 2 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / streams / bug64770 . php <nl> rename to hphp / test / zend / flaky / ext / standard / tests / streams / bug64770 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / streams / bug64770 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / standard / tests / streams / bug64770 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / strings / explode_bug . php <nl> rename to hphp / test / zend / flaky / ext / standard / tests / strings / explode_bug . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / strings / explode_bug . php . expectf <nl> rename to hphp / test / zend / flaky / ext / standard / tests / strings / explode_bug . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / standard / tests / strings / explode_bug . php . ini <nl> rename to hphp / test / zend / flaky / ext / standard / tests / strings / explode_bug . php . ini <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / xsl / tests / bug49634 . php <nl> rename to hphp / test / zend / flaky / ext / xsl / tests / bug49634 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / xsl / tests / bug49634 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / xsl / tests / bug49634 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / xsl / tests / bug49634 . php . skipif <nl> rename to hphp / test / zend / flaky / ext / xsl / tests / bug49634 . php . skipif <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / xsl / tests / bug54446_with_ini . php <nl> rename to hphp / test / zend / flaky / ext / xsl / tests / bug54446_with_ini . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / xsl / tests / bug54446_with_ini . php . expectf <nl> rename to hphp / test / zend / flaky / ext / xsl / tests / bug54446_with_ini . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / xsl / tests / bug54446_with_ini . php . skipif <nl> rename to hphp / test / zend / flaky / ext / xsl / tests / bug54446_with_ini . php . skipif <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / xsl / tests / xsl - phpinfo . php <nl> rename to hphp / test / zend / flaky / ext / xsl / tests / xsl - phpinfo . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / xsl / tests / xsl - phpinfo . php . expectf <nl> rename to hphp / test / zend / flaky / ext / xsl / tests / xsl - phpinfo . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / xsl / tests / xsl - phpinfo . php . skipif <nl> rename to hphp / test / zend / flaky / ext / xsl / tests / xsl - phpinfo . php . skipif <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / xsl / tests / xslt008 . php <nl> rename to hphp / test / zend / flaky / ext / xsl / tests / xslt008 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / xsl / tests / xslt008 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / xsl / tests / xslt008 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / xsl / tests / xslt008 . php . skipif <nl> rename to hphp / test / zend / flaky / ext / xsl / tests / xslt008 . php . skipif <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / xsl / tests / xslt009 . php <nl> rename to hphp / test / zend / flaky / ext / xsl / tests / xslt009 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / xsl / tests / xslt009 . php . expectf <nl> rename to hphp / test / zend / flaky / ext / xsl / tests / xslt009 . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / xsl / tests / xslt009 . php . skipif <nl> rename to hphp / test / zend / flaky / ext / xsl / tests / xslt009 . php . skipif <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / xsl / tests / xsltprocessor_getParameter - wrongparam . php <nl> rename to hphp / test / zend / flaky / ext / xsl / tests / xsltprocessor_getParameter - wrongparam . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / xsl / tests / xsltprocessor_getParameter - wrongparam . php . expectf <nl> rename to hphp / test / zend / flaky / ext / xsl / tests / xsltprocessor_getParameter - wrongparam . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / xsl / tests / xsltprocessor_getParameter - wrongparam . php . skipif <nl> rename to hphp / test / zend / flaky / ext / xsl / tests / xsltprocessor_getParameter - wrongparam . php . skipif <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / xsl / tests / xsltprocessor_removeParameter - wrongparams . php <nl> rename to hphp / test / zend / flaky / ext / xsl / tests / xsltprocessor_removeParameter - wrongparams . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / xsl / tests / xsltprocessor_removeParameter - wrongparams . php . expectf <nl> rename to hphp / test / zend / flaky / ext / xsl / tests / xsltprocessor_removeParameter - wrongparams . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / xsl / tests / xsltprocessor_removeParameter - wrongparams . php . skipif <nl> rename to hphp / test / zend / flaky / ext / xsl / tests / xsltprocessor_removeParameter - wrongparams . php . skipif <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / zlib / tests / gzfile_basic . php <nl> rename to hphp / test / zend / flaky / ext / zlib / tests / gzfile_basic . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / zlib / tests / gzfile_basic . php . expectf <nl> rename to hphp / test / zend / flaky / ext / zlib / tests / gzfile_basic . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / zlib / tests / gzfile_basic . php . skipif <nl> rename to hphp / test / zend / flaky / ext / zlib / tests / gzfile_basic . php . skipif <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / zlib / tests / readgzfile_basic . php <nl> rename to hphp / test / zend / flaky / ext / zlib / tests / readgzfile_basic . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / zlib / tests / readgzfile_basic . php . expectf <nl> rename to hphp / test / zend / flaky / ext / zlib / tests / readgzfile_basic . php . expectf <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / ext / zlib / tests / readgzfile_basic . php . skipif <nl> rename to hphp / test / zend / flaky / ext / zlib / tests / readgzfile_basic . php . skipif <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / tests / lang / 038 . php <nl> rename to hphp / test / zend / flaky / tests / lang / 038 . php <nl> similarity index 100 % <nl> rename from hphp / test / zend / bad / tests / lang / 038 . php . expectf <nl> rename to hphp / test / zend / flaky / tests / lang / 038 . php . expectf <nl> | Move flaky tests to their own directory | facebook/hhvm | 9235ae86c95a5dfa184293ef84e4cec51615de72 | 2014-07-30T23:30:20Z |
mmm a / src / isolate . cc <nl> ppp b / src / isolate . cc <nl> void Isolate : : Deinit ( ) { <nl> PrintF ( stdout , " = = = Stress deopt counter : % u \ n " , stress_deopt_count_ ) ; <nl> } <nl> <nl> + if ( cpu_profiler_ ) { <nl> + cpu_profiler_ - > DeleteAllProfiles ( ) ; <nl> + } <nl> + <nl> / / We must stop the logger before we tear down other components . <nl> Sampler * sampler = logger_ - > sampler ( ) ; <nl> if ( sampler & & sampler - > IsActive ( ) ) sampler - > Stop ( ) ; <nl> | Stop profiler on isolate teardown if still running | v8/v8 | 8d00c2ca40459d46f127c8156c5afb7bfa79d9e6 | 2015-12-17T15:09:14Z |
mmm a / plugins / net_plugin / net_plugin . cpp <nl> ppp b / plugins / net_plugin / net_plugin . cpp <nl> namespace eosio { <nl> <nl> bool use_socket_read_watermark = false ; <nl> <nl> + channels : : transaction_ack : : channel_type : : handle incoming_transaction_ack_subscription ; <nl> + <nl> uint16_t thread_pool_size = 4 ; <nl> optional < boost : : asio : : thread_pool > thread_pool ; <nl> std : : shared_ptr < boost : : asio : : io_context > server_ioc ; <nl> namespace eosio { <nl> void send_transaction_to_all ( const std : : shared_ptr < std : : vector < char > > & send_buffer , VerifierFunc verify ) ; <nl> <nl> void accepted_block ( const block_state_ptr & ) ; <nl> + void transaction_ack ( const std : : pair < fc : : exception_ptr , transaction_metadata_ptr > & ) ; <nl> <nl> bool is_valid ( const handshake_message & msg ) ; <nl> <nl> namespace eosio { <nl> dispatcher - > bcast_block ( block ) ; <nl> } <nl> <nl> + void net_plugin_impl : : transaction_ack ( const std : : pair < fc : : exception_ptr , transaction_metadata_ptr > & results ) { <nl> + const auto & id = results . second - > id ; <nl> + if ( results . first ) { <nl> + fc_ilog ( logger , " signaled NACK , trx - id = $ { id } : $ { why } " , ( " id " , id ) ( " why " , results . first - > to_detail_string ( ) ) ) ; <nl> + dispatcher - > rejected_transaction ( id ) ; <nl> + } else { <nl> + fc_ilog ( logger , " signaled ACK , trx - id = $ { id } " , ( " id " , id ) ) ; <nl> + dispatcher - > bcast_transaction ( results . second ) ; <nl> + } <nl> + } <nl> + <nl> bool net_plugin_impl : : authenticate_peer ( const handshake_message & msg ) const { <nl> if ( allowed_connections = = None ) <nl> return false ; <nl> namespace eosio { <nl> cc . accepted_block . connect ( boost : : bind ( & net_plugin_impl : : accepted_block , my . get ( ) , _1 ) ) ; <nl> } <nl> <nl> + my - > incoming_transaction_ack_subscription = app ( ) . get_channel < channels : : transaction_ack > ( ) . subscribe ( boost : : bind ( & net_plugin_impl : : transaction_ack , my . get ( ) , _1 ) ) ; <nl> + <nl> my - > db_read_mode = cc . get_read_mode ( ) ; <nl> if ( my - > db_read_mode = = chain : : db_read_mode : : READ_ONLY ) { <nl> my - > max_nodes_per_host = 0 ; <nl> | Revert " Remove unneeded ack of transactions . Already processed by handle_message of packed_transaction_ptr " | EOSIO/eos | 679b059f823a9955a5b58d79fa6b360fc2b06215 | 2019-03-05T20:51:47Z |
mmm a / include / v8 - internal . h <nl> ppp b / include / v8 - internal . h <nl> class Isolate ; <nl> <nl> namespace internal { <nl> <nl> - class Object ; <nl> + typedef uintptr_t Address ; <nl> + static const Address kNullAddress = 0 ; <nl> <nl> / * * <nl> * Configuration of tagging scheme . <nl> template < size_t tagged_ptr_size > <nl> struct SmiTagging ; <nl> <nl> template < int kSmiShiftSize > <nl> - V8_INLINE internal : : Object * IntToSmi ( int value ) { <nl> + V8_INLINE internal : : Address IntToSmi ( int value ) { <nl> int smi_shift_bits = kSmiTagSize + kSmiShiftSize ; <nl> - intptr_t tagged_value = <nl> - ( static_cast < intptr_t > ( value ) < < smi_shift_bits ) | kSmiTag ; <nl> - return reinterpret_cast < internal : : Object * > ( tagged_value ) ; <nl> + uintptr_t tagged_value = <nl> + ( static_cast < uintptr_t > ( value ) < < smi_shift_bits ) | kSmiTag ; <nl> + return static_cast < internal : : Address > ( tagged_value ) ; <nl> } <nl> <nl> / / Smi constants for systems where tagged pointer is a 32 - bit value . <nl> struct SmiTagging < 4 > { <nl> enum { kSmiShiftSize = 0 , kSmiValueSize = 31 } ; <nl> static int SmiShiftSize ( ) { return kSmiShiftSize ; } <nl> static int SmiValueSize ( ) { return kSmiValueSize ; } <nl> - V8_INLINE static int SmiToInt ( const internal : : Object * value ) { <nl> + V8_INLINE static int SmiToInt ( const internal : : Address value ) { <nl> int shift_bits = kSmiTagSize + kSmiShiftSize ; <nl> - / / Throw away top 32 bits and shift down ( requires > > to be sign extending ) . <nl> - return static_cast < int > ( reinterpret_cast < intptr_t > ( value ) ) > > shift_bits ; <nl> + / / Shift down ( requires > > to be sign extending ) . <nl> + return static_cast < int > ( static_cast < intptr_t > ( value ) ) > > shift_bits ; <nl> } <nl> - V8_INLINE static internal : : Object * IntToSmi ( int value ) { <nl> + V8_INLINE static internal : : Address IntToSmi ( int value ) { <nl> return internal : : IntToSmi < kSmiShiftSize > ( value ) ; <nl> } <nl> V8_INLINE static constexpr bool IsValidSmi ( intptr_t value ) { <nl> / / To be representable as an tagged small integer , the two <nl> / / most - significant bits of ' value ' must be either 00 or 11 due to <nl> / / sign - extension . To check this we add 01 to the two <nl> - / / most - significant bits , and check if the most - significant bit is 0 <nl> + / / most - significant bits , and check if the most - significant bit is 0 . <nl> / / <nl> / / CAUTION : The original code below : <nl> / / bool result = ( ( value + 0x40000000 ) & 0x80000000 ) = = 0 ; <nl> struct SmiTagging < 8 > { <nl> enum { kSmiShiftSize = 31 , kSmiValueSize = 32 } ; <nl> static int SmiShiftSize ( ) { return kSmiShiftSize ; } <nl> static int SmiValueSize ( ) { return kSmiValueSize ; } <nl> - V8_INLINE static int SmiToInt ( const internal : : Object * value ) { <nl> + V8_INLINE static int SmiToInt ( const internal : : Address value ) { <nl> int shift_bits = kSmiTagSize + kSmiShiftSize ; <nl> / / Shift down and throw away top 32 bits . <nl> - return static_cast < int > ( reinterpret_cast < intptr_t > ( value ) > > shift_bits ) ; <nl> + return static_cast < int > ( static_cast < intptr_t > ( value ) > > shift_bits ) ; <nl> } <nl> - V8_INLINE static internal : : Object * IntToSmi ( int value ) { <nl> + V8_INLINE static internal : : Address IntToSmi ( int value ) { <nl> return internal : : IntToSmi < kSmiShiftSize > ( value ) ; <nl> } <nl> V8_INLINE static constexpr bool IsValidSmi ( intptr_t value ) { <nl> class Internals { <nl> # endif <nl> } <nl> <nl> - V8_INLINE static bool HasHeapObjectTag ( const internal : : Object * value ) { <nl> - return ( ( reinterpret_cast < intptr_t > ( value ) & kHeapObjectTagMask ) = = <nl> - kHeapObjectTag ) ; <nl> + V8_INLINE static bool HasHeapObjectTag ( const internal : : Address value ) { <nl> + return ( value & kHeapObjectTagMask ) = = static_cast < Address > ( kHeapObjectTag ) ; <nl> } <nl> <nl> - V8_INLINE static int SmiValue ( const internal : : Object * value ) { <nl> + V8_INLINE static int SmiValue ( const internal : : Address value ) { <nl> return PlatformSmiTagging : : SmiToInt ( value ) ; <nl> } <nl> <nl> - V8_INLINE static internal : : Object * IntToSmi ( int value ) { <nl> + V8_INLINE static internal : : Address IntToSmi ( int value ) { <nl> return PlatformSmiTagging : : IntToSmi ( value ) ; <nl> } <nl> <nl> class Internals { <nl> return PlatformSmiTagging : : IsValidSmi ( value ) ; <nl> } <nl> <nl> - V8_INLINE static int GetInstanceType ( const internal : : Object * obj ) { <nl> - typedef internal : : Object O ; <nl> - O * map = ReadField < O * > ( obj , kHeapObjectMapOffset ) ; <nl> + V8_INLINE static int GetInstanceType ( const internal : : Address obj ) { <nl> + typedef internal : : Address A ; <nl> + A map = ReadField < A > ( obj , kHeapObjectMapOffset ) ; <nl> return ReadField < uint16_t > ( map , kMapInstanceTypeOffset ) ; <nl> } <nl> <nl> - V8_INLINE static int GetOddballKind ( const internal : : Object * obj ) { <nl> - typedef internal : : Object O ; <nl> - return SmiValue ( ReadField < O * > ( obj , kOddballKindOffset ) ) ; <nl> + V8_INLINE static int GetOddballKind ( const internal : : Address obj ) { <nl> + return SmiValue ( ReadField < internal : : Address > ( obj , kOddballKindOffset ) ) ; <nl> } <nl> <nl> V8_INLINE static bool IsExternalTwoByteString ( int instance_type ) { <nl> class Internals { <nl> return representation = = kExternalTwoByteRepresentationTag ; <nl> } <nl> <nl> - V8_INLINE static uint8_t GetNodeFlag ( internal : : Object * * obj , int shift ) { <nl> + V8_INLINE static uint8_t GetNodeFlag ( internal : : Address * obj , int shift ) { <nl> uint8_t * addr = reinterpret_cast < uint8_t * > ( obj ) + kNodeFlagsOffset ; <nl> return * addr & static_cast < uint8_t > ( 1U < < shift ) ; <nl> } <nl> <nl> - V8_INLINE static void UpdateNodeFlag ( internal : : Object * * obj , bool value , <nl> + V8_INLINE static void UpdateNodeFlag ( internal : : Address * obj , bool value , <nl> int shift ) { <nl> uint8_t * addr = reinterpret_cast < uint8_t * > ( obj ) + kNodeFlagsOffset ; <nl> uint8_t mask = static_cast < uint8_t > ( 1U < < shift ) ; <nl> * addr = static_cast < uint8_t > ( ( * addr & ~ mask ) | ( value < < shift ) ) ; <nl> } <nl> <nl> - V8_INLINE static uint8_t GetNodeState ( internal : : Object * * obj ) { <nl> + V8_INLINE static uint8_t GetNodeState ( internal : : Address * obj ) { <nl> uint8_t * addr = reinterpret_cast < uint8_t * > ( obj ) + kNodeFlagsOffset ; <nl> return * addr & kNodeStateMask ; <nl> } <nl> <nl> - V8_INLINE static void UpdateNodeState ( internal : : Object * * obj , uint8_t value ) { <nl> + V8_INLINE static void UpdateNodeState ( internal : : Address * obj , uint8_t value ) { <nl> uint8_t * addr = reinterpret_cast < uint8_t * > ( obj ) + kNodeFlagsOffset ; <nl> * addr = static_cast < uint8_t > ( ( * addr & ~ kNodeStateMask ) | value ) ; <nl> } <nl> <nl> V8_INLINE static void SetEmbedderData ( v8 : : Isolate * isolate , uint32_t slot , <nl> void * data ) { <nl> - uint8_t * addr = reinterpret_cast < uint8_t * > ( isolate ) + <nl> - kIsolateEmbedderDataOffset + slot * kApiPointerSize ; <nl> + internal : : Address addr = reinterpret_cast < internal : : Address > ( isolate ) + <nl> + kIsolateEmbedderDataOffset + <nl> + slot * kApiPointerSize ; <nl> * reinterpret_cast < void * * > ( addr ) = data ; <nl> } <nl> <nl> V8_INLINE static void * GetEmbedderData ( const v8 : : Isolate * isolate , <nl> uint32_t slot ) { <nl> - const uint8_t * addr = reinterpret_cast < const uint8_t * > ( isolate ) + <nl> - kIsolateEmbedderDataOffset + slot * kApiPointerSize ; <nl> + internal : : Address addr = reinterpret_cast < internal : : Address > ( isolate ) + <nl> + kIsolateEmbedderDataOffset + <nl> + slot * kApiPointerSize ; <nl> return * reinterpret_cast < void * const * > ( addr ) ; <nl> } <nl> <nl> - V8_INLINE static internal : : Object * * GetRoot ( v8 : : Isolate * isolate , int index ) { <nl> - uint8_t * addr = reinterpret_cast < uint8_t * > ( isolate ) + kIsolateRootsOffset ; <nl> - return reinterpret_cast < internal : : Object * * > ( addr + index * kApiPointerSize ) ; <nl> + V8_INLINE static internal : : Address * GetRoot ( v8 : : Isolate * isolate , int index ) { <nl> + internal : : Address addr = <nl> + reinterpret_cast < internal : : Address > ( isolate ) + kIsolateRootsOffset ; <nl> + return reinterpret_cast < internal : : Address * > ( addr + index * kApiPointerSize ) ; <nl> } <nl> <nl> template < typename T > <nl> - V8_INLINE static T ReadField ( const internal : : Object * ptr , int offset ) { <nl> - const uint8_t * addr = <nl> - reinterpret_cast < const uint8_t * > ( ptr ) + offset - kHeapObjectTag ; <nl> + V8_INLINE static T ReadField ( const internal : : Address heap_object_ptr , <nl> + int offset ) { <nl> + internal : : Address addr = heap_object_ptr + offset - kHeapObjectTag ; <nl> return * reinterpret_cast < const T * > ( addr ) ; <nl> } <nl> <nl> template < typename T > <nl> V8_INLINE static T ReadEmbedderData ( const v8 : : Context * context , int index ) { <nl> - typedef internal : : Object O ; <nl> + typedef internal : : Address A ; <nl> typedef internal : : Internals I ; <nl> - O * ctx = * reinterpret_cast < O * const * > ( context ) ; <nl> + A ctx = * reinterpret_cast < const A * > ( context ) ; <nl> int embedder_data_offset = <nl> I : : kContextHeaderSize + <nl> ( internal : : kApiPointerSize * I : : kContextEmbedderDataIndex ) ; <nl> - O * embedder_data = I : : ReadField < O * > ( ctx , embedder_data_offset ) ; <nl> + A embedder_data = I : : ReadField < A > ( ctx , embedder_data_offset ) ; <nl> int value_offset = <nl> I : : kFixedArrayHeaderSize + ( internal : : kApiPointerSize * index ) ; <nl> return I : : ReadField < T > ( embedder_data , value_offset ) ; <nl> mmm a / include / v8 - util . h <nl> ppp b / include / v8 - util . h <nl> enum PersistentContainerCallbackType { <nl> kWeak = kWeakWithParameter / / For backwards compatibility . Deprecate . <nl> } ; <nl> <nl> - <nl> / * * <nl> - * A default trait implemenation for PersistentValueMap which uses std : : map <nl> + * A default trait implementation for PersistentValueMap which uses std : : map <nl> * as a backing map . <nl> * <nl> * Users will have to implement their own weak callbacks & dispose traits . <nl> class PersistentValueMapBase { <nl> void RegisterExternallyReferencedObject ( K & key ) { <nl> assert ( Contains ( key ) ) ; <nl> V8 : : RegisterExternallyReferencedObject ( <nl> - reinterpret_cast < internal : : Object * * > ( FromVal ( Traits : : Get ( & impl_ , key ) ) ) , <nl> + reinterpret_cast < internal : : Address * > ( FromVal ( Traits : : Get ( & impl_ , key ) ) ) , <nl> reinterpret_cast < internal : : Isolate * > ( GetIsolate ( ) ) ) ; <nl> } <nl> <nl> class PersistentValueMapBase { <nl> bool hasValue = value ! = kPersistentContainerNotFound ; <nl> if ( hasValue ) { <nl> returnValue - > SetInternal ( <nl> - * reinterpret_cast < internal : : Object * * > ( FromVal ( value ) ) ) ; <nl> + * reinterpret_cast < internal : : Address * > ( FromVal ( value ) ) ) ; <nl> } <nl> return hasValue ; <nl> } <nl> mmm a / include / v8 . h <nl> ppp b / include / v8 . h <nl> class HeapObject ; <nl> class Isolate ; <nl> class LocalEmbedderHeapTracer ; <nl> class NeverReadOnlySpaceObject ; <nl> - class Object ; <nl> struct ScriptStreamingData ; <nl> template < typename T > class CustomArguments ; <nl> class PropertyCallbackArguments ; <nl> class Local { <nl> * / <nl> template < class S > <nl> V8_INLINE bool operator = = ( const Local < S > & that ) const { <nl> - internal : : Object * * a = reinterpret_cast < internal : : Object * * > ( this - > val_ ) ; <nl> - internal : : Object * * b = reinterpret_cast < internal : : Object * * > ( that . val_ ) ; <nl> + internal : : Address * a = reinterpret_cast < internal : : Address * > ( this - > val_ ) ; <nl> + internal : : Address * b = reinterpret_cast < internal : : Address * > ( that . val_ ) ; <nl> if ( a = = nullptr ) return b = = nullptr ; <nl> if ( b = = nullptr ) return false ; <nl> return * a = = * b ; <nl> class Local { <nl> <nl> template < class S > V8_INLINE bool operator = = ( <nl> const PersistentBase < S > & that ) const { <nl> - internal : : Object * * a = reinterpret_cast < internal : : Object * * > ( this - > val_ ) ; <nl> - internal : : Object * * b = reinterpret_cast < internal : : Object * * > ( that . val_ ) ; <nl> + internal : : Address * a = reinterpret_cast < internal : : Address * > ( this - > val_ ) ; <nl> + internal : : Address * b = reinterpret_cast < internal : : Address * > ( that . val_ ) ; <nl> if ( a = = nullptr ) return b = = nullptr ; <nl> if ( b = = nullptr ) return false ; <nl> return * a = = * b ; <nl> template < class T > class PersistentBase { <nl> <nl> template < class S > <nl> V8_INLINE bool operator = = ( const PersistentBase < S > & that ) const { <nl> - internal : : Object * * a = reinterpret_cast < internal : : Object * * > ( this - > val_ ) ; <nl> - internal : : Object * * b = reinterpret_cast < internal : : Object * * > ( that . val_ ) ; <nl> + internal : : Address * a = reinterpret_cast < internal : : Address * > ( this - > val_ ) ; <nl> + internal : : Address * b = reinterpret_cast < internal : : Address * > ( that . val_ ) ; <nl> if ( a = = nullptr ) return b = = nullptr ; <nl> if ( b = = nullptr ) return false ; <nl> return * a = = * b ; <nl> template < class T > class PersistentBase { <nl> <nl> template < class S > <nl> V8_INLINE bool operator = = ( const Local < S > & that ) const { <nl> - internal : : Object * * a = reinterpret_cast < internal : : Object * * > ( this - > val_ ) ; <nl> - internal : : Object * * b = reinterpret_cast < internal : : Object * * > ( that . val_ ) ; <nl> + internal : : Address * a = reinterpret_cast < internal : : Address * > ( this - > val_ ) ; <nl> + internal : : Address * b = reinterpret_cast < internal : : Address * > ( that . val_ ) ; <nl> if ( a = = nullptr ) return b = = nullptr ; <nl> if ( b = = nullptr ) return false ; <nl> return * a = = * b ; <nl> class V8_EXPORT HandleScope { <nl> <nl> void Initialize ( Isolate * isolate ) ; <nl> <nl> - static internal : : Object * * CreateHandle ( internal : : Isolate * isolate , <nl> - internal : : Object * value ) ; <nl> + static internal : : Address * CreateHandle ( internal : : Isolate * isolate , <nl> + internal : : Address value ) ; <nl> <nl> private : <nl> / / Declaring operator new and delete as deleted is not spec compliant . <nl> class V8_EXPORT HandleScope { <nl> void operator delete [ ] ( void * , size_t ) ; <nl> <nl> / / Uses heap_object to obtain the current Isolate . <nl> - static internal : : Object * * CreateHandle ( <nl> - internal : : NeverReadOnlySpaceObject * heap_object , internal : : Object * value ) ; <nl> + static internal : : Address * CreateHandle ( <nl> + internal : : NeverReadOnlySpaceObject * heap_object , internal : : Address value ) ; <nl> <nl> internal : : Isolate * isolate_ ; <nl> - internal : : Object * * prev_next_ ; <nl> - internal : : Object * * prev_limit_ ; <nl> + internal : : Address * prev_next_ ; <nl> + internal : : Address * prev_limit_ ; <nl> <nl> / / Local : : New uses CreateHandle with an Isolate * parameter . <nl> template < class F > friend class Local ; <nl> class V8_EXPORT EscapableHandleScope : public HandleScope { <nl> * / <nl> template < class T > <nl> V8_INLINE Local < T > Escape ( Local < T > value ) { <nl> - internal : : Object * * slot = <nl> - Escape ( reinterpret_cast < internal : : Object * * > ( * value ) ) ; <nl> + internal : : Address * slot = <nl> + Escape ( reinterpret_cast < internal : : Address * > ( * value ) ) ; <nl> return Local < T > ( reinterpret_cast < T * > ( slot ) ) ; <nl> } <nl> <nl> class V8_EXPORT EscapableHandleScope : public HandleScope { <nl> void operator delete ( void * , size_t ) ; <nl> void operator delete [ ] ( void * , size_t ) ; <nl> <nl> - internal : : Object * * Escape ( internal : : Object * * escape_value ) ; <nl> - internal : : Object * * escape_slot_ ; <nl> + internal : : Address * Escape ( internal : : Address * escape_value ) ; <nl> + internal : : Address * escape_slot_ ; <nl> } ; <nl> <nl> / * * <nl> class V8_EXPORT SealHandleScope { <nl> void operator delete [ ] ( void * , size_t ) ; <nl> <nl> internal : : Isolate * const isolate_ ; <nl> - internal : : Object * * prev_limit_ ; <nl> + internal : : Address * prev_limit_ ; <nl> int prev_sealed_level_ ; <nl> } ; <nl> <nl> class V8_EXPORT String : public Name { <nl> ExternalStringResource * GetExternalStringResourceSlow ( ) const ; <nl> ExternalStringResourceBase * GetExternalStringResourceBaseSlow ( <nl> String : : Encoding * encoding_out ) const ; <nl> - const ExternalOneByteStringResource * GetExternalOneByteStringResourceSlow ( ) <nl> - const ; <nl> <nl> static void CheckCast ( v8 : : Value * obj ) ; <nl> } ; <nl> class ReturnValue { <nl> template < class F > friend class PropertyCallbackInfo ; <nl> template < class F , class G , class H > <nl> friend class PersistentValueMapBase ; <nl> - V8_INLINE void SetInternal ( internal : : Object * value ) { * value_ = value ; } <nl> - V8_INLINE internal : : Object * GetDefaultValue ( ) ; <nl> - V8_INLINE explicit ReturnValue ( internal : : Object * * slot ) ; <nl> - internal : : Object * * value_ ; <nl> + V8_INLINE void SetInternal ( internal : : Address value ) { * value_ = value ; } <nl> + V8_INLINE internal : : Address GetDefaultValue ( ) ; <nl> + V8_INLINE explicit ReturnValue ( internal : : Address * slot ) ; <nl> + internal : : Address * value_ ; <nl> } ; <nl> <nl> <nl> class FunctionCallbackInfo { <nl> static const int kDataIndex = 4 ; <nl> static const int kNewTargetIndex = 5 ; <nl> <nl> - V8_INLINE FunctionCallbackInfo ( internal : : Object * * implicit_args , <nl> - internal : : Object * * values , int length ) ; <nl> - internal : : Object * * implicit_args_ ; <nl> - internal : : Object * * values_ ; <nl> + V8_INLINE FunctionCallbackInfo ( internal : : Address * implicit_args , <nl> + internal : : Address * values , int length ) ; <nl> + internal : : Address * implicit_args_ ; <nl> + internal : : Address * values_ ; <nl> int length_ ; <nl> } ; <nl> <nl> class PropertyCallbackInfo { <nl> static const int kDataIndex = 5 ; <nl> static const int kThisIndex = 6 ; <nl> <nl> - V8_INLINE PropertyCallbackInfo ( internal : : Object * * args ) : args_ ( args ) { } <nl> - internal : : Object * * args_ ; <nl> + V8_INLINE PropertyCallbackInfo ( internal : : Address * args ) : args_ ( args ) { } <nl> + internal : : Address * args_ ; <nl> } ; <nl> <nl> <nl> class V8_EXPORT Isolate { <nl> template < class K , class V , class Traits > <nl> friend class PersistentValueMapBase ; <nl> <nl> - internal : : Object * * GetDataFromSnapshotOnce ( size_t index ) ; <nl> + internal : : Address * GetDataFromSnapshotOnce ( size_t index ) ; <nl> void ReportExternalAllocationLimitReached ( ) ; <nl> void CheckMemoryPressure ( ) ; <nl> } ; <nl> class V8_EXPORT V8 { <nl> private : <nl> V8 ( ) ; <nl> <nl> - static internal : : Object * * GlobalizeReference ( internal : : Isolate * isolate , <nl> - internal : : Object * * handle ) ; <nl> - static internal : : Object * * CopyPersistent ( internal : : Object * * handle ) ; <nl> - static void DisposeGlobal ( internal : : Object * * global_handle ) ; <nl> - static void MakeWeak ( internal : : Object * * location , void * data , <nl> + static internal : : Address * GlobalizeReference ( internal : : Isolate * isolate , <nl> + internal : : Address * handle ) ; <nl> + static internal : : Address * CopyPersistent ( internal : : Address * handle ) ; <nl> + static void DisposeGlobal ( internal : : Address * global_handle ) ; <nl> + static void MakeWeak ( internal : : Address * location , void * data , <nl> WeakCallbackInfo < void > : : Callback weak_callback , <nl> WeakCallbackType type ) ; <nl> - static void MakeWeak ( internal : : Object * * location , void * data , <nl> - / / Must be 0 or - 1 . <nl> - int internal_field_index1 , <nl> - / / Must be 1 or - 1 . <nl> - int internal_field_index2 , <nl> - WeakCallbackInfo < void > : : Callback weak_callback ) ; <nl> - static void MakeWeak ( internal : : Object * * * location_addr ) ; <nl> - static void * ClearWeak ( internal : : Object * * location ) ; <nl> - static void AnnotateStrongRetainer ( internal : : Object * * location , <nl> + static void MakeWeak ( internal : : Address * * location_addr ) ; <nl> + static void * ClearWeak ( internal : : Address * location ) ; <nl> + static void AnnotateStrongRetainer ( internal : : Address * location , <nl> const char * label ) ; <nl> static Value * Eternalize ( Isolate * isolate , Value * handle ) ; <nl> <nl> - static void RegisterExternallyReferencedObject ( internal : : Object * * object , <nl> + static void RegisterExternallyReferencedObject ( internal : : Address * location , <nl> internal : : Isolate * isolate ) ; <nl> <nl> template < class K , class V , class T > <nl> class V8_EXPORT SnapshotCreator { <nl> void operator = ( const SnapshotCreator & ) = delete ; <nl> <nl> private : <nl> - size_t AddData ( Local < Context > context , internal : : Object * object ) ; <nl> - size_t AddData ( internal : : Object * object ) ; <nl> + size_t AddData ( Local < Context > context , internal : : Address object ) ; <nl> + size_t AddData ( internal : : Address object ) ; <nl> <nl> void * data_ ; <nl> } ; <nl> class V8_EXPORT Context { <nl> friend class Object ; <nl> friend class Function ; <nl> <nl> - internal : : Object * * GetDataFromSnapshotOnce ( size_t index ) ; <nl> + internal : : Address * GetDataFromSnapshotOnce ( size_t index ) ; <nl> Local < Value > SlowGetEmbedderData ( int index ) ; <nl> void * SlowGetAlignedPointerFromEmbedderData ( int index ) ; <nl> } ; <nl> template < class T > <nl> Local < T > Local < T > : : New ( Isolate * isolate , T * that ) { <nl> if ( that = = nullptr ) return Local < T > ( ) ; <nl> T * that_ptr = that ; <nl> - internal : : Object * * p = reinterpret_cast < internal : : Object * * > ( that_ptr ) ; <nl> + internal : : Address * p = reinterpret_cast < internal : : Address * > ( that_ptr ) ; <nl> return Local < T > ( reinterpret_cast < T * > ( HandleScope : : CreateHandle ( <nl> reinterpret_cast < internal : : Isolate * > ( isolate ) , * p ) ) ) ; <nl> } <nl> void * WeakCallbackInfo < T > : : GetInternalField ( int index ) const { <nl> template < class T > <nl> T * PersistentBase < T > : : New ( Isolate * isolate , T * that ) { <nl> if ( that = = nullptr ) return nullptr ; <nl> - internal : : Object * * p = reinterpret_cast < internal : : Object * * > ( that ) ; <nl> + internal : : Address * p = reinterpret_cast < internal : : Address * > ( that ) ; <nl> return reinterpret_cast < T * > ( <nl> V8 : : GlobalizeReference ( reinterpret_cast < internal : : Isolate * > ( isolate ) , <nl> p ) ) ; <nl> void Persistent < T , M > : : Copy ( const Persistent < S , M2 > & that ) { <nl> TYPE_CHECK ( T , S ) ; <nl> this - > Reset ( ) ; <nl> if ( that . IsEmpty ( ) ) return ; <nl> - internal : : Object * * p = reinterpret_cast < internal : : Object * * > ( that . val_ ) ; <nl> + internal : : Address * p = reinterpret_cast < internal : : Address * > ( that . val_ ) ; <nl> this - > val_ = reinterpret_cast < T * > ( V8 : : CopyPersistent ( p ) ) ; <nl> M : : Copy ( that , this ) ; <nl> } <nl> template < class T > <nl> bool PersistentBase < T > : : IsIndependent ( ) const { <nl> typedef internal : : Internals I ; <nl> if ( this - > IsEmpty ( ) ) return false ; <nl> - return I : : GetNodeFlag ( reinterpret_cast < internal : : Object * * > ( this - > val_ ) , <nl> + return I : : GetNodeFlag ( reinterpret_cast < internal : : Address * > ( this - > val_ ) , <nl> I : : kNodeIsIndependentShift ) ; <nl> } <nl> <nl> bool PersistentBase < T > : : IsNearDeath ( ) const { <nl> typedef internal : : Internals I ; <nl> if ( this - > IsEmpty ( ) ) return false ; <nl> uint8_t node_state = <nl> - I : : GetNodeState ( reinterpret_cast < internal : : Object * * > ( this - > val_ ) ) ; <nl> + I : : GetNodeState ( reinterpret_cast < internal : : Address * > ( this - > val_ ) ) ; <nl> return node_state = = I : : kNodeStateIsNearDeathValue | | <nl> node_state = = I : : kNodeStateIsPendingValue ; <nl> } <nl> template < class T > <nl> bool PersistentBase < T > : : IsWeak ( ) const { <nl> typedef internal : : Internals I ; <nl> if ( this - > IsEmpty ( ) ) return false ; <nl> - return I : : GetNodeState ( reinterpret_cast < internal : : Object * * > ( this - > val_ ) ) = = <nl> - I : : kNodeStateIsWeakValue ; <nl> + return I : : GetNodeState ( reinterpret_cast < internal : : Address * > ( this - > val_ ) ) = = <nl> + I : : kNodeStateIsWeakValue ; <nl> } <nl> <nl> <nl> template < class T > <nl> void PersistentBase < T > : : Reset ( ) { <nl> if ( this - > IsEmpty ( ) ) return ; <nl> - V8 : : DisposeGlobal ( reinterpret_cast < internal : : Object * * > ( this - > val_ ) ) ; <nl> + V8 : : DisposeGlobal ( reinterpret_cast < internal : : Address * > ( this - > val_ ) ) ; <nl> val_ = nullptr ; <nl> } <nl> <nl> V8_INLINE void PersistentBase < T > : : SetWeak ( <nl> P * parameter , typename WeakCallbackInfo < P > : : Callback callback , <nl> WeakCallbackType type ) { <nl> typedef typename WeakCallbackInfo < void > : : Callback Callback ; <nl> - V8 : : MakeWeak ( reinterpret_cast < internal : : Object * * > ( this - > val_ ) , parameter , <nl> + V8 : : MakeWeak ( reinterpret_cast < internal : : Address * > ( this - > val_ ) , parameter , <nl> reinterpret_cast < Callback > ( callback ) , type ) ; <nl> } <nl> <nl> template < class T > <nl> void PersistentBase < T > : : SetWeak ( ) { <nl> - V8 : : MakeWeak ( reinterpret_cast < internal : : Object * * * > ( & this - > val_ ) ) ; <nl> + V8 : : MakeWeak ( reinterpret_cast < internal : : Address * * > ( & this - > val_ ) ) ; <nl> } <nl> <nl> template < class T > <nl> template < typename P > <nl> P * PersistentBase < T > : : ClearWeak ( ) { <nl> return reinterpret_cast < P * > ( <nl> - V8 : : ClearWeak ( reinterpret_cast < internal : : Object * * > ( this - > val_ ) ) ) ; <nl> + V8 : : ClearWeak ( reinterpret_cast < internal : : Address * > ( this - > val_ ) ) ) ; <nl> } <nl> <nl> template < class T > <nl> void PersistentBase < T > : : AnnotateStrongRetainer ( const char * label ) { <nl> - V8 : : AnnotateStrongRetainer ( reinterpret_cast < internal : : Object * * > ( this - > val_ ) , <nl> + V8 : : AnnotateStrongRetainer ( reinterpret_cast < internal : : Address * > ( this - > val_ ) , <nl> label ) ; <nl> } <nl> <nl> template < class T > <nl> void PersistentBase < T > : : RegisterExternalReference ( Isolate * isolate ) const { <nl> if ( IsEmpty ( ) ) return ; <nl> V8 : : RegisterExternallyReferencedObject ( <nl> - reinterpret_cast < internal : : Object * * > ( this - > val_ ) , <nl> + reinterpret_cast < internal : : Address * > ( this - > val_ ) , <nl> reinterpret_cast < internal : : Isolate * > ( isolate ) ) ; <nl> } <nl> <nl> template < class T > <nl> void PersistentBase < T > : : MarkIndependent ( ) { <nl> typedef internal : : Internals I ; <nl> if ( this - > IsEmpty ( ) ) return ; <nl> - I : : UpdateNodeFlag ( reinterpret_cast < internal : : Object * * > ( this - > val_ ) , true , <nl> + I : : UpdateNodeFlag ( reinterpret_cast < internal : : Address * > ( this - > val_ ) , true , <nl> I : : kNodeIsIndependentShift ) ; <nl> } <nl> <nl> template < class T > <nl> void PersistentBase < T > : : MarkActive ( ) { <nl> typedef internal : : Internals I ; <nl> if ( this - > IsEmpty ( ) ) return ; <nl> - I : : UpdateNodeFlag ( reinterpret_cast < internal : : Object * * > ( this - > val_ ) , true , <nl> + I : : UpdateNodeFlag ( reinterpret_cast < internal : : Address * > ( this - > val_ ) , true , <nl> I : : kNodeIsActiveShift ) ; <nl> } <nl> <nl> template < class T > <nl> void PersistentBase < T > : : SetWrapperClassId ( uint16_t class_id ) { <nl> typedef internal : : Internals I ; <nl> if ( this - > IsEmpty ( ) ) return ; <nl> - internal : : Object * * obj = reinterpret_cast < internal : : Object * * > ( this - > val_ ) ; <nl> + internal : : Address * obj = reinterpret_cast < internal : : Address * > ( this - > val_ ) ; <nl> uint8_t * addr = reinterpret_cast < uint8_t * > ( obj ) + I : : kNodeClassIdOffset ; <nl> * reinterpret_cast < uint16_t * > ( addr ) = class_id ; <nl> } <nl> template < class T > <nl> uint16_t PersistentBase < T > : : WrapperClassId ( ) const { <nl> typedef internal : : Internals I ; <nl> if ( this - > IsEmpty ( ) ) return 0 ; <nl> - internal : : Object * * obj = reinterpret_cast < internal : : Object * * > ( this - > val_ ) ; <nl> + internal : : Address * obj = reinterpret_cast < internal : : Address * > ( this - > val_ ) ; <nl> uint8_t * addr = reinterpret_cast < uint8_t * > ( obj ) + I : : kNodeClassIdOffset ; <nl> return * reinterpret_cast < uint16_t * > ( addr ) ; <nl> } <nl> <nl> - <nl> - template < typename T > <nl> - ReturnValue < T > : : ReturnValue ( internal : : Object * * slot ) : value_ ( slot ) { } <nl> + template < typename T > <nl> + ReturnValue < T > : : ReturnValue ( internal : : Address * slot ) : value_ ( slot ) { } <nl> <nl> template < typename T > <nl> template < typename S > <nl> void ReturnValue < T > : : Set ( const Persistent < S > & handle ) { <nl> if ( V8_UNLIKELY ( handle . IsEmpty ( ) ) ) { <nl> * value_ = GetDefaultValue ( ) ; <nl> } else { <nl> - * value_ = * reinterpret_cast < internal : : Object * * > ( * handle ) ; <nl> + * value_ = * reinterpret_cast < internal : : Address * > ( * handle ) ; <nl> } <nl> } <nl> <nl> void ReturnValue < T > : : Set ( const Global < S > & handle ) { <nl> if ( V8_UNLIKELY ( handle . IsEmpty ( ) ) ) { <nl> * value_ = GetDefaultValue ( ) ; <nl> } else { <nl> - * value_ = * reinterpret_cast < internal : : Object * * > ( * handle ) ; <nl> + * value_ = * reinterpret_cast < internal : : Address * > ( * handle ) ; <nl> } <nl> } <nl> <nl> void ReturnValue < T > : : Set ( const Local < S > handle ) { <nl> if ( V8_UNLIKELY ( handle . IsEmpty ( ) ) ) { <nl> * value_ = GetDefaultValue ( ) ; <nl> } else { <nl> - * value_ = * reinterpret_cast < internal : : Object * * > ( * handle ) ; <nl> + * value_ = * reinterpret_cast < internal : : Address * > ( * handle ) ; <nl> } <nl> } <nl> <nl> void ReturnValue < T > : : Set ( S * whatever ) { <nl> TYPE_CHECK ( S * , Primitive ) ; <nl> } <nl> <nl> - template < typename T > <nl> - internal : : Object * ReturnValue < T > : : GetDefaultValue ( ) { <nl> + template < typename T > <nl> + internal : : Address ReturnValue < T > : : GetDefaultValue ( ) { <nl> / / Default value is always the pointer below value_ on the stack . <nl> return value_ [ - 1 ] ; <nl> } <nl> <nl> template < typename T > <nl> - FunctionCallbackInfo < T > : : FunctionCallbackInfo ( internal : : Object * * implicit_args , <nl> - internal : : Object * * values , <nl> + FunctionCallbackInfo < T > : : FunctionCallbackInfo ( internal : : Address * implicit_args , <nl> + internal : : Address * values , <nl> int length ) <nl> : implicit_args_ ( implicit_args ) , values_ ( values ) , length_ ( length ) { } <nl> <nl> AccessorSignature * AccessorSignature : : Cast ( Data * data ) { <nl> <nl> Local < Value > Object : : GetInternalField ( int index ) { <nl> # ifndef V8_ENABLE_CHECKS <nl> - typedef internal : : Object O ; <nl> + typedef internal : : Address A ; <nl> typedef internal : : Internals I ; <nl> - O * obj = * reinterpret_cast < O * * > ( this ) ; <nl> + A obj = * reinterpret_cast < A * > ( this ) ; <nl> / / Fast path : If the object is a plain JSObject , which is the common case , we <nl> / / know where to find the internal fields and can return the value directly . <nl> auto instance_type = I : : GetInstanceType ( obj ) ; <nl> Local < Value > Object : : GetInternalField ( int index ) { <nl> instance_type = = I : : kJSApiObjectType | | <nl> instance_type = = I : : kJSSpecialApiObjectType ) { <nl> int offset = I : : kJSObjectHeaderSize + ( internal : : kApiPointerSize * index ) ; <nl> - O * value = I : : ReadField < O * > ( obj , offset ) ; <nl> - O * * result = HandleScope : : CreateHandle ( <nl> + A value = I : : ReadField < A > ( obj , offset ) ; <nl> + A * result = HandleScope : : CreateHandle ( <nl> reinterpret_cast < internal : : NeverReadOnlySpaceObject * > ( obj ) , value ) ; <nl> return Local < Value > ( reinterpret_cast < Value * > ( result ) ) ; <nl> } <nl> Local < Value > Object : : GetInternalField ( int index ) { <nl> <nl> void * Object : : GetAlignedPointerFromInternalField ( int index ) { <nl> # ifndef V8_ENABLE_CHECKS <nl> - typedef internal : : Object O ; <nl> + typedef internal : : Address A ; <nl> typedef internal : : Internals I ; <nl> - O * obj = * reinterpret_cast < O * * > ( this ) ; <nl> + A obj = * reinterpret_cast < A * > ( this ) ; <nl> / / Fast path : If the object is a plain JSObject , which is the common case , we <nl> / / know where to find the internal fields and can return the value directly . <nl> auto instance_type = I : : GetInstanceType ( obj ) ; <nl> String * String : : Cast ( v8 : : Value * value ) { <nl> <nl> <nl> Local < String > String : : Empty ( Isolate * isolate ) { <nl> - typedef internal : : Object * S ; <nl> + typedef internal : : Address S ; <nl> typedef internal : : Internals I ; <nl> I : : CheckInitialized ( isolate ) ; <nl> S * slot = I : : GetRoot ( isolate , I : : kEmptyStringRootIndex ) ; <nl> Local < String > String : : Empty ( Isolate * isolate ) { <nl> <nl> <nl> String : : ExternalStringResource * String : : GetExternalStringResource ( ) const { <nl> - typedef internal : : Object O ; <nl> + typedef internal : : Address A ; <nl> typedef internal : : Internals I ; <nl> - O * obj = * reinterpret_cast < O * const * > ( this ) ; <nl> + A obj = * reinterpret_cast < const A * > ( this ) ; <nl> <nl> ExternalStringResource * result ; <nl> if ( I : : IsExternalTwoByteString ( I : : GetInstanceType ( obj ) ) ) { <nl> String : : ExternalStringResource * String : : GetExternalStringResource ( ) const { <nl> <nl> String : : ExternalStringResourceBase * String : : GetExternalStringResourceBase ( <nl> String : : Encoding * encoding_out ) const { <nl> - typedef internal : : Object O ; <nl> + typedef internal : : Address A ; <nl> typedef internal : : Internals I ; <nl> - O * obj = * reinterpret_cast < O * const * > ( this ) ; <nl> + A obj = * reinterpret_cast < const A * > ( this ) ; <nl> int type = I : : GetInstanceType ( obj ) & I : : kFullStringRepresentationMask ; <nl> * encoding_out = static_cast < Encoding > ( type & I : : kStringEncodingMask ) ; <nl> ExternalStringResourceBase * resource ; <nl> bool Value : : IsUndefined ( ) const { <nl> } <nl> <nl> bool Value : : QuickIsUndefined ( ) const { <nl> - typedef internal : : Object O ; <nl> + typedef internal : : Address A ; <nl> typedef internal : : Internals I ; <nl> - O * obj = * reinterpret_cast < O * const * > ( this ) ; <nl> + A obj = * reinterpret_cast < const A * > ( this ) ; <nl> if ( ! I : : HasHeapObjectTag ( obj ) ) return false ; <nl> if ( I : : GetInstanceType ( obj ) ! = I : : kOddballType ) return false ; <nl> return ( I : : GetOddballKind ( obj ) = = I : : kUndefinedOddballKind ) ; <nl> bool Value : : IsNull ( ) const { <nl> } <nl> <nl> bool Value : : QuickIsNull ( ) const { <nl> - typedef internal : : Object O ; <nl> + typedef internal : : Address A ; <nl> typedef internal : : Internals I ; <nl> - O * obj = * reinterpret_cast < O * const * > ( this ) ; <nl> + A obj = * reinterpret_cast < const A * > ( this ) ; <nl> if ( ! I : : HasHeapObjectTag ( obj ) ) return false ; <nl> if ( I : : GetInstanceType ( obj ) ! = I : : kOddballType ) return false ; <nl> return ( I : : GetOddballKind ( obj ) = = I : : kNullOddballKind ) ; <nl> bool Value : : IsNullOrUndefined ( ) const { <nl> } <nl> <nl> bool Value : : QuickIsNullOrUndefined ( ) const { <nl> - typedef internal : : Object O ; <nl> + typedef internal : : Address A ; <nl> typedef internal : : Internals I ; <nl> - O * obj = * reinterpret_cast < O * const * > ( this ) ; <nl> + A obj = * reinterpret_cast < const A * > ( this ) ; <nl> if ( ! I : : HasHeapObjectTag ( obj ) ) return false ; <nl> if ( I : : GetInstanceType ( obj ) ! = I : : kOddballType ) return false ; <nl> int kind = I : : GetOddballKind ( obj ) ; <nl> bool Value : : IsString ( ) const { <nl> } <nl> <nl> bool Value : : QuickIsString ( ) const { <nl> - typedef internal : : Object O ; <nl> + typedef internal : : Address A ; <nl> typedef internal : : Internals I ; <nl> - O * obj = * reinterpret_cast < O * const * > ( this ) ; <nl> + A obj = * reinterpret_cast < const A * > ( this ) ; <nl> if ( ! I : : HasHeapObjectTag ( obj ) ) return false ; <nl> return ( I : : GetInstanceType ( obj ) < I : : kFirstNonstringType ) ; <nl> } <nl> bool PropertyCallbackInfo < T > : : ShouldThrowOnError ( ) const { <nl> <nl> <nl> Local < Primitive > Undefined ( Isolate * isolate ) { <nl> - typedef internal : : Object * S ; <nl> + typedef internal : : Address S ; <nl> typedef internal : : Internals I ; <nl> I : : CheckInitialized ( isolate ) ; <nl> S * slot = I : : GetRoot ( isolate , I : : kUndefinedValueRootIndex ) ; <nl> Local < Primitive > Undefined ( Isolate * isolate ) { <nl> <nl> <nl> Local < Primitive > Null ( Isolate * isolate ) { <nl> - typedef internal : : Object * S ; <nl> + typedef internal : : Address S ; <nl> typedef internal : : Internals I ; <nl> I : : CheckInitialized ( isolate ) ; <nl> S * slot = I : : GetRoot ( isolate , I : : kNullValueRootIndex ) ; <nl> Local < Primitive > Null ( Isolate * isolate ) { <nl> <nl> <nl> Local < Boolean > True ( Isolate * isolate ) { <nl> - typedef internal : : Object * S ; <nl> + typedef internal : : Address S ; <nl> typedef internal : : Internals I ; <nl> I : : CheckInitialized ( isolate ) ; <nl> S * slot = I : : GetRoot ( isolate , I : : kTrueValueRootIndex ) ; <nl> Local < Boolean > True ( Isolate * isolate ) { <nl> <nl> <nl> Local < Boolean > False ( Isolate * isolate ) { <nl> - typedef internal : : Object * S ; <nl> + typedef internal : : Address S ; <nl> typedef internal : : Internals I ; <nl> I : : CheckInitialized ( isolate ) ; <nl> S * slot = I : : GetRoot ( isolate , I : : kFalseValueRootIndex ) ; <nl> int64_t Isolate : : AdjustAmountOfExternalAllocatedMemory ( <nl> <nl> Local < Value > Context : : GetEmbedderData ( int index ) { <nl> # ifndef V8_ENABLE_CHECKS <nl> - typedef internal : : Object O ; <nl> + typedef internal : : Address A ; <nl> typedef internal : : Internals I ; <nl> auto * context = * reinterpret_cast < internal : : NeverReadOnlySpaceObject * * > ( this ) ; <nl> - O * * result = <nl> - HandleScope : : CreateHandle ( context , I : : ReadEmbedderData < O * > ( this , index ) ) ; <nl> + A * result = <nl> + HandleScope : : CreateHandle ( context , I : : ReadEmbedderData < A > ( this , index ) ) ; <nl> return Local < Value > ( reinterpret_cast < Value * > ( result ) ) ; <nl> # else <nl> return SlowGetEmbedderData ( index ) ; <nl> MaybeLocal < T > Context : : GetDataFromSnapshotOnce ( size_t index ) { <nl> template < class T > <nl> size_t SnapshotCreator : : AddData ( Local < Context > context , Local < T > object ) { <nl> T * object_ptr = * object ; <nl> - internal : : Object * * p = reinterpret_cast < internal : : Object * * > ( object_ptr ) ; <nl> + internal : : Address * p = reinterpret_cast < internal : : Address * > ( object_ptr ) ; <nl> return AddData ( context , * p ) ; <nl> } <nl> <nl> template < class T > <nl> size_t SnapshotCreator : : AddData ( Local < T > object ) { <nl> T * object_ptr = * object ; <nl> - internal : : Object * * p = reinterpret_cast < internal : : Object * * > ( object_ptr ) ; <nl> + internal : : Address * p = reinterpret_cast < internal : : Address * > ( object_ptr ) ; <nl> return AddData ( * p ) ; <nl> } <nl> <nl> mmm a / src / api - arguments - inl . h <nl> ppp b / src / api - arguments - inl . h <nl> inline JSObject * FunctionCallbackArguments : : holder ( ) { <nl> } \ <nl> VMState < EXTERNAL > state ( ISOLATE ) ; \ <nl> ExternalCallbackScope call_scope ( ISOLATE , FUNCTION_ADDR ( F ) ) ; \ <nl> - PropertyCallbackInfo < API_RETURN_TYPE > callback_info ( begin ( ) ) ; <nl> + PropertyCallbackInfo < API_RETURN_TYPE > callback_info ( \ <nl> + reinterpret_cast < Address * > ( begin ( ) ) ) ; <nl> <nl> # define PREPARE_CALLBACK_INFO_FAIL_SIDE_EFFECT_CHECK ( ISOLATE , F , RETURN_VALUE , \ <nl> API_RETURN_TYPE ) \ <nl> inline JSObject * FunctionCallbackArguments : : holder ( ) { <nl> } \ <nl> VMState < EXTERNAL > state ( ISOLATE ) ; \ <nl> ExternalCallbackScope call_scope ( ISOLATE , FUNCTION_ADDR ( F ) ) ; \ <nl> - PropertyCallbackInfo < API_RETURN_TYPE > callback_info ( begin ( ) ) ; <nl> + PropertyCallbackInfo < API_RETURN_TYPE > callback_info ( \ <nl> + reinterpret_cast < Address * > ( begin ( ) ) ) ; <nl> <nl> # define CREATE_NAMED_CALLBACK ( FUNCTION , TYPE , RETURN_TYPE , API_RETURN_TYPE , \ <nl> INFO_FOR_SIDE_EFFECT ) \ <nl> Handle < Object > FunctionCallbackArguments : : Call ( CallHandlerInfo * handler ) { <nl> } <nl> VMState < EXTERNAL > state ( isolate ) ; <nl> ExternalCallbackScope call_scope ( isolate , FUNCTION_ADDR ( f ) ) ; <nl> - FunctionCallbackInfo < v8 : : Value > info ( begin ( ) , argv_ , argc_ ) ; <nl> + FunctionCallbackInfo < v8 : : Value > info ( reinterpret_cast < Address * > ( begin ( ) ) , <nl> + reinterpret_cast < Address * > ( argv_ ) , <nl> + argc_ ) ; <nl> f ( info ) ; <nl> return GetReturnValue < Object > ( isolate ) ; <nl> } <nl> mmm a / src / api . cc <nl> ppp b / src / api . cc <nl> size_t SnapshotCreator : : AddTemplate ( Local < Template > template_obj ) { <nl> return AddData ( template_obj ) ; <nl> } <nl> <nl> - size_t SnapshotCreator : : AddData ( i : : Object * object ) { <nl> - DCHECK_NOT_NULL ( object ) ; <nl> + size_t SnapshotCreator : : AddData ( i : : Address object ) { <nl> + DCHECK_NE ( object , i : : kNullAddress ) ; <nl> SnapshotCreatorData * data = SnapshotCreatorData : : cast ( data_ ) ; <nl> DCHECK ( ! data - > created_ ) ; <nl> i : : Isolate * isolate = reinterpret_cast < i : : Isolate * > ( data - > isolate_ ) ; <nl> i : : HandleScope scope ( isolate ) ; <nl> - i : : Handle < i : : Object > obj ( object , isolate ) ; <nl> + i : : Handle < i : : Object > obj ( reinterpret_cast < i : : Object * > ( object ) , isolate ) ; <nl> i : : Handle < i : : ArrayList > list ; <nl> if ( ! isolate - > heap ( ) - > serialized_objects ( ) - > IsArrayList ( ) ) { <nl> list = i : : ArrayList : : New ( isolate , 1 ) ; <nl> size_t SnapshotCreator : : AddData ( i : : Object * object ) { <nl> return index ; <nl> } <nl> <nl> - size_t SnapshotCreator : : AddData ( Local < Context > context , i : : Object * object ) { <nl> - DCHECK_NOT_NULL ( object ) ; <nl> + size_t SnapshotCreator : : AddData ( Local < Context > context , i : : Address object ) { <nl> + DCHECK_NE ( object , i : : kNullAddress ) ; <nl> DCHECK ( ! SnapshotCreatorData : : cast ( data_ ) - > created_ ) ; <nl> i : : Handle < i : : Context > ctx = Utils : : OpenHandle ( * context ) ; <nl> i : : Isolate * isolate = ctx - > GetIsolate ( ) ; <nl> i : : HandleScope scope ( isolate ) ; <nl> - i : : Handle < i : : Object > obj ( object , isolate ) ; <nl> + i : : Handle < i : : Object > obj ( reinterpret_cast < i : : Object * > ( object ) , isolate ) ; <nl> i : : Handle < i : : ArrayList > list ; <nl> if ( ! ctx - > serialized_objects ( ) - > IsArrayList ( ) ) { <nl> list = i : : ArrayList : : New ( isolate , 1 ) ; <nl> void SetResourceConstraints ( i : : Isolate * isolate , <nl> } <nl> } <nl> <nl> - <nl> - i : : Object * * V8 : : GlobalizeReference ( i : : Isolate * isolate , i : : Object * * obj ) { <nl> + i : : Address * V8 : : GlobalizeReference ( i : : Isolate * isolate , i : : Address * obj ) { <nl> LOG_API ( isolate , Persistent , New ) ; <nl> i : : Handle < i : : Object > result = isolate - > global_handles ( ) - > Create ( * obj ) ; <nl> # ifdef VERIFY_HEAP <nl> if ( i : : FLAG_verify_heap ) { <nl> - ( * obj ) - > ObjectVerify ( isolate ) ; <nl> + reinterpret_cast < i : : Object * > ( * obj ) - > ObjectVerify ( isolate ) ; <nl> } <nl> # endif / / VERIFY_HEAP <nl> - return result . location ( ) ; <nl> + return result . location_as_address_ptr ( ) ; <nl> } <nl> <nl> - <nl> - i : : Object * * V8 : : CopyPersistent ( i : : Object * * obj ) { <nl> + i : : Address * V8 : : CopyPersistent ( i : : Address * obj ) { <nl> i : : Handle < i : : Object > result = i : : GlobalHandles : : CopyGlobal ( obj ) ; <nl> - return result . location ( ) ; <nl> + return result . location_as_address_ptr ( ) ; <nl> } <nl> <nl> - void V8 : : RegisterExternallyReferencedObject ( i : : Object * * object , <nl> + void V8 : : RegisterExternallyReferencedObject ( i : : Address * location , <nl> i : : Isolate * isolate ) { <nl> - isolate - > heap ( ) - > RegisterExternallyReferencedObject ( object ) ; <nl> - } <nl> - <nl> - void V8 : : MakeWeak ( i : : Object * * location , void * parameter , <nl> - int embedder_field_index1 , int embedder_field_index2 , <nl> - WeakCallbackInfo < void > : : Callback weak_callback ) { <nl> - WeakCallbackType type = WeakCallbackType : : kParameter ; <nl> - if ( embedder_field_index1 = = 0 ) { <nl> - if ( embedder_field_index2 = = 1 ) { <nl> - type = WeakCallbackType : : kInternalFields ; <nl> - } else { <nl> - DCHECK_EQ ( embedder_field_index2 , - 1 ) ; <nl> - type = WeakCallbackType : : kInternalFields ; <nl> - } <nl> - } else { <nl> - DCHECK_EQ ( embedder_field_index1 , - 1 ) ; <nl> - DCHECK_EQ ( embedder_field_index2 , - 1 ) ; <nl> - } <nl> - i : : GlobalHandles : : MakeWeak ( location , parameter , weak_callback , type ) ; <nl> + isolate - > heap ( ) - > RegisterExternallyReferencedObject ( location ) ; <nl> } <nl> <nl> - void V8 : : MakeWeak ( i : : Object * * location , void * parameter , <nl> + void V8 : : MakeWeak ( i : : Address * location , void * parameter , <nl> WeakCallbackInfo < void > : : Callback weak_callback , <nl> WeakCallbackType type ) { <nl> i : : GlobalHandles : : MakeWeak ( location , parameter , weak_callback , type ) ; <nl> } <nl> <nl> - void V8 : : MakeWeak ( i : : Object * * * location_addr ) { <nl> + void V8 : : MakeWeak ( i : : Address * * location_addr ) { <nl> i : : GlobalHandles : : MakeWeak ( location_addr ) ; <nl> } <nl> <nl> - void * V8 : : ClearWeak ( i : : Object * * location ) { <nl> + void * V8 : : ClearWeak ( i : : Address * location ) { <nl> return i : : GlobalHandles : : ClearWeakness ( location ) ; <nl> } <nl> <nl> - void V8 : : AnnotateStrongRetainer ( i : : Object * * location , const char * label ) { <nl> + void V8 : : AnnotateStrongRetainer ( i : : Address * location , const char * label ) { <nl> i : : GlobalHandles : : AnnotateStrongRetainer ( location , label ) ; <nl> } <nl> <nl> - void V8 : : DisposeGlobal ( i : : Object * * location ) { <nl> + void V8 : : DisposeGlobal ( i : : Address * location ) { <nl> i : : GlobalHandles : : Destroy ( location ) ; <nl> } <nl> <nl> void HandleScope : : Initialize ( Isolate * isolate ) { <nl> " Entering the V8 API without proper locking in place " ) ; <nl> i : : HandleScopeData * current = internal_isolate - > handle_scope_data ( ) ; <nl> isolate_ = internal_isolate ; <nl> - prev_next_ = current - > next ; <nl> - prev_limit_ = current - > limit ; <nl> + prev_next_ = reinterpret_cast < i : : Address * > ( current - > next ) ; <nl> + prev_limit_ = reinterpret_cast < i : : Address * > ( current - > limit ) ; <nl> current - > level + + ; <nl> } <nl> <nl> <nl> HandleScope : : ~ HandleScope ( ) { <nl> - i : : HandleScope : : CloseScope ( isolate_ , prev_next_ , prev_limit_ ) ; <nl> + i : : HandleScope : : CloseScope ( isolate_ , <nl> + reinterpret_cast < i : : Object * * > ( prev_next_ ) , <nl> + reinterpret_cast < i : : Object * * > ( prev_limit_ ) ) ; <nl> } <nl> <nl> void * HandleScope : : operator new ( size_t ) { base : : OS : : Abort ( ) ; } <nl> int HandleScope : : NumberOfHandles ( Isolate * isolate ) { <nl> reinterpret_cast < i : : Isolate * > ( isolate ) ) ; <nl> } <nl> <nl> - <nl> - i : : Object * * HandleScope : : CreateHandle ( i : : Isolate * isolate , i : : Object * value ) { <nl> + i : : Address * HandleScope : : CreateHandle ( i : : Isolate * isolate , i : : Address value ) { <nl> return i : : HandleScope : : CreateHandle ( isolate , value ) ; <nl> } <nl> <nl> - i : : Object * * HandleScope : : CreateHandle ( <nl> - i : : NeverReadOnlySpaceObject * writable_object , i : : Object * value ) { <nl> + i : : Address * HandleScope : : CreateHandle ( <nl> + i : : NeverReadOnlySpaceObject * writable_object , i : : Address value ) { <nl> DCHECK ( reinterpret_cast < i : : HeapObject * > ( writable_object ) - > IsHeapObject ( ) ) ; <nl> return i : : HandleScope : : CreateHandle ( writable_object - > GetIsolate ( ) , value ) ; <nl> } <nl> i : : Object * * HandleScope : : CreateHandle ( <nl> <nl> EscapableHandleScope : : EscapableHandleScope ( Isolate * v8_isolate ) { <nl> i : : Isolate * isolate = reinterpret_cast < i : : Isolate * > ( v8_isolate ) ; <nl> - escape_slot_ = <nl> - CreateHandle ( isolate , i : : ReadOnlyRoots ( isolate ) . the_hole_value ( ) ) ; <nl> + escape_slot_ = CreateHandle ( <nl> + isolate , <nl> + reinterpret_cast < i : : Address > ( i : : ReadOnlyRoots ( isolate ) . the_hole_value ( ) ) ) ; <nl> Initialize ( v8_isolate ) ; <nl> } <nl> <nl> - <nl> - i : : Object * * EscapableHandleScope : : Escape ( i : : Object * * escape_value ) { <nl> + i : : Address * EscapableHandleScope : : Escape ( i : : Address * escape_value ) { <nl> i : : Heap * heap = reinterpret_cast < i : : Isolate * > ( GetIsolate ( ) ) - > heap ( ) ; <nl> - Utils : : ApiCheck ( ( * escape_slot_ ) - > IsTheHole ( heap - > isolate ( ) ) , <nl> - " EscapableHandleScope : : Escape " , " Escape value set twice " ) ; <nl> + Utils : : ApiCheck ( <nl> + reinterpret_cast < i : : Object * > ( * escape_slot_ ) - > IsTheHole ( heap - > isolate ( ) ) , <nl> + " EscapableHandleScope : : Escape " , " Escape value set twice " ) ; <nl> if ( escape_value = = nullptr ) { <nl> - * escape_slot_ = i : : ReadOnlyRoots ( heap ) . undefined_value ( ) ; <nl> + * escape_slot_ = <nl> + reinterpret_cast < i : : Address > ( i : : ReadOnlyRoots ( heap ) . undefined_value ( ) ) ; <nl> return nullptr ; <nl> } <nl> * escape_slot_ = * escape_value ; <nl> void EscapableHandleScope : : operator delete [ ] ( void * , size_t ) { <nl> SealHandleScope : : SealHandleScope ( Isolate * isolate ) <nl> : isolate_ ( reinterpret_cast < i : : Isolate * > ( isolate ) ) { <nl> i : : HandleScopeData * current = isolate_ - > handle_scope_data ( ) ; <nl> - prev_limit_ = current - > limit ; <nl> + prev_limit_ = reinterpret_cast < i : : Address * > ( current - > limit ) ; <nl> current - > limit = current - > next ; <nl> prev_sealed_level_ = current - > sealed_level ; <nl> current - > sealed_level = current - > level ; <nl> SealHandleScope : : SealHandleScope ( Isolate * isolate ) <nl> SealHandleScope : : ~ SealHandleScope ( ) { <nl> i : : HandleScopeData * current = isolate_ - > handle_scope_data ( ) ; <nl> DCHECK_EQ ( current - > next , current - > limit ) ; <nl> - current - > limit = prev_limit_ ; <nl> + current - > limit = reinterpret_cast < i : : Object * * > ( prev_limit_ ) ; <nl> DCHECK_EQ ( current - > level , current - > sealed_level ) ; <nl> current - > sealed_level = prev_sealed_level_ ; <nl> } <nl> void v8 : : String : : VerifyExternalStringResourceBase ( <nl> String : : ExternalStringResource * String : : GetExternalStringResourceSlow ( ) const { <nl> i : : DisallowHeapAllocation no_allocation ; <nl> typedef internal : : Internals I ; <nl> - ExternalStringResource * result = nullptr ; <nl> i : : String * str = * Utils : : OpenHandle ( this ) ; <nl> <nl> if ( str - > IsThinString ( ) ) { <nl> String : : ExternalStringResource * String : : GetExternalStringResourceSlow ( ) const { <nl> } <nl> <nl> if ( i : : StringShape ( str ) . IsExternalTwoByte ( ) ) { <nl> - void * value = I : : ReadField < void * > ( str , I : : kStringResourceOffset ) ; <nl> - result = reinterpret_cast < String : : ExternalStringResource * > ( value ) ; <nl> + void * value = I : : ReadField < void * > ( reinterpret_cast < i : : Address > ( str ) , <nl> + I : : kStringResourceOffset ) ; <nl> + return reinterpret_cast < String : : ExternalStringResource * > ( value ) ; <nl> } <nl> - return result ; <nl> + return nullptr ; <nl> } <nl> <nl> String : : ExternalStringResourceBase * String : : GetExternalStringResourceBaseSlow ( <nl> String : : ExternalStringResourceBase * String : : GetExternalStringResourceBaseSlow ( <nl> str = i : : ThinString : : cast ( str ) - > actual ( ) ; <nl> } <nl> <nl> - int type = I : : GetInstanceType ( str ) & I : : kFullStringRepresentationMask ; <nl> + internal : : Address string = reinterpret_cast < internal : : Address > ( str ) ; <nl> + int type = I : : GetInstanceType ( string ) & I : : kFullStringRepresentationMask ; <nl> * encoding_out = static_cast < Encoding > ( type & I : : kStringEncodingMask ) ; <nl> if ( i : : StringShape ( str ) . IsExternalOneByte ( ) | | <nl> i : : StringShape ( str ) . IsExternalTwoByte ( ) ) { <nl> - void * value = I : : ReadField < void * > ( str , I : : kStringResourceOffset ) ; <nl> + void * value = I : : ReadField < void * > ( string , I : : kStringResourceOffset ) ; <nl> resource = static_cast < ExternalStringResourceBase * > ( value ) ; <nl> } <nl> return resource ; <nl> } <nl> <nl> - const String : : ExternalOneByteStringResource * <nl> - String : : GetExternalOneByteStringResourceSlow ( ) const { <nl> - i : : DisallowHeapAllocation no_allocation ; <nl> - i : : String * str = * Utils : : OpenHandle ( this ) ; <nl> - <nl> - if ( str - > IsThinString ( ) ) { <nl> - str = i : : ThinString : : cast ( str ) - > actual ( ) ; <nl> - } <nl> - <nl> - if ( i : : StringShape ( str ) . IsExternalOneByte ( ) ) { <nl> - const void * resource = i : : ExternalOneByteString : : cast ( str ) - > resource ( ) ; <nl> - return reinterpret_cast < const ExternalOneByteStringResource * > ( resource ) ; <nl> - } <nl> - return nullptr ; <nl> - } <nl> - <nl> const v8 : : String : : ExternalOneByteStringResource * <nl> v8 : : String : : GetExternalOneByteStringResource ( ) const { <nl> i : : DisallowHeapAllocation no_allocation ; <nl> i : : String * str = * Utils : : OpenHandle ( this ) ; <nl> if ( i : : StringShape ( str ) . IsExternalOneByte ( ) ) { <nl> - const void * resource = i : : ExternalOneByteString : : cast ( str ) - > resource ( ) ; <nl> - return reinterpret_cast < const ExternalOneByteStringResource * > ( resource ) ; <nl> - } else { <nl> - return GetExternalOneByteStringResourceSlow ( ) ; <nl> + return i : : ExternalOneByteString : : cast ( str ) - > resource ( ) ; <nl> + } else if ( str - > IsThinString ( ) ) { <nl> + str = i : : ThinString : : cast ( str ) - > actual ( ) ; <nl> + if ( i : : StringShape ( str ) . IsExternalOneByte ( ) ) { <nl> + return i : : ExternalOneByteString : : cast ( str ) - > resource ( ) ; <nl> + } <nl> } <nl> + return nullptr ; <nl> } <nl> <nl> <nl> void Context : : SetErrorMessageForCodeGenerationFromStrings ( Local < String > error ) { <nl> } <nl> <nl> namespace { <nl> - i : : Object * * GetSerializedDataFromFixedArray ( i : : Isolate * isolate , <nl> + i : : Address * GetSerializedDataFromFixedArray ( i : : Isolate * isolate , <nl> i : : FixedArray * list , size_t index ) { <nl> if ( index < static_cast < size_t > ( list - > length ( ) ) ) { <nl> int int_index = static_cast < int > ( index ) ; <nl> i : : Object * * GetSerializedDataFromFixedArray ( i : : Isolate * isolate , <nl> int last = list - > length ( ) - 1 ; <nl> while ( last > = 0 & & list - > is_the_hole ( isolate , last ) ) last - - ; <nl> if ( last ! = - 1 ) list - > Shrink ( isolate , last + 1 ) ; <nl> - return i : : Handle < i : : Object > ( object , isolate ) . location ( ) ; <nl> + return i : : Handle < i : : Object > ( object , isolate ) . location_as_address_ptr ( ) ; <nl> } <nl> } <nl> return nullptr ; <nl> } <nl> } / / anonymous namespace <nl> <nl> - i : : Object * * Context : : GetDataFromSnapshotOnce ( size_t index ) { <nl> + i : : Address * Context : : GetDataFromSnapshotOnce ( size_t index ) { <nl> auto context = Utils : : OpenHandle ( this ) ; <nl> i : : Isolate * i_isolate = context - > GetIsolate ( ) ; <nl> i : : FixedArray * list = context - > serialized_objects ( ) ; <nl> Isolate : : SafeForTerminationScope : : ~ SafeForTerminationScope ( ) { <nl> isolate_ - > set_next_v8_call_is_safe_for_termination ( prev_value_ ) ; <nl> } <nl> <nl> - i : : Object * * Isolate : : GetDataFromSnapshotOnce ( size_t index ) { <nl> + i : : Address * Isolate : : GetDataFromSnapshotOnce ( size_t index ) { <nl> i : : Isolate * i_isolate = reinterpret_cast < i : : Isolate * > ( this ) ; <nl> i : : FixedArray * list = i_isolate - > heap ( ) - > serialized_objects ( ) ; <nl> return GetSerializedDataFromFixedArray ( i_isolate , list , index ) ; <nl> debug : : ConsoleCallArguments : : ConsoleCallArguments ( <nl> <nl> debug : : ConsoleCallArguments : : ConsoleCallArguments ( <nl> internal : : BuiltinArguments & args ) <nl> - : v8 : : FunctionCallbackInfo < v8 : : Value > ( nullptr , & args [ 0 ] - 1 , <nl> - args . length ( ) - 1 ) { } <nl> + : v8 : : FunctionCallbackInfo < v8 : : Value > ( <nl> + / / Drop the first argument ( receiver , i . e . the " console " object ) . <nl> + nullptr , <nl> + reinterpret_cast < i : : Address * > ( & args [ args . length ( ) > 1 ? 1 : 0 ] ) , <nl> + args . length ( ) - 1 ) { } <nl> <nl> int debug : : GetStackFrameId ( v8 : : Local < v8 : : StackFrame > frame ) { <nl> return Utils : : OpenHandle ( * frame ) - > id ( ) ; <nl> mmm a / src / global - handles . cc <nl> ppp b / src / global - handles . cc <nl> Handle < Object > GlobalHandles : : Create ( Object * value ) { <nl> return result - > handle ( ) ; <nl> } <nl> <nl> + Handle < Object > GlobalHandles : : Create ( Address value ) { <nl> + return Create ( reinterpret_cast < Object * > ( value ) ) ; <nl> + } <nl> <nl> - Handle < Object > GlobalHandles : : CopyGlobal ( Object * * location ) { <nl> + Handle < Object > GlobalHandles : : CopyGlobal ( Address * location ) { <nl> DCHECK_NOT_NULL ( location ) ; <nl> GlobalHandles * global_handles = <nl> - Node : : FromLocation ( location ) - > GetGlobalHandles ( ) ; <nl> + Node : : FromLocation ( reinterpret_cast < Object * * > ( location ) ) <nl> + - > GetGlobalHandles ( ) ; <nl> # ifdef VERIFY_HEAP <nl> if ( i : : FLAG_verify_heap ) { <nl> - ( * location ) - > ObjectVerify ( global_handles - > isolate ( ) ) ; <nl> + ( * reinterpret_cast < Object * * > ( location ) ) <nl> + - > ObjectVerify ( global_handles - > isolate ( ) ) ; <nl> } <nl> # endif / / VERIFY_HEAP <nl> return global_handles - > Create ( * location ) ; <nl> } <nl> <nl> - <nl> void GlobalHandles : : Destroy ( Object * * location ) { <nl> if ( location ! = nullptr ) Node : : FromLocation ( location ) - > Release ( ) ; <nl> } <nl> <nl> + void GlobalHandles : : Destroy ( Address * location ) { <nl> + Destroy ( reinterpret_cast < Object * * > ( location ) ) ; <nl> + } <nl> <nl> typedef v8 : : WeakCallbackInfo < void > : : Callback GenericCallback ; <nl> <nl> void GlobalHandles : : MakeWeak ( Object * * location , void * parameter , <nl> Node : : FromLocation ( location ) - > MakeWeak ( parameter , phantom_callback , type ) ; <nl> } <nl> <nl> + void GlobalHandles : : MakeWeak ( Address * location , void * parameter , <nl> + GenericCallback phantom_callback , <nl> + v8 : : WeakCallbackType type ) { <nl> + Node : : FromLocation ( reinterpret_cast < Object * * > ( location ) ) <nl> + - > MakeWeak ( parameter , phantom_callback , type ) ; <nl> + } <nl> + <nl> void GlobalHandles : : MakeWeak ( Object * * * location_addr ) { <nl> Node : : FromLocation ( * location_addr ) - > MakeWeak ( location_addr ) ; <nl> } <nl> <nl> - void * GlobalHandles : : ClearWeakness ( Object * * location ) { <nl> - return Node : : FromLocation ( location ) - > ClearWeakness ( ) ; <nl> + void GlobalHandles : : MakeWeak ( Address * * location_addr ) { <nl> + MakeWeak ( reinterpret_cast < Object * * * > ( location_addr ) ) ; <nl> + } <nl> + <nl> + void * GlobalHandles : : ClearWeakness ( Address * location ) { <nl> + return Node : : FromLocation ( reinterpret_cast < Object * * > ( location ) ) <nl> + - > ClearWeakness ( ) ; <nl> } <nl> <nl> void GlobalHandles : : AnnotateStrongRetainer ( Object * * location , <nl> void GlobalHandles : : AnnotateStrongRetainer ( Object * * location , <nl> Node : : FromLocation ( location ) - > AnnotateStrongRetainer ( label ) ; <nl> } <nl> <nl> + void GlobalHandles : : AnnotateStrongRetainer ( Address * location , <nl> + const char * label ) { <nl> + Node : : FromLocation ( reinterpret_cast < Object * * > ( location ) ) <nl> + - > AnnotateStrongRetainer ( label ) ; <nl> + } <nl> + <nl> bool GlobalHandles : : IsNearDeath ( Object * * location ) { <nl> return Node : : FromLocation ( location ) - > IsNearDeath ( ) ; <nl> } <nl> mmm a / src / global - handles . h <nl> ppp b / src / global - handles . h <nl> class GlobalHandles { <nl> <nl> / / Creates a new global handle that is alive until Destroy is called . <nl> Handle < Object > Create ( Object * value ) ; <nl> + / / TODO ( jkummerow ) : This and the other Object * / Address overloads below are <nl> + / / temporary . Eventually the respective Object * version should go away . <nl> + Handle < Object > Create ( Address value ) ; <nl> <nl> template < typename T > <nl> Handle < T > Create ( T * value ) { <nl> class GlobalHandles { <nl> } <nl> <nl> / / Copy a global handle <nl> - static Handle < Object > CopyGlobal ( Object * * location ) ; <nl> + static Handle < Object > CopyGlobal ( Address * location ) ; <nl> <nl> / / Destroy a global handle . <nl> static void Destroy ( Object * * location ) ; <nl> + static void Destroy ( Address * location ) ; <nl> <nl> / / Make the global handle weak and set the callback parameter for the <nl> / / handle . When the garbage collector recognizes that only weak global <nl> class GlobalHandles { <nl> static void MakeWeak ( Object * * location , void * parameter , <nl> WeakCallbackInfo < void > : : Callback weak_callback , <nl> v8 : : WeakCallbackType type ) ; <nl> + static void MakeWeak ( Address * location , void * parameter , <nl> + WeakCallbackInfo < void > : : Callback weak_callback , <nl> + v8 : : WeakCallbackType type ) ; <nl> <nl> static void MakeWeak ( Object * * * location_addr ) ; <nl> + static void MakeWeak ( Address * * location_addr ) ; <nl> <nl> static void AnnotateStrongRetainer ( Object * * location , const char * label ) ; <nl> + static void AnnotateStrongRetainer ( Address * location , const char * label ) ; <nl> <nl> void RecordStats ( HeapStats * stats ) ; <nl> <nl> class GlobalHandles { <nl> size_t NumberOfNewSpaceNodes ( ) { return new_space_nodes_ . size ( ) ; } <nl> <nl> / / Clear the weakness of a global handle . <nl> - static void * ClearWeakness ( Object * * location ) ; <nl> + static void * ClearWeakness ( Address * location ) ; <nl> <nl> / / Tells whether global handle is near death . <nl> + / / TODO ( jkummerow ) : This seems to be unused . <nl> static bool IsNearDeath ( Object * * location ) ; <nl> <nl> / / Tells whether global handle is weak . <nl> + / / TODO ( jkummerow ) : This seems to be unused . <nl> static bool IsWeak ( Object * * location ) ; <nl> <nl> / / Process pending weak handles . <nl> mmm a / src / globals . h <nl> ppp b / src / globals . h <nl> class AllStatic { <nl> } ; <nl> <nl> typedef uint8_t byte ; <nl> - typedef uintptr_t Address ; <nl> - static const Address kNullAddress = 0 ; <nl> <nl> / / mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> / / Constants <nl> mmm a / src / handles - inl . h <nl> ppp b / src / handles - inl . h <nl> Object * * HandleScope : : CreateHandle ( Isolate * isolate , Object * value ) { <nl> return result ; <nl> } <nl> <nl> + Address * HandleScope : : CreateHandle ( Isolate * isolate , Address value_address ) { <nl> + DCHECK ( AllowHandleAllocation : : IsAllowed ( ) ) ; <nl> + HandleScopeData * data = isolate - > handle_scope_data ( ) ; <nl> + Address * result = reinterpret_cast < Address * > ( data - > next ) ; <nl> + if ( result = = reinterpret_cast < Address * > ( data - > limit ) ) { <nl> + result = reinterpret_cast < Address * > ( Extend ( isolate ) ) ; <nl> + } <nl> + / / Update the current next field , set the value in the created handle , <nl> + / / and return the result . <nl> + DCHECK_LT ( reinterpret_cast < Address > ( result ) , <nl> + reinterpret_cast < Address > ( data - > limit ) ) ; <nl> + data - > next = reinterpret_cast < Object * * > ( reinterpret_cast < Address > ( result ) + <nl> + sizeof ( Address ) ) ; <nl> + * result = value_address ; <nl> + return result ; <nl> + } <nl> <nl> Object * * HandleScope : : GetHandle ( Isolate * isolate , Object * value ) { <nl> DCHECK ( AllowHandleAllocation : : IsAllowed ( ) ) ; <nl> mmm a / src / handles . h <nl> ppp b / src / handles . h <nl> class Handle final : public HandleBase { <nl> V8_INLINE T * * location ( ) const { <nl> return reinterpret_cast < T * * > ( HandleBase : : location ( ) ) ; <nl> } <nl> + / / TODO ( jkummerow ) : This is temporary ; eventually location ( ) should <nl> + / / return an Address * . <nl> + V8_INLINE Address * location_as_address_ptr ( ) const { <nl> + return reinterpret_cast < Address * > ( HandleBase : : location ( ) ) ; <nl> + } <nl> <nl> template < typename S > <nl> inline static const Handle < T > cast ( Handle < S > that ) ; <nl> class HandleScope { <nl> <nl> / / Creates a new handle with the given value . <nl> V8_INLINE static Object * * CreateHandle ( Isolate * isolate , Object * value ) ; <nl> + V8_INLINE static Address * CreateHandle ( Isolate * isolate , <nl> + Address value_address ) ; <nl> <nl> / / Deallocates any extensions used by the current scope . <nl> V8_EXPORT_PRIVATE static void DeleteExtensions ( Isolate * isolate ) ; <nl> mmm a / src / heap / heap . cc <nl> ppp b / src / heap / heap . cc <nl> Address Heap : : builtin_address ( int index ) { <nl> <nl> void Heap : : set_builtin ( int index , HeapObject * builtin ) { <nl> DCHECK ( Builtins : : IsBuiltinId ( index ) ) ; <nl> - DCHECK ( Internals : : HasHeapObjectTag ( builtin ) ) ; <nl> + DCHECK ( Internals : : HasHeapObjectTag ( reinterpret_cast < Address > ( builtin ) ) ) ; <nl> / / The given builtin may be completely uninitialized thus we cannot check its <nl> / / type here . <nl> builtins_table ( ) [ index ] = builtin ; <nl> void Heap : : TracePossibleWrapper ( JSObject * js_object ) { <nl> } <nl> } <nl> <nl> - void Heap : : RegisterExternallyReferencedObject ( Object * * object ) { <nl> + void Heap : : RegisterExternallyReferencedObject ( Address * location ) { <nl> / / The embedder is not aware of whether numbers are materialized as heap <nl> / / objects are just passed around as Smis . <nl> - if ( ! ( * object ) - > IsHeapObject ( ) ) return ; <nl> - HeapObject * heap_object = HeapObject : : cast ( * object ) ; <nl> + Object * object = * reinterpret_cast < Object * * > ( location ) ; <nl> + if ( ! object - > IsHeapObject ( ) ) return ; <nl> + HeapObject * heap_object = HeapObject : : cast ( object ) ; <nl> DCHECK ( Contains ( heap_object ) ) ; <nl> if ( FLAG_incremental_marking_wrappers & & incremental_marking ( ) - > IsMarking ( ) ) { <nl> incremental_marking ( ) - > WhiteToGreyAndPush ( heap_object ) ; <nl> mmm a / src / heap / heap . h <nl> ppp b / src / heap / heap . h <nl> class Heap { <nl> EmbedderHeapTracer * GetEmbedderHeapTracer ( ) const ; <nl> <nl> void TracePossibleWrapper ( JSObject * js_object ) ; <nl> - void RegisterExternallyReferencedObject ( Object * * object ) ; <nl> + void RegisterExternallyReferencedObject ( Address * location ) ; <nl> void SetEmbedderStackStateForNextFinalizaton ( <nl> EmbedderHeapTracer : : EmbedderStackState stack_state ) ; <nl> <nl> mmm a / src / objects . h <nl> ppp b / src / objects . h <nl> class Object { <nl> / / In objects . h to be usable without objects - inl . h inclusion . <nl> bool Object : : IsSmi ( ) const { return HAS_SMI_TAG ( this ) ; } <nl> bool Object : : IsHeapObject ( ) const { <nl> - DCHECK_EQ ( ! IsSmi ( ) , Internals : : HasHeapObjectTag ( this ) ) ; <nl> + DCHECK_EQ ( ! IsSmi ( ) , <nl> + Internals : : HasHeapObjectTag ( reinterpret_cast < Address > ( this ) ) ) ; <nl> return ! IsSmi ( ) ; <nl> } <nl> <nl> V8_EXPORT_PRIVATE std : : ostream & operator < < ( std : : ostream & os , const Brief & v ) ; <nl> class Smi : public Object { <nl> public : <nl> / / Returns the integer value . <nl> - inline int value ( ) const { return Internals : : SmiValue ( this ) ; } <nl> + inline int value ( ) const { <nl> + return Internals : : SmiValue ( reinterpret_cast < Address > ( this ) ) ; <nl> + } <nl> inline Smi * ToUint32Smi ( ) { <nl> if ( value ( ) < = 0 ) return Smi : : kZero ; <nl> return Smi : : FromInt ( static_cast < uint32_t > ( value ( ) ) ) ; <nl> mmm a / src / objects / maybe - object . h <nl> ppp b / src / objects / maybe - object . h <nl> class HeapObjectReference : public MaybeObject { <nl> <nl> static void Update ( HeapObjectReference * * slot , HeapObject * value ) { <nl> DCHECK ( ! HAS_SMI_TAG ( * slot ) ) ; <nl> - DCHECK ( Internals : : HasHeapObjectTag ( value ) ) ; <nl> + DCHECK ( Internals : : HasHeapObjectTag ( reinterpret_cast < Address > ( value ) ) ) ; <nl> <nl> # ifdef DEBUG <nl> bool weak_before = HasWeakHeapObjectTag ( * slot ) ; <nl> mmm a / src / profiler / tick - sample . cc <nl> ppp b / src / profiler / tick - sample . cc <nl> bool TickSample : : GetStackSample ( Isolate * v8_isolate , RegisterState * regs , <nl> if ( HAS_HEAP_OBJECT_TAG ( bytecode_array ) & & HAS_SMI_TAG ( bytecode_offset ) ) { <nl> frames [ i + + ] = reinterpret_cast < void * > ( <nl> reinterpret_cast < i : : Address > ( bytecode_array ) + <nl> - i : : Internals : : SmiValue ( bytecode_offset ) ) ; <nl> + i : : Internals : : SmiValue ( <nl> + reinterpret_cast < i : : Address > ( bytecode_offset ) ) ) ; <nl> continue ; <nl> } <nl> } <nl> mmm a / src / snapshot / builtin - deserializer - allocator . cc <nl> ppp b / src / snapshot / builtin - deserializer - allocator . cc <nl> Address BuiltinDeserializerAllocator : : Allocate ( AllocationSpace space , <nl> <nl> DCHECK ( Builtins : : IsBuiltinId ( code_object_id ) ) ; <nl> Object * obj = isolate ( ) - > builtins ( ) - > builtin ( code_object_id ) ; <nl> - DCHECK ( Internals : : HasHeapObjectTag ( obj ) ) ; <nl> + DCHECK ( Internals : : HasHeapObjectTag ( reinterpret_cast < Address > ( obj ) ) ) ; <nl> return HeapObject : : cast ( obj ) - > address ( ) ; <nl> } <nl> <nl> | [ ubsan ] Replace internal : : Object references in v8 . h | v8/v8 | a2f182483929c58ebcf9d5667d8ef19ad2db2f26 | 2018-10-16T19:02:21Z |
mmm a / include / swift / SILPasses / Utils / SILInliner . h <nl> ppp b / include / swift / SILPasses / Utils / SILInliner . h <nl> namespace swift { <nl> / / / passes that want to compare against a threshold . <nl> unsigned getFunctionCost ( SILFunction * F , SILFunction * Callee , unsigned Cutoff ) ; <nl> <nl> - / / For now Free is 0 and Expensive is 1 . This can be changed in the future by <nl> - / / adding more categories . <nl> - enum class InlineCost : unsigned { <nl> - Free = 0 , <nl> - Expensive = 1 , <nl> - CannotBeInlined = UINT_MAX , <nl> - } ; <nl> - <nl> - / / / Return the ' cost ' of one instruction . Instructions that are expected to <nl> - / / / disappear at the LLVM IR level are assigned a cost of ' Free ' . <nl> - InlineCost instructionInlineCost ( SILInstruction & I ) ; <nl> - <nl> class SILInliner : public TypeSubstCloner < SILInliner > { <nl> public : <nl> friend class SILVisitor < SILInliner > ; <nl> mmm a / lib / SILPasses / SimplifyCFG . cpp <nl> ppp b / lib / SILPasses / SimplifyCFG . cpp <nl> <nl> # include " swift / SILAnalysis / SimplifyInstruction . h " <nl> # include " swift / SILPasses / Transforms . h " <nl> # include " swift / SILPasses / Utils / Local . h " <nl> - # include " swift / SILPasses / Utils / SILInliner . h " <nl> # include " swift / SILPasses / Utils / SILSSAUpdater . h " <nl> # include " llvm / ADT / SmallPtrSet . h " <nl> # include " llvm / ADT / SmallVector . h " <nl> bool SimplifyCFG : : tryJumpThreading ( BranchInst * BI ) { <nl> for ( auto & Inst : DestBB - > getInstList ( ) ) { <nl> / / This is a really trivial cost model , which is only intended as a starting <nl> / / point . <nl> - if ( instructionInlineCost ( Inst ) ! = InlineCost : : Free ) <nl> - if ( + + Cost = = 4 ) return false ; <nl> + if ( + + Cost = = 4 ) return false ; <nl> <nl> / / If there is an instruction in the block that has used outside the block , <nl> / / duplicating it would require constructing SSA , which we ' re not prepared <nl> mmm a / lib / SILPasses / Utils / SILInliner . cpp <nl> ppp b / lib / SILPasses / Utils / SILInliner . cpp <nl> SILDebugScope * SILInliner : : getOrCreateInlineScope ( SILInstruction * Orig ) { <nl> / / Cost Model <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> <nl> + namespace { <nl> + <nl> + / / For now Free is 0 and Expensive is 1 . This can be changed in the future by <nl> + / / adding more categories . <nl> + enum class InlineCost : unsigned { <nl> + Free = 0 , <nl> + Expensive = 1 , <nl> + CannotBeInlined = UINT_MAX , <nl> + } ; <nl> + <nl> + } / / end anonymous namespace <nl> + <nl> / / / For now just assume that every SIL instruction is one to one with an LLVM <nl> / / / instruction . This is of course very much so not true . <nl> / / / <nl> / / / TODO : Fill this out . <nl> - InlineCost swift : : instructionInlineCost ( SILInstruction & I ) { <nl> + static InlineCost instructionInlineCost ( SILInstruction & I , <nl> + SILFunction * Caller ) { <nl> switch ( I . getKind ( ) ) { <nl> case ValueKind : : BuiltinFunctionRefInst : <nl> case ValueKind : : IntegerLiteralInst : <nl> unsigned swift : : getFunctionCost ( SILFunction * F , SILFunction * Caller , <nl> unsigned Cost = 0 ; <nl> for ( auto & BB : * F ) { <nl> for ( auto & I : BB ) { <nl> - auto ICost = instructionInlineCost ( I ) ; <nl> + auto ICost = instructionInlineCost ( I , Caller ) ; <nl> if ( ICost = = InlineCost : : CannotBeInlined ) <nl> return UINT_MAX ; <nl> <nl> mmm a / test / SILPasses / simplify_cfg . sil <nl> ppp b / test / SILPasses / simplify_cfg . sil <nl> bb7 ( % 6 : $ Builtin . Int64 ) : <nl> return % 7 : $ Int64 <nl> } <nl> <nl> - / / CHECK - LABEL : sil @ simplify_loop_header <nl> - / / CHECK : bb0 : <nl> - / / CHECK : cond_br { { . * } } , bb1 , bb2 ( <nl> - / / CHECK : bb1 : <nl> + / / CHECK - LABEL : simplify_loop_header <nl> + / / CHECK - NOT : switch_enum <nl> + / / CHECK : bb0 <nl> + / / CHECK : br bb1 <nl> + / / CHECK : bb1 <nl> + / / CHECK : cond_br { { . * } } , bb2 , bb3 <nl> + / / CHECK : bb2 : <nl> / / CHECK : return <nl> - / / CHECK : bb2 ( { { . * } } ) : <nl> - / / CHECK : enum $ Optional < Int > , # Optional . Some <nl> - / / CHECK : cond_br { { . * } } , bb1 , bb2 ( <nl> + / / CHECK : bb3 : <nl> + / / CHECK : br bb1 <nl> <nl> sil @ simplify_loop_header : $ @ thin ( ) - > ( ) { <nl> bb0 : <nl> | Revert " SimplifyCFG : Don ' t count ' free ' instructions during jump - threading " | apple/swift | a536a67d12e289c574726d4beb2f9a2a6200b0a5 | 2014-10-14T01:18:51Z |
mmm a / contrib / Joshua / scripts / bindingTestScript . sh <nl> ppp b / contrib / Joshua / scripts / bindingTestScript . sh <nl> SCRIPTID = " $ { $ } " <nl> SAVEONERROR = " $ { SAVEONERROR : - 1 } " <nl> PYTHONDIR = " $ { BINDIR } / tests / python " <nl> testScript = " $ { BINDIR } / tests / bindingtester / run_binding_tester . sh " <nl> - VERSION = " 1 . 8 " <nl> + VERSION = " 1 . 9 " <nl> <nl> source $ { SCRIPTDIR } / localClusterStart . sh <nl> <nl> then <nl> echo " Log dir : $ { LOGDIR } " <nl> echo " Python path : $ { PYTHONDIR } " <nl> echo " Lib dir : $ { LIBDIR } " <nl> - echo " Cluster String : $ { CLUSTERSTRING } " <nl> + echo " Cluster String : $ { FDBCLUSTERTEXT } " <nl> echo " Script Id : $ { SCRIPTID } " <nl> echo " Version : $ { VERSION } " <nl> fi <nl> mmm a / contrib / Joshua / scripts / localClusterStart . sh <nl> ppp b / contrib / Joshua / scripts / localClusterStart . sh <nl> LOGDIR = " $ { WORKDIR } / log " <nl> ETCDIR = " $ { WORKDIR } / etc " <nl> BINDIR = " $ { BINDIR : - $ { SCRIPTDIR } } " <nl> FDBPORTSTART = " $ { FDBPORTSTART : - 4000 } " <nl> + FDBPORTTOTAL = " $ { FDBPORTTOTAL : - 1000 } " <nl> SERVERCHECKS = " $ { SERVERCHECKS : - 10 } " <nl> CONFIGUREWAIT = " $ { CONFIGUREWAIT : - 240 } " <nl> FDBCONF = " $ { ETCDIR } / fdb . cluster " <nl> status = 0 <nl> messagetime = 0 <nl> messagecount = 0 <nl> <nl> - # Define a random ip address and port on localhost <nl> - if [ - z $ { IPADDRESS } ] ; then <nl> - let index2 = " $ { RANDOM } % 256 " <nl> - let index3 = " $ { RANDOM } % 256 " <nl> - let index4 = " ( $ { RANDOM } % 255 ) + 1 " <nl> - IPADDRESS = " 127 . $ { index2 } . $ { index3 } . $ { index4 } " <nl> + # Do nothing , if cluster string is already defined <nl> + if [ - n " $ { FDBCLUSTERTEXT } " ] <nl> + then <nl> + : <nl> + # Otherwise , define the cluster text <nl> + else <nl> + # Define a random ip address and port on localhost <nl> + if [ - z " $ { IPADDRESS } " ] ; then <nl> + let index2 = " $ { RANDOM } % 256 " <nl> + let index3 = " $ { RANDOM } % 256 " <nl> + let index4 = " ( $ { RANDOM } % 255 ) + 1 " <nl> + IPADDRESS = " 127 . $ { index2 } . $ { index3 } . $ { index4 } " <nl> + fi <nl> + if [ - z " $ { FDBPORT } " ] ; then <nl> + let FDBPORT = " ( $ { RANDOM } % $ { FDBPORTTOTAL } ) + $ { FDBPORTSTART } " <nl> + fi <nl> + FDBCLUSTERTEXT = " $ { IPADDRESS } : $ { FDBPORT } " <nl> fi <nl> - if [ - z $ { FDBPORT } ] ; then <nl> - let FDBPORT = " ( $ { RANDOM } % 1000 ) + $ { FDBPORTSTART } " <nl> - fi <nl> - CLUSTERSTRING = " $ { IPADDRESS } : $ { FDBPORT } " <nl> - <nl> <nl> function log <nl> { <nl> - local status = 0 <nl> - if [ " $ # " - lt 1 ] <nl> - then <nl> - echo " Usage : log < message > [ echo ] " <nl> - echo <nl> - echo " Logs the message and timestamp to LOGFILE ( $ { LOGFILE } ) and , if the " <nl> - echo " second argument is either not present or is set to 1 , stdout . " <nl> - let status = " $ { status } + 1 " <nl> - else <nl> - # Log to stdout . <nl> - if [ " $ # " - lt 2 ] | | [ " $ { 2 } " - ge 1 ] <nl> - then <nl> - echo " $ { 1 } " <nl> - fi <nl> - <nl> - # Log to file . <nl> - datestr = $ ( date + " % Y - % m - % d % H : % M : % S ( % s ) " ) <nl> - dir = $ ( dirname " $ { LOGFILE } " ) <nl> - if ! [ - d " $ { dir } " ] & & ! mkdir - p " $ { dir } " <nl> - then <nl> - echo " Could not create directory to log output . " <nl> - let status = " $ { status } + 1 " <nl> - elif ! [ - f " $ { LOGFILE } " ] & & ! touch " $ { LOGFILE } " <nl> - then <nl> - echo " Could not create file $ { LOGFILE } to log output . " <nl> - let status = " $ { status } + 1 " <nl> - elif ! echo " [ $ { datestr } ] $ { 1 } " > > " $ { LOGFILE } " <nl> - then <nl> - echo " Could not log output to $ { LOGFILE } . " <nl> - let status = " $ { status } + 1 " <nl> - fi <nl> - fi <nl> - <nl> - return " $ { status } " <nl> + local status = 0 <nl> + if [ " $ # " - lt 1 ] <nl> + then <nl> + echo " Usage : log < message > [ echo ] " <nl> + echo <nl> + echo " Logs the message and timestamp to LOGFILE ( $ { LOGFILE } ) and , if the " <nl> + echo " second argument is either not present or is set to 1 , stdout . " <nl> + let status = " $ { status } + 1 " <nl> + else <nl> + # Log to stdout . <nl> + if [ " $ # " - lt 2 ] | | [ " $ { 2 } " - ge 1 ] <nl> + then <nl> + echo " $ { 1 } " <nl> + fi <nl> + <nl> + # Log to file . <nl> + datestr = $ ( date + " % Y - % m - % d % H : % M : % S ( % s ) " ) <nl> + dir = $ ( dirname " $ { LOGFILE } " ) <nl> + if ! [ - d " $ { dir } " ] & & ! mkdir - p " $ { dir } " <nl> + then <nl> + echo " Could not create directory to log output . " <nl> + let status = " $ { status } + 1 " <nl> + elif ! [ - f " $ { LOGFILE } " ] & & ! touch " $ { LOGFILE } " <nl> + then <nl> + echo " Could not create file $ { LOGFILE } to log output . " <nl> + let status = " $ { status } + 1 " <nl> + elif ! echo " [ $ { datestr } ] $ { 1 } " > > " $ { LOGFILE } " <nl> + then <nl> + echo " Could not log output to $ { LOGFILE } . " <nl> + let status = " $ { status } + 1 " <nl> + fi <nl> + fi <nl> + <nl> + return " $ { status } " <nl> } <nl> <nl> # Display a message for the user . <nl> function displayMessage <nl> { <nl> - local status = 0 <nl> - <nl> - if [ " $ # " - lt 1 ] <nl> - then <nl> - echo " displayMessage < message > " <nl> - let status = " $ { status } + 1 " <nl> - elif ! log " $ { 1 } " 0 <nl> - then <nl> - log " Could not write message to file . " <nl> - else <nl> - # Increment the message counter <nl> - let messagecount = " $ { messagecount } + 1 " <nl> - <nl> - # Display successful message , if previous message <nl> - if [ " $ { messagecount } " - gt 1 ] <nl> - then <nl> - # Determine the amount of transpired time <nl> - let timespent = " $ { SECONDS } - $ { messagetime } " <nl> - <nl> - if [ " $ { DEBUGLEVEL } " - gt 0 ] ; then <nl> - printf " . . . done in % 3d seconds \ n " " $ { timespent } " <nl> - fi <nl> - fi <nl> - <nl> - # Display message <nl> - if [ " $ { DEBUGLEVEL } " - gt 0 ] ; then <nl> - printf " % - 16s % - 35s " " $ ( date " + % F % H - % M - % S " ) " " $ 1 " <nl> - fi <nl> - <nl> - # Update the variables <nl> - messagetime = " $ { SECONDS } " <nl> - fi <nl> - <nl> - return " $ { status } " <nl> + local status = 0 <nl> + <nl> + if [ " $ # " - lt 1 ] <nl> + then <nl> + echo " displayMessage < message > " <nl> + let status = " $ { status } + 1 " <nl> + elif ! log " $ { 1 } " 0 <nl> + then <nl> + log " Could not write message to file . " <nl> + else <nl> + # Increment the message counter <nl> + let messagecount = " $ { messagecount } + 1 " <nl> + <nl> + # Display successful message , if previous message <nl> + if [ " $ { messagecount } " - gt 1 ] <nl> + then <nl> + # Determine the amount of transpired time <nl> + let timespent = " $ { SECONDS } - $ { messagetime } " <nl> + <nl> + if [ " $ { DEBUGLEVEL } " - gt 0 ] ; then <nl> + printf " . . . done in % 3d seconds \ n " " $ { timespent } " <nl> + fi <nl> + fi <nl> + <nl> + # Display message <nl> + if [ " $ { DEBUGLEVEL } " - gt 0 ] ; then <nl> + printf " % - 16s % - 35s " " $ ( date " + % F % H - % M - % S " ) " " $ 1 " <nl> + fi <nl> + <nl> + # Update the variables <nl> + messagetime = " $ { SECONDS } " <nl> + fi <nl> + <nl> + return " $ { status } " <nl> } <nl> <nl> # Create the directories used by the server . <nl> function createDirectories <nl> { <nl> - local status = 0 <nl> - <nl> - # Display user message <nl> - if ! displayMessage " Creating directories " <nl> - then <nl> - echo ' Failed to display user message ' <nl> - let status = " $ { status } + 1 " <nl> - <nl> - elif ! mkdir - p " $ { LOGDIR } " " $ { ETCDIR } " <nl> - then <nl> - log " Failed to create directories " <nl> - let status = " $ { status } + 1 " <nl> - <nl> - # Display user message <nl> - elif ! displayMessage " Setting file permissions " <nl> - then <nl> - log ' Failed to display user message ' <nl> - let status = " $ { status } + 1 " <nl> - <nl> - elif ! chmod 755 " $ { BINDIR } / fdbserver " " $ { BINDIR } / fdbcli " <nl> - then <nl> - log " Failed to set file permissions " <nl> - let status = " $ { status } + 1 " <nl> - <nl> - else <nl> - while read filepath <nl> - do <nl> - if [ - f " $ { filepath } " ] & & [ ! - x " $ { filepath } " ] <nl> - then <nl> - # if [ " $ { DEBUGLEVEL } " - gt 1 ] ; then <nl> - # log " Enable executable : $ { filepath } " <nl> - # fi <nl> - log " Enable executable : $ { filepath } " " $ { DEBUGLEVEL } " <nl> - if ! chmod 755 " $ { filepath } " <nl> - then <nl> - log " Failed to set executable for file : $ { filepath } " <nl> - let status = " $ { status } + 1 " <nl> - fi <nl> - fi <nl> - done < < ( find " $ { BINDIR } " - iname ' * . py ' - o - iname ' * . rb ' - o - iname ' fdb_flow_tester ' - o - iname ' _stacktester ' - o - iname ' * . js ' - o - iname ' * . sh ' - o - iname ' * . ksh ' ) <nl> - fi <nl> - <nl> - return $ { status } <nl> + local status = 0 <nl> + <nl> + # Display user message <nl> + if ! displayMessage " Creating directories " <nl> + then <nl> + echo ' Failed to display user message ' <nl> + let status = " $ { status } + 1 " <nl> + <nl> + elif ! mkdir - p " $ { LOGDIR } " " $ { ETCDIR } " <nl> + then <nl> + log " Failed to create directories " <nl> + let status = " $ { status } + 1 " <nl> + <nl> + # Display user message <nl> + elif ! displayMessage " Setting file permissions " <nl> + then <nl> + log ' Failed to display user message ' <nl> + let status = " $ { status } + 1 " <nl> + <nl> + elif ! chmod 755 " $ { BINDIR } / fdbserver " " $ { BINDIR } / fdbcli " <nl> + then <nl> + log " Failed to set file permissions " <nl> + let status = " $ { status } + 1 " <nl> + <nl> + else <nl> + while read filepath <nl> + do <nl> + if [ - f " $ { filepath } " ] & & [ ! - x " $ { filepath } " ] <nl> + then <nl> + # if [ " $ { DEBUGLEVEL } " - gt 1 ] ; then <nl> + # log " Enable executable : $ { filepath } " <nl> + # fi <nl> + log " Enable executable : $ { filepath } " " $ { DEBUGLEVEL } " <nl> + if ! chmod 755 " $ { filepath } " <nl> + then <nl> + log " Failed to set executable for file : $ { filepath } " <nl> + let status = " $ { status } + 1 " <nl> + fi <nl> + fi <nl> + done < < ( find " $ { BINDIR } " - iname ' * . py ' - o - iname ' * . rb ' - o - iname ' fdb_flow_tester ' - o - iname ' _stacktester ' - o - iname ' * . js ' - o - iname ' * . sh ' - o - iname ' * . ksh ' ) <nl> + fi <nl> + <nl> + return $ { status } <nl> } <nl> <nl> # Create a cluster file for the local cluster . <nl> function createClusterFile <nl> { <nl> - local status = 0 <nl> - <nl> - if [ " $ { status } " - ne 0 ] ; then <nl> - : <nl> - # Display user message <nl> - elif ! displayMessage " Creating Fdb Cluster file " <nl> - then <nl> - log ' Failed to display user message ' <nl> - let status = " $ { status } + 1 " <nl> - else <nl> - description = $ ( LC_CTYPE = C tr - dc A - Za - z0 - 9 < / dev / urandom 2 > / dev / null | head - c 8 ) <nl> - random_str = $ ( LC_CTYPE = C tr - dc A - Za - z0 - 9 < / dev / urandom 2 > / dev / null | head - c 8 ) <nl> - echo " $ { description } : $ { random_str } @ $ { CLUSTERSTRING } " > " $ { FDBCONF } " <nl> - fi <nl> - <nl> - if [ " $ { status } " - ne 0 ] ; then <nl> - : <nl> - elif ! chmod 0664 " $ { FDBCONF } " ; then <nl> - log " Failed to set permissions on fdbconf : $ { FDBCONF } " <nl> - let status = " $ { status } + 1 " <nl> - fi <nl> - <nl> - return $ { status } <nl> + local status = 0 <nl> + <nl> + if [ " $ { status } " - ne 0 ] ; then <nl> + : <nl> + # Display user message <nl> + elif ! displayMessage " Creating Fdb Cluster file " <nl> + then <nl> + log ' Failed to display user message ' <nl> + let status = " $ { status } + 1 " <nl> + else <nl> + description = $ ( LC_CTYPE = C tr - dc A - Za - z0 - 9 < / dev / urandom 2 > / dev / null | head - c 8 ) <nl> + random_str = $ ( LC_CTYPE = C tr - dc A - Za - z0 - 9 < / dev / urandom 2 > / dev / null | head - c 8 ) <nl> + echo " $ { description } : $ { random_str } @ $ { FDBCLUSTERTEXT } " > " $ { FDBCONF } " <nl> + fi <nl> + <nl> + if [ " $ { status } " - ne 0 ] ; then <nl> + : <nl> + elif ! chmod 0664 " $ { FDBCONF } " ; then <nl> + log " Failed to set permissions on fdbconf : $ { FDBCONF } " <nl> + let status = " $ { status } + 1 " <nl> + fi <nl> + <nl> + return $ { status } <nl> } <nl> <nl> # Stop the Cluster from running . <nl> function stopCluster <nl> { <nl> - local status = 0 <nl> - <nl> - # Add an audit entry , if enabled <nl> - if [ " $ { AUDITCLUSTER } " - gt 0 ] ; then <nl> - printf ' % - 15s ( % 6s ) Stopping cluster % - 20s ( % 6s ) : % s \ n ' " $ ( date + ' % Y - % m - % d % H : % M : % S ' ) " " $ { $ } " " $ { CLUSTERSTRING } " " $ { FDBSERVERID } " > > " $ { AUDITLOG } " <nl> - fi <nl> - if [ - z " $ { FDBSERVERID } " ] ; then <nl> - log ' FDB Server process is not defined ' <nl> - let status = " $ { status } + 1 " <nl> - elif ! kill - 0 " $ { FDBSERVERID } " ; then <nl> - log " Failed to locate FDB Server process ( $ { FDBSERVERID } ) " <nl> - let status = " $ { status } + 1 " <nl> - elif " $ { BINDIR } / fdbcli " - C " $ { FDBCONF } " - - exec " kill ; kill $ { CLUSTERSTRING } ; sleep 3 " - - timeout 120 & > > " $ { LOGDIR } / fdbcli - kill . log " <nl> - then <nl> - # Ensure that process is dead <nl> - if ! kill - 0 " $ { FDBSERVERID } " 2 > / dev / null ; then <nl> - log " Killed cluster ( $ { FDBSERVERID } ) via cli " <nl> - elif ! kill - 9 " $ { FDBSERVERID } " ; then <nl> - log " Failed to kill FDB Server process ( $ { FDBSERVERID } ) via cli or kill command " <nl> - let status = " $ { status } + 1 " <nl> - else <nl> - log " Forcibly killed FDB Server process ( $ { FDBSERVERID } ) since cli failed " <nl> - fi <nl> - elif ! kill - 9 " $ { FDBSERVERID } " ; then <nl> - log " Failed to forcibly kill FDB Server process ( $ { FDBSERVERID } ) " <nl> - let status = " $ { status } + 1 " <nl> - else <nl> - log " Forcibly killed FDB Server process ( $ { FDBSERVERID } ) " <nl> - fi <nl> - return " $ { status } " <nl> + local status = 0 <nl> + <nl> + # Add an audit entry , if enabled <nl> + if [ " $ { AUDITCLUSTER } " - gt 0 ] ; then <nl> + printf ' % - 15s ( % 6s ) Stopping cluster % - 20s ( % 6s ) : % s \ n ' " $ ( date + ' % Y - % m - % d % H : % M : % S ' ) " " $ { $ } " " $ { FDBCLUSTERTEXT } " " $ { FDBSERVERID } " > > " $ { AUDITLOG } " <nl> + fi <nl> + if [ - z " $ { FDBSERVERID } " ] ; then <nl> + log ' FDB Server process is not defined ' <nl> + let status = " $ { status } + 1 " <nl> + elif ! kill - 0 " $ { FDBSERVERID } " ; then <nl> + log " Failed to locate FDB Server process ( $ { FDBSERVERID } ) " <nl> + let status = " $ { status } + 1 " <nl> + elif " $ { BINDIR } / fdbcli " - C " $ { FDBCONF } " - - exec " kill ; kill $ { FDBCLUSTERTEXT } ; sleep 3 " - - timeout 120 & > > " $ { LOGDIR } / fdbcli - kill . log " <nl> + then <nl> + # Ensure that process is dead <nl> + if ! kill - 0 " $ { FDBSERVERID } " 2 > / dev / null ; then <nl> + log " Killed cluster ( $ { FDBSERVERID } ) via cli " <nl> + elif ! kill - 9 " $ { FDBSERVERID } " ; then <nl> + log " Failed to kill FDB Server process ( $ { FDBSERVERID } ) via cli or kill command " <nl> + let status = " $ { status } + 1 " <nl> + else <nl> + log " Forcibly killed FDB Server process ( $ { FDBSERVERID } ) since cli failed " <nl> + fi <nl> + elif ! kill - 9 " $ { FDBSERVERID } " ; then <nl> + log " Failed to forcibly kill FDB Server process ( $ { FDBSERVERID } ) " <nl> + let status = " $ { status } + 1 " <nl> + else <nl> + log " Forcibly killed FDB Server process ( $ { FDBSERVERID } ) " <nl> + fi <nl> + return " $ { status } " <nl> } <nl> <nl> # Start the server running . <nl> function startFdbServer <nl> { <nl> - local status = 0 <nl> - <nl> - # Add an audit entry , if enabled <nl> - if [ " $ { AUDITCLUSTER } " - gt 0 ] ; then <nl> - printf ' % - 15s ( % 6s ) Starting cluster % - 20s \ n ' " $ ( date + ' % Y - % m - % d % H : % M : % S ' ) " " $ { $ } " " $ { CLUSTERSTRING } " > > " $ { AUDITLOG } " <nl> - fi <nl> - <nl> - if [ " $ { status } " - ne 0 ] ; then <nl> - : <nl> - elif ! displayMessage " Starting Fdb Server " <nl> - then <nl> - log ' Failed to display user message ' <nl> - let status = " $ { status } + 1 " <nl> - <nl> - else <nl> - " $ { BINDIR } / fdbserver " - - knob_disable_posix_kernel_aio = 1 - C " $ { FDBCONF } " - p " $ { CLUSTERSTRING } " - L " $ { LOGDIR } " - d " $ { WORKDIR } / fdb / $ { $ } " & > " $ { LOGDIR } / fdbserver . log " & <nl> - fdbpid = $ ! <nl> - fdbrc = $ ? <nl> - if [ $ fdbrc - ne 0 ] <nl> - then <nl> - log " Failed to start FDB Server " <nl> - let status = " $ { status } + 1 " <nl> - else <nl> - FDBSERVERID = " $ { fdbpid } " <nl> - fi <nl> - fi <nl> - <nl> - if [ - z " $ { FDBSERVERID } " ] ; then <nl> - log " FDB Server start failed because no process " <nl> - let status = " $ { status } + 1 " <nl> - elif ! kill - 0 " $ { FDBSERVERID } " ; then <nl> - log " FDB Server start failed because process terminated unexpectedly " <nl> - let status = " $ { status } + 1 " <nl> - fi <nl> - <nl> - return $ { status } <nl> + local status = 0 <nl> + <nl> + # Add an audit entry , if enabled <nl> + if [ " $ { AUDITCLUSTER } " - gt 0 ] ; then <nl> + printf ' % - 15s ( % 6s ) Starting cluster % - 20s \ n ' " $ ( date + ' % Y - % m - % d % H : % M : % S ' ) " " $ { $ } " " $ { FDBCLUSTERTEXT } " > > " $ { AUDITLOG } " <nl> + fi <nl> + <nl> + if ! displayMessage " Starting Fdb Server " <nl> + then <nl> + log ' Failed to display user message ' <nl> + let status = " $ { status } + 1 " <nl> + <nl> + else <nl> + " $ { BINDIR } / fdbserver " - - knob_disable_posix_kernel_aio = 1 - C " $ { FDBCONF } " - p " $ { FDBCLUSTERTEXT } " - L " $ { LOGDIR } " - d " $ { WORKDIR } / fdb / $ { $ } " & > " $ { LOGDIR } / fdbserver . log " & <nl> + if [ " $ { ? } " - ne 0 ] <nl> + then <nl> + log " Failed to start FDB Server " <nl> + let status = " $ { status } + 1 " <nl> + else <nl> + FDBSERVERID = " $ { ! } " <nl> + fi <nl> + fi <nl> + <nl> + if [ - z " $ { FDBSERVERID } " ] ; then <nl> + log " FDB Server start failed because no process " <nl> + let status = " $ { status } + 1 " <nl> + elif ! kill - 0 " $ { FDBSERVERID } " ; then <nl> + log " FDB Server start failed because process terminated unexpectedly " <nl> + let status = " $ { status } + 1 " <nl> + fi <nl> + <nl> + return $ { status } <nl> } <nl> <nl> function getStatus <nl> { <nl> - local status = 0 <nl> - <nl> - if [ " $ { status } " - ne 0 ] ; then <nl> - : <nl> - elif ! date & > > " $ { LOGDIR } / fdbclient . log " <nl> - then <nl> - log ' Failed to get date ' <nl> - let status = " $ { status } + 1 " <nl> - elif ! " $ { BINDIR } / fdbcli " - C " $ { FDBCONF } " - - exec ' status json ' - - timeout 120 & > > " $ { LOGDIR } / fdbclient . log " <nl> - then <nl> - log ' Failed to get status from fdbcli ' <nl> - let status = " $ { status } + 1 " <nl> - elif ! date & > > " $ { LOGDIR } / fdbclient . log " <nl> - then <nl> - log ' Failed to get date ' <nl> - let status = " $ { status } + 1 " <nl> - fi <nl> - <nl> - return $ { status } <nl> + local status = 0 <nl> + <nl> + if [ " $ { status } " - ne 0 ] ; then <nl> + : <nl> + elif ! date & > > " $ { LOGDIR } / fdbclient . log " <nl> + then <nl> + log ' Failed to get date ' <nl> + let status = " $ { status } + 1 " <nl> + elif ! " $ { BINDIR } / fdbcli " - C " $ { FDBCONF } " - - exec ' status json ' - - timeout 120 & > > " $ { LOGDIR } / fdbclient . log " <nl> + then <nl> + log ' Failed to get status from fdbcli ' <nl> + let status = " $ { status } + 1 " <nl> + elif ! date & > > " $ { LOGDIR } / fdbclient . log " <nl> + then <nl> + log ' Failed to get date ' <nl> + let status = " $ { status } + 1 " <nl> + fi <nl> + <nl> + return $ { status } <nl> } <nl> <nl> # Verify that the cluster is available . <nl> function verifyAvailable <nl> { <nl> - local status = 0 <nl> - <nl> - if [ - z " $ { FDBSERVERID } " ] ; then <nl> - log " FDB Server process is not defined . " <nl> - let status = " $ { status } + 1 " <nl> - # Verify that the server is running . <nl> - elif ! kill - 0 " $ { FDBSERVERID } " <nl> - then <nl> - log " FDB server process ( $ { FDBSERVERID } ) is not running " <nl> - let status = " $ { status } + 1 " <nl> - # Display user message . <nl> - elif ! displayMessage " Checking cluster availability " <nl> - then <nl> - log ' Failed to display user message ' <nl> - let status = " $ { status } + 1 " <nl> - # Determine if status json says the database is available . <nl> - else <nl> - avail = ` " $ { BINDIR } / fdbcli " - C " $ { FDBCONF } " - - exec ' status json ' - - timeout " $ { SERVERCHECKS } " 2 > / dev / null | grep - E ' " database_available " | " available " ' | grep ' true ' ` <nl> - log " Avail value : $ { avail } " " $ { DEBUGLEVEL } " <nl> - if [ [ - n " $ { avail } " ] ] ; then <nl> - : <nl> - else <nl> - let status = " $ { status } + 1 " <nl> - fi <nl> - fi <nl> - return " $ { status } " <nl> + local status = 0 <nl> + <nl> + if [ - z " $ { FDBSERVERID } " ] ; then <nl> + log " FDB Server process is not defined . " <nl> + let status = " $ { status } + 1 " <nl> + # Verify that the server is running . <nl> + elif ! kill - 0 " $ { FDBSERVERID } " <nl> + then <nl> + log " FDB server process ( $ { FDBSERVERID } ) is not running " <nl> + let status = " $ { status } + 1 " <nl> + # Display user message . <nl> + elif ! displayMessage " Checking cluster availability " <nl> + then <nl> + log ' Failed to display user message ' <nl> + let status = " $ { status } + 1 " <nl> + # Determine if status json says the database is available . <nl> + else <nl> + avail = ` " $ { BINDIR } / fdbcli " - C " $ { FDBCONF } " - - exec ' status json ' - - timeout " $ { SERVERCHECKS } " 2 > / dev / null | grep - E ' " database_available " | " available " ' | grep ' true ' ` <nl> + log " Avail value : $ { avail } " " $ { DEBUGLEVEL } " <nl> + if [ [ - n " $ { avail } " ] ] ; then <nl> + : <nl> + else <nl> + let status = " $ { status } + 1 " <nl> + fi <nl> + fi <nl> + return " $ { status } " <nl> } <nl> <nl> # Configure the database on the server . <nl> function createDatabase <nl> { <nl> - local status = 0 <nl> - <nl> - if [ " $ { status } " - ne 0 ] ; then <nl> - : <nl> - # Ensure that the server is running <nl> - elif ! kill - 0 " $ { FDBSERVERID } " <nl> - then <nl> - log " FDB server process : ( $ { FDBSERVERID } ) is not running " <nl> - let status = " $ { status } + 1 " <nl> - <nl> - # Display user message <nl> - elif ! displayMessage " Creating database " <nl> - then <nl> - log ' Failed to display user message ' <nl> - let status = " $ { status } + 1 " <nl> - elif ! echo " Client log : " & > " $ { LOGDIR } / fdbclient . log " <nl> - then <nl> - log ' Failed to create fdbclient . log ' <nl> - let status = " $ { status } + 1 " <nl> - elif ! getStatus <nl> - then <nl> - log ' Failed to get status ' <nl> - let status = " $ { status } + 1 " <nl> - <nl> - # Configure the database . <nl> - else <nl> - " $ { BINDIR } / fdbcli " - C " $ { FDBCONF } " - - exec ' configure new single memory ; status ' - - timeout " $ { CONFIGUREWAIT } " - - log - - log - dir " $ { LOGDIR } " & > > " $ { LOGDIR } / fdbclient . log " <nl> - <nl> - if ! displayMessage " Checking if config succeeded " <nl> - then <nl> - log ' Failed to display user message . ' <nl> - fi <nl> - <nl> - iteration = 0 <nl> - while [ [ " $ { iteration } " - lt " $ { SERVERCHECKS } " ] ] & & ! verifyAvailable <nl> - do <nl> - log " Database not created ( iteration $ { iteration } ) . " <nl> - let iteration = " $ { iteration } + 1 " <nl> - done <nl> - <nl> - if ! verifyAvailable <nl> - then <nl> - log " Failed to create database via cli " <nl> - getStatus <nl> - cat " $ { LOGDIR } / fdbclient . log " <nl> - log " Ignoring - - moving on " <nl> - # let status = " $ { status } + 1 " <nl> - fi <nl> - fi <nl> - <nl> - return $ { status } <nl> + local status = 0 <nl> + <nl> + if [ " $ { status } " - ne 0 ] ; then <nl> + : <nl> + # Ensure that the server is running <nl> + elif ! kill - 0 " $ { FDBSERVERID } " <nl> + then <nl> + log " FDB server process : ( $ { FDBSERVERID } ) is not running " <nl> + let status = " $ { status } + 1 " <nl> + <nl> + # Display user message <nl> + elif ! displayMessage " Creating database " <nl> + then <nl> + log ' Failed to display user message ' <nl> + let status = " $ { status } + 1 " <nl> + elif ! echo " Client log : " & > " $ { LOGDIR } / fdbclient . log " <nl> + then <nl> + log ' Failed to create fdbclient . log ' <nl> + let status = " $ { status } + 1 " <nl> + elif ! getStatus <nl> + then <nl> + log ' Failed to get status ' <nl> + let status = " $ { status } + 1 " <nl> + <nl> + # Configure the database . <nl> + else <nl> + " $ { BINDIR } / fdbcli " - C " $ { FDBCONF } " - - exec ' configure new single memory ; status ' - - timeout " $ { CONFIGUREWAIT } " - - log - - log - dir " $ { LOGDIR } " & > > " $ { LOGDIR } / fdbclient . log " <nl> + <nl> + if ! displayMessage " Checking if config succeeded " <nl> + then <nl> + log ' Failed to display user message . ' <nl> + fi <nl> + <nl> + iteration = 0 <nl> + while [ [ " $ { iteration } " - lt " $ { SERVERCHECKS } " ] ] & & ! verifyAvailable <nl> + do <nl> + log " Database not created ( iteration $ { iteration } ) . " <nl> + let iteration = " $ { iteration } + 1 " <nl> + done <nl> + <nl> + if ! verifyAvailable <nl> + then <nl> + log " Failed to create database via cli " <nl> + getStatus <nl> + cat " $ { LOGDIR } / fdbclient . log " <nl> + log " Ignoring - - moving on " <nl> + # let status = " $ { status } + 1 " <nl> + fi <nl> + fi <nl> + <nl> + return $ { status } <nl> } <nl> <nl> # Begin the local cluster from scratch . <nl> function startCluster <nl> { <nl> - local status = 0 <nl> - <nl> - if [ " $ { status } " - ne 0 ] ; then <nl> - : <nl> - elif ! createDirectories <nl> - then <nl> - log " Could not create directories . " <nl> - let status = " $ { status } + 1 " <nl> - elif ! createClusterFile <nl> - then <nl> - log " Could not create cluster file . " <nl> - let status = " $ { status } + 1 " <nl> - elif ! startFdbServer <nl> - then <nl> - log " Could not start FDB server . " <nl> - let status = " $ { status } + 1 " <nl> - elif ! createDatabase <nl> - then <nl> - log " Could not create database . " <nl> - let status = " $ { status } + 1 " <nl> - fi <nl> - <nl> - return $ { status } <nl> + local status = 0 <nl> + <nl> + if [ " $ { status } " - ne 0 ] ; then <nl> + : <nl> + elif ! createDirectories <nl> + then <nl> + log " Could not create directories . " <nl> + let status = " $ { status } + 1 " <nl> + elif ! createClusterFile <nl> + then <nl> + log " Could not create cluster file . " <nl> + let status = " $ { status } + 1 " <nl> + elif ! startFdbServer <nl> + then <nl> + log " Could not start FDB server . " <nl> + let status = " $ { status } + 1 " <nl> + elif ! createDatabase <nl> + then <nl> + log " Could not create database . " <nl> + let status = " $ { status } + 1 " <nl> + fi <nl> + <nl> + return $ { status } <nl> } <nl> | Added support to specify the FDB Cluster Text | apple/foundationdb | 40b51cbdbb5fecce81c677d78c797c7583efe6d3 | 2020-09-23T21:58:47Z |
new file mode 100644 <nl> index 000000000000 . . 6e3d98b35324 <nl> mmm / dev / null <nl> ppp b / validation - test / compiler_crashers / 28828 - unreachable - executed - at - swift - lib - ast - type - cpp - 3237 . swift <nl> <nl> + / / This source file is part of the Swift . org open source project <nl> + / / Copyright ( c ) 2014 - 2017 Apple Inc . and the Swift project authors <nl> + / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> + / / <nl> + / / See https : / / swift . org / LICENSE . txt for license information <nl> + / / See https : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> + <nl> + / / RUN : not - - crash % target - swift - frontend % s - emit - ir <nl> + class a < a { class a { extension { protocol P { class a : a { func a : Self . a <nl> | Merge pull request from practicalswift / swiftc - 28828 - unreachable - executed - at - swift - lib - ast - type - cpp - 3237 | apple/swift | 9c9db59c97e069b3645ae9669959d9a506abb014 | 2017-07-26T03:09:45Z |
mmm a / Ahuacatl / ahuacatl - grammar . c <nl> ppp b / Ahuacatl / ahuacatl - grammar . c <nl> union yyalloc <nl> / * YYFINAL - - State number of the termination state . * / <nl> # define YYFINAL 3 <nl> / * YYLAST - - Last index in YYTABLE . * / <nl> - # define YYLAST 368 <nl> + # define YYLAST 341 <nl> <nl> / * YYNTOKENS - - Number of terminals . * / <nl> # define YYNTOKENS 52 <nl> union yyalloc <nl> / * YYNRULES - - Number of rules . * / <nl> # define YYNRULES 100 <nl> / * YYNRULES - - Number of states . * / <nl> - # define YYNSTATES 163 <nl> + # define YYNSTATES 161 <nl> <nl> / * YYTRANSLATE ( YYLEX ) - - Bison symbol number corresponding to YYLEX . * / <nl> # define YYUNDEFTOK 2 <nl> static const yytype_uint8 yytranslate [ ] = <nl> static const yytype_uint16 yyprhs [ ] = <nl> { <nl> 0 , 0 , 3 , 4 , 8 , 9 , 12 , 14 , 16 , 18 , <nl> - 20 , 22 , 24 , 29 , 32 , 39 , 40 , 45 , 47 , 51 , <nl> - 55 , 57 , 58 , 61 , 62 , 66 , 68 , 72 , 75 , 76 , <nl> - 78 , 80 , 83 , 88 , 91 , 95 , 99 , 101 , 103 , 105 , <nl> - 106 , 112 , 114 , 116 , 118 , 121 , 124 , 127 , 131 , 135 , <nl> - 139 , 143 , 147 , 151 , 155 , 159 , 163 , 167 , 171 , 175 , <nl> - 179 , 183 , 189 , 190 , 192 , 194 , 198 , 200 , 202 , 203 , <nl> - 208 , 209 , 211 , 213 , 217 , 218 , 223 , 224 , 226 , 228 , <nl> - 232 , 236 , 238 , 243 , 250 , 254 , 256 , 261 , 265 , 267 , <nl> - 269 , 271 , 273 , 275 , 277 , 279 , 281 , 283 , 285 , 287 , <nl> - 289 <nl> + 20 , 22 , 24 , 29 , 32 , 37 , 38 , 43 , 45 , 49 , <nl> + 53 , 55 , 56 , 59 , 60 , 64 , 66 , 70 , 73 , 74 , <nl> + 76 , 78 , 81 , 86 , 89 , 93 , 97 , 99 , 101 , 103 , <nl> + 104 , 110 , 112 , 114 , 116 , 119 , 122 , 125 , 129 , 133 , <nl> + 137 , 141 , 145 , 149 , 153 , 157 , 161 , 165 , 169 , 173 , <nl> + 177 , 181 , 187 , 188 , 190 , 192 , 196 , 198 , 200 , 201 , <nl> + 206 , 207 , 209 , 211 , 215 , 216 , 221 , 222 , 224 , 226 , <nl> + 230 , 234 , 236 , 241 , 248 , 252 , 254 , 259 , 263 , 265 , <nl> + 267 , 269 , 271 , 273 , 275 , 277 , 279 , 281 , 283 , 285 , <nl> + 287 <nl> } ; <nl> <nl> / * YYRHS - - A ` - 1 ' - separated list of the rules ' RHS . * / <nl> static const yytype_int8 yyrhs [ ] = <nl> 53 , 0 , - 1 , - 1 , 54 , 55 , 71 , - 1 , - 1 , 55 , <nl> 56 , - 1 , 57 , - 1 , 59 , - 1 , 58 , - 1 , 60 , - 1 , <nl> 65 , - 1 , 70 , - 1 , 3 , 95 , 12 , 72 , - 1 , 5 , <nl> - 72 , - 1 , 4 , 95 , 21 , 39 , 72 , 40 , - 1 , - 1 , <nl> - 7 , 61 , 62 , 64 , - 1 , 63 , - 1 , 62 , 38 , 63 , <nl> - - 1 , 95 , 21 , 72 , - 1 , 72 , - 1 , - 1 , 13 , 95 , <nl> - - 1 , - 1 , 8 , 66 , 67 , - 1 , 68 , - 1 , 67 , 38 , <nl> - 68 , - 1 , 72 , 69 , - 1 , - 1 , 10 , - 1 , 11 , - 1 , <nl> - 9 , 96 , - 1 , 9 , 96 , 38 , 96 , - 1 , 6 , 72 , <nl> - - 1 , 39 , 72 , 40 , - 1 , 39 , 53 , 40 , - 1 , 74 , <nl> - - 1 , 75 , - 1 , 76 , - 1 , - 1 , 17 , 73 , 39 , 77 , <nl> - 40 , - 1 , 79 , - 1 , 91 , - 1 , 89 , - 1 , 31 , 72 , <nl> - - 1 , 32 , 72 , - 1 , 22 , 72 , - 1 , 72 , 24 , 72 , <nl> - - 1 , 72 , 23 , 72 , - 1 , 72 , 31 , 72 , - 1 , 72 , <nl> - 32 , 72 , - 1 , 72 , 33 , 72 , - 1 , 72 , 34 , 72 , <nl> - - 1 , 72 , 35 , 72 , - 1 , 72 , 25 , 72 , - 1 , 72 , <nl> - 26 , 72 , - 1 , 72 , 27 , 72 , - 1 , 72 , 28 , 72 , <nl> - - 1 , 72 , 29 , 72 , - 1 , 72 , 30 , 72 , - 1 , 72 , <nl> - 12 , 72 , - 1 , 72 , 36 , 72 , 37 , 72 , - 1 , - 1 , <nl> - 78 , - 1 , 72 , - 1 , 78 , 38 , 72 , - 1 , 80 , - 1 , <nl> - 84 , - 1 , - 1 , 43 , 81 , 82 , 44 , - 1 , - 1 , 83 , <nl> - - 1 , 72 , - 1 , 83 , 38 , 72 , - 1 , - 1 , 41 , 85 , <nl> - 86 , 42 , - 1 , - 1 , 87 , - 1 , 88 , - 1 , 87 , 38 , <nl> - 88 , - 1 , 94 , 37 , 72 , - 1 , 17 , - 1 , 89 , 43 , <nl> - 72 , 44 , - 1 , 89 , 43 , 33 , 44 , 50 , 90 , - 1 , <nl> - 89 , 50 , 17 , - 1 , 17 , - 1 , 90 , 43 , 72 , 44 , <nl> - - 1 , 90 , 50 , 17 , - 1 , 92 , - 1 , 93 , - 1 , 18 , <nl> - - 1 , 19 , - 1 , 14 , - 1 , 15 , - 1 , 16 , - 1 , 20 , <nl> - - 1 , 17 , - 1 , 18 , - 1 , 17 , - 1 , 19 , - 1 , 51 , <nl> - 19 , - 1 <nl> + 72 , - 1 , 4 , 95 , 21 , 72 , - 1 , - 1 , 7 , 61 , <nl> + 62 , 64 , - 1 , 63 , - 1 , 62 , 38 , 63 , - 1 , 95 , <nl> + 21 , 72 , - 1 , 72 , - 1 , - 1 , 13 , 95 , - 1 , - 1 , <nl> + 8 , 66 , 67 , - 1 , 68 , - 1 , 67 , 38 , 68 , - 1 , <nl> + 72 , 69 , - 1 , - 1 , 10 , - 1 , 11 , - 1 , 9 , 96 , <nl> + - 1 , 9 , 96 , 38 , 96 , - 1 , 6 , 72 , - 1 , 39 , <nl> + 72 , 40 , - 1 , 39 , 53 , 40 , - 1 , 74 , - 1 , 75 , <nl> + - 1 , 76 , - 1 , - 1 , 17 , 73 , 39 , 77 , 40 , - 1 , <nl> + 79 , - 1 , 91 , - 1 , 89 , - 1 , 31 , 72 , - 1 , 32 , <nl> + 72 , - 1 , 22 , 72 , - 1 , 72 , 24 , 72 , - 1 , 72 , <nl> + 23 , 72 , - 1 , 72 , 31 , 72 , - 1 , 72 , 32 , 72 , <nl> + - 1 , 72 , 33 , 72 , - 1 , 72 , 34 , 72 , - 1 , 72 , <nl> + 35 , 72 , - 1 , 72 , 25 , 72 , - 1 , 72 , 26 , 72 , <nl> + - 1 , 72 , 27 , 72 , - 1 , 72 , 28 , 72 , - 1 , 72 , <nl> + 29 , 72 , - 1 , 72 , 30 , 72 , - 1 , 72 , 12 , 72 , <nl> + - 1 , 72 , 36 , 72 , 37 , 72 , - 1 , - 1 , 78 , - 1 , <nl> + 72 , - 1 , 78 , 38 , 72 , - 1 , 80 , - 1 , 84 , - 1 , <nl> + - 1 , 43 , 81 , 82 , 44 , - 1 , - 1 , 83 , - 1 , 72 , <nl> + - 1 , 83 , 38 , 72 , - 1 , - 1 , 41 , 85 , 86 , 42 , <nl> + - 1 , - 1 , 87 , - 1 , 88 , - 1 , 87 , 38 , 88 , - 1 , <nl> + 94 , 37 , 72 , - 1 , 17 , - 1 , 89 , 43 , 72 , 44 , <nl> + - 1 , 89 , 43 , 33 , 44 , 50 , 90 , - 1 , 89 , 50 , <nl> + 17 , - 1 , 17 , - 1 , 90 , 43 , 72 , 44 , - 1 , 90 , <nl> + 50 , 17 , - 1 , 92 , - 1 , 93 , - 1 , 18 , - 1 , 19 , <nl> + - 1 , 14 , - 1 , 15 , - 1 , 16 , - 1 , 20 , - 1 , 17 , <nl> + - 1 , 18 , - 1 , 17 , - 1 , 19 , - 1 , 51 , 19 , - 1 <nl> } ; <nl> <nl> / * YYRLINE [ YYN ] - - source line where rule number YYN was defined . * / <nl> static const yytype_uint8 yyr1 [ ] = <nl> static const yytype_uint8 yyr2 [ ] = <nl> { <nl> 0 , 2 , 0 , 3 , 0 , 2 , 1 , 1 , 1 , 1 , <nl> - 1 , 1 , 4 , 2 , 6 , 0 , 4 , 1 , 3 , 3 , <nl> + 1 , 1 , 4 , 2 , 4 , 0 , 4 , 1 , 3 , 3 , <nl> 1 , 0 , 2 , 0 , 3 , 1 , 3 , 2 , 0 , 1 , <nl> 1 , 2 , 4 , 2 , 3 , 3 , 1 , 1 , 1 , 0 , <nl> 5 , 1 , 1 , 1 , 2 , 2 , 2 , 3 , 3 , 3 , <nl> static const yytype_uint8 yydefact [ ] = <nl> 0 , 76 , 70 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , <nl> 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , <nl> 81 , 21 , 17 , 20 , 0 , 24 , 25 , 28 , 100 , 0 , <nl> - 12 , 0 , 62 , 35 , 34 , 96 , 97 , 0 , 77 , 78 , <nl> + 12 , 14 , 62 , 35 , 34 , 96 , 97 , 0 , 77 , 78 , <nl> 0 , 72 , 0 , 71 , 60 , 48 , 47 , 54 , 55 , 56 , <nl> 57 , 58 , 59 , 49 , 50 , 51 , 52 , 53 , 0 , 0 , <nl> 0 , 84 , 0 , 0 , 16 , 0 , 0 , 29 , 30 , 27 , <nl> - 32 , 0 , 64 , 0 , 63 , 75 , 0 , 0 , 69 , 0 , <nl> - 0 , 0 , 82 , 22 , 18 , 19 , 26 , 14 , 40 , 0 , <nl> - 79 , 80 , 73 , 61 , 0 , 65 , 85 , 83 , 0 , 0 , <nl> - 0 , 87 , 86 <nl> + 32 , 64 , 0 , 63 , 75 , 0 , 0 , 69 , 0 , 0 , <nl> + 0 , 82 , 22 , 18 , 19 , 26 , 40 , 0 , 79 , 80 , <nl> + 73 , 61 , 0 , 65 , 85 , 83 , 0 , 0 , 0 , 87 , <nl> + 86 <nl> } ; <nl> <nl> / * YYDEFGOTO [ NTERM - NUM ] . * / <nl> static const yytype_int16 yydefgoto [ ] = <nl> { <nl> - 1 , 1 , 2 , 4 , 12 , 13 , 14 , 15 , 16 , 48 , <nl> 81 , 82 , 124 , 17 , 49 , 85 , 86 , 129 , 18 , 19 , <nl> - 83 , 55 , 37 , 38 , 39 , 133 , 134 , 40 , 41 , 62 , <nl> - 102 , 103 , 42 , 61 , 97 , 98 , 99 , 43 , 157 , 44 , <nl> + 83 , 55 , 37 , 38 , 39 , 132 , 133 , 40 , 41 , 62 , <nl> + 102 , 103 , 42 , 61 , 97 , 98 , 99 , 43 , 155 , 44 , <nl> 45 , 46 , 100 , 84 , 52 <nl> } ; <nl> <nl> static const yytype_int16 yydefgoto [ ] = <nl> # define YYPACT_NINF - 39 <nl> static const yytype_int16 yypact [ ] = <nl> { <nl> - - 39 , 7 , - 39 , - 39 , 73 , - 9 , - 9 , 130 , 130 , - 39 , <nl> + - 39 , 7 , - 39 , - 39 , 97 , - 9 , - 9 , 128 , 128 , - 39 , <nl> - 39 , - 10 , - 39 , - 39 , - 39 , - 39 , - 39 , - 39 , - 39 , - 39 , <nl> - 39 , - 1 , - 11 , - 39 , - 39 , - 39 , - 22 , - 39 , - 39 , - 39 , <nl> - 130 , 130 , 130 , 130 , - 39 , - 39 , 284 , - 39 , - 39 , - 39 , <nl> - - 39 , - 39 , - 39 , - 38 , - 39 , - 39 , - 39 , 284 , 160 , 130 , <nl> - - 39 , 0 , - 17 , 130 , 6 , 8 , - 39 , - 39 , - 39 , - 18 , <nl> - 181 , - 3 , 130 , 130 , 130 , 130 , 130 , 130 , 130 , 130 , <nl> - 130 , 130 , 130 , 130 , 130 , 130 , 130 , 130 , 95 , 27 , <nl> - - 19 , 5 , - 39 , 284 , 33 , 45 , - 39 , 233 , - 39 , - 10 , <nl> - 284 , 130 , 130 , - 39 , - 39 , - 39 , - 39 , 58 , 64 , - 39 , <nl> - 66 , 284 , 57 , 67 , 220 , 321 , 309 , 333 , 333 , 18 , <nl> - 18 , 18 , 18 , 39 , 39 , - 39 , - 39 , - 39 , 258 , 60 , <nl> - 4 , - 39 , - 9 , 160 , - 39 , 130 , 130 , - 39 , - 39 , - 39 , <nl> - - 39 , 206 , 284 , 68 , 78 , - 39 , - 3 , 130 , - 39 , 130 , <nl> - 130 , 56 , - 39 , - 39 , - 39 , 284 , - 39 , - 39 , - 39 , 130 , <nl> - - 39 , 284 , 284 , 284 , 104 , 284 , - 39 , - 37 , 130 , 105 , <nl> - 63 , - 39 , - 39 <nl> + 128 , 128 , 128 , 128 , - 39 , - 39 , 257 , - 39 , - 39 , - 39 , <nl> + - 39 , - 39 , - 39 , - 38 , - 39 , - 39 , - 39 , 257 , 158 , 128 , <nl> + - 39 , 0 , - 17 , 128 , 128 , 6 , - 39 , - 39 , - 39 , - 18 , <nl> + 179 , - 3 , 128 , 128 , 128 , 128 , 128 , 128 , 128 , 128 , <nl> + 128 , 128 , 128 , 128 , 128 , 128 , 128 , 128 , 94 , 27 , <nl> + - 19 , 5 , - 39 , 257 , 33 , 77 , - 39 , 206 , - 39 , - 10 , <nl> + 257 , 257 , 128 , - 39 , - 39 , - 39 , - 39 , 75 , 83 , - 39 , <nl> + 85 , 257 , 79 , 86 , 49 , 294 , 282 , 306 , 306 , 18 , <nl> + 18 , 18 , 18 , 39 , 39 , - 39 , - 39 , - 39 , 231 , 84 , <nl> + 4 , - 39 , - 9 , 158 , - 39 , 128 , 128 , - 39 , - 39 , - 39 , <nl> + - 39 , 257 , 90 , 96 , - 39 , - 3 , 128 , - 39 , 128 , 128 , <nl> + 88 , - 39 , - 39 , - 39 , 257 , - 39 , - 39 , 128 , - 39 , 257 , <nl> + 257 , 257 , 119 , 257 , - 39 , - 37 , 128 , 122 , 63 , - 39 , <nl> + - 39 <nl> } ; <nl> <nl> / * YYPGOTO [ NTERM - NUM ] . * / <nl> static const yytype_int8 yypgoto [ ] = <nl> { <nl> - - 39 , 90 , - 39 , - 39 , - 39 , - 39 , - 39 , - 39 , - 39 , - 39 , <nl> - - 39 , 1 , - 39 , - 39 , - 39 , - 39 , 3 , - 39 , - 39 , - 39 , <nl> + - 39 , 108 , - 39 , - 39 , - 39 , - 39 , - 39 , - 39 , - 39 , - 39 , <nl> + - 39 , 28 , - 39 , - 39 , - 39 , - 39 , 26 , - 39 , - 39 , - 39 , <nl> - 7 , - 39 , - 39 , - 39 , - 39 , - 39 , - 39 , - 39 , - 39 , - 39 , <nl> - - 39 , - 39 , - 39 , - 39 , - 39 , - 39 , - 5 , - 39 , - 39 , - 39 , <nl> - - 39 , - 39 , - 39 , - 2 , 36 <nl> + - 39 , - 39 , - 39 , - 39 , - 39 , - 39 , 19 , - 39 , - 39 , - 39 , <nl> + - 39 , - 39 , - 39 , - 2 , 64 <nl> } ; <nl> <nl> / * YYTABLE [ YYPACT [ STATE - NUM ] ] . What to do in state STATE - NUM . If <nl> static const yytype_int8 yypgoto [ ] = <nl> # define YYTABLE_NINF - 99 <nl> static const yytype_int16 yytable [ ] = <nl> { <nl> - 36 , 47 , - 98 , 21 , 22 , 78 , 158 , 3 , 20 , 50 , <nl> - 54 , 53 , 79 , 159 , 95 , 96 , 63 , - 39 , 122 , 88 , <nl> + 36 , 47 , - 98 , 21 , 22 , 78 , 156 , 3 , 20 , 50 , <nl> + 54 , 53 , 79 , 157 , 95 , 96 , 63 , - 39 , 122 , 88 , <nl> - 39 , 89 , 93 , 56 , 57 , 58 , 60 , 64 , 65 , 66 , <nl> 67 , 68 , 69 , 70 , 71 , 72 , 73 , 74 , 75 , 76 , <nl> - 77 , 51 , 87 , 123 , 121 , 91 , 90 , 92 , 142 , 72 , <nl> + 77 , 51 , 87 , 123 , 121 , 92 , 90 , 91 , 141 , 72 , <nl> 73 , 74 , 75 , 76 , 125 , 101 , 104 , 105 , 106 , 107 , <nl> 108 , 109 , 110 , 111 , 112 , 113 , 114 , 115 , 116 , 117 , <nl> - 118 , 120 , 74 , 75 , 76 , 63 , 5 , 6 , 7 , 8 , <nl> - 9 , 10 , 11 , 126 , 131 , 132 , 64 , 65 , 66 , 67 , <nl> + 118 , 120 , 74 , 75 , 76 , 63 , 68 , 69 , 70 , 71 , <nl> + 72 , 73 , 74 , 75 , 76 , 131 , 64 , 65 , 66 , 67 , <nl> 68 , 69 , 70 , 71 , 72 , 73 , 74 , 75 , 76 , 77 , <nl> - 135 , 138 , 136 , 137 , 141 , 139 , 154 , 162 , 148 , 23 , <nl> - 24 , 25 , 26 , 27 , 28 , 29 , 149 , 30 , 145 , 87 , <nl> - 143 , 156 , 161 , 59 , 144 , 130 , 31 , 32 , 119 , 146 , <nl> - 151 , 150 , 152 , 153 , 33 , 0 , 34 , 0 , 35 , 0 , <nl> - 0 , 0 , 155 , 0 , 23 , 24 , 25 , 26 , 27 , 28 , <nl> - 29 , 160 , 30 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , <nl> - 0 , 31 , 32 , 0 , 0 , 0 , 0 , 0 , 0 , 33 , <nl> - 0 , 34 , 0 , 35 , 23 , 24 , 25 , 80 , 27 , 28 , <nl> - 29 , 0 , 30 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , <nl> - 0 , 31 , 32 , 63 , 0 , 0 , 0 , 0 , 0 , 33 , <nl> - 0 , 34 , 0 , 35 , 64 , 65 , 66 , 67 , 68 , 69 , <nl> - 70 , 71 , 72 , 73 , 74 , 75 , 76 , 77 , 63 , 0 , <nl> - 0 , 94 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 64 , <nl> + 5 , 6 , 7 , 8 , 9 , 10 , 11 , 160 , 23 , 24 , <nl> + 25 , 26 , 27 , 28 , 29 , 126 , 30 , 134 , 144 , 87 , <nl> + 142 , 135 , 136 , 137 , 138 , 31 , 32 , 119 , 140 , 149 , <nl> + 146 , 150 , 151 , 33 , 147 , 34 , 154 , 35 , 152 , 159 , <nl> + 153 , 59 , 23 , 24 , 25 , 26 , 27 , 28 , 29 , 158 , <nl> + 30 , 143 , 145 , 130 , 148 , 0 , 0 , 0 , 0 , 31 , <nl> + 32 , 0 , 0 , 0 , 0 , 0 , 0 , 33 , 0 , 34 , <nl> + 0 , 35 , 23 , 24 , 25 , 80 , 27 , 28 , 29 , 0 , <nl> + 30 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 31 , <nl> + 32 , 63 , 0 , 0 , 0 , 0 , 0 , 33 , 0 , 34 , <nl> + 0 , 35 , 64 , 65 , 66 , 67 , 68 , 69 , 70 , 71 , <nl> + 72 , 73 , 74 , 75 , 76 , 77 , 127 , 128 , 63 , 94 , <nl> + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 64 , <nl> 65 , 66 , 67 , 68 , 69 , 70 , 71 , 72 , 73 , 74 , <nl> - 75 , 76 , 77 , 127 , 128 , 63 , 147 , 68 , 69 , 70 , <nl> - 71 , 72 , 73 , 74 , 75 , 76 , 64 , 65 , 66 , 67 , <nl> - 68 , 69 , 70 , 71 , 72 , 73 , 74 , 75 , 76 , 77 , <nl> - 63 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , <nl> - 0 , 64 , 65 , 66 , 67 , 68 , 69 , 70 , 71 , 72 , <nl> - 73 , 74 , 75 , 76 , 77 , 140 , 63 , 0 , 0 , 0 , <nl> - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 64 , 65 , 66 , <nl> + 75 , 76 , 77 , 63 , 0 , 0 , 0 , 0 , 0 , 0 , <nl> + 0 , 0 , 0 , 0 , 64 , 65 , 66 , 67 , 68 , 69 , <nl> + 70 , 71 , 72 , 73 , 74 , 75 , 76 , 77 , 139 , 63 , <nl> + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , <nl> + 64 , 65 , 66 , 67 , 68 , 69 , 70 , 71 , 72 , 73 , <nl> + 74 , 75 , 76 , 77 , 63 , 0 , 0 , 0 , 0 , 0 , <nl> + 0 , 0 , 0 , 0 , 0 , 64 , 63 , 66 , 67 , 68 , <nl> + 69 , 70 , 71 , 72 , 73 , 74 , 75 , 76 , 63 , 66 , <nl> 67 , 68 , 69 , 70 , 71 , 72 , 73 , 74 , 75 , 76 , <nl> - 77 , 63 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , <nl> - 0 , 0 , 64 , 63 , 66 , 67 , 68 , 69 , 70 , 71 , <nl> - 72 , 73 , 74 , 75 , 76 , 63 , 66 , 67 , 68 , 69 , <nl> - 70 , 71 , 72 , 73 , 74 , 75 , 76 , 0 , 0 , 0 , <nl> - 68 , 69 , 70 , 71 , 72 , 73 , 74 , 75 , 76 <nl> + 0 , 0 , 0 , 68 , 69 , 70 , 71 , 72 , 73 , 74 , <nl> + 75 , 76 <nl> } ; <nl> <nl> # define yypact_value_is_default ( yystate ) \ <nl> static const yytype_int16 yycheck [ ] = <nl> 21 , 12 , 50 , 50 , 17 , 18 , 12 , 39 , 13 , 19 , <nl> 39 , 38 , 40 , 30 , 31 , 32 , 33 , 23 , 24 , 25 , <nl> 26 , 27 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , <nl> - 36 , 51 , 49 , 38 , 17 , 39 , 53 , 39 , 44 , 31 , <nl> + 36 , 51 , 49 , 38 , 17 , 39 , 53 , 54 , 44 , 31 , <nl> 32 , 33 , 34 , 35 , 21 , 62 , 63 , 64 , 65 , 66 , <nl> 67 , 68 , 69 , 70 , 71 , 72 , 73 , 74 , 75 , 76 , <nl> - 77 , 78 , 33 , 34 , 35 , 12 , 3 , 4 , 5 , 6 , <nl> - 7 , 8 , 9 , 38 , 91 , 92 , 23 , 24 , 25 , 26 , <nl> + 77 , 78 , 33 , 34 , 35 , 12 , 27 , 28 , 29 , 30 , <nl> + 31 , 32 , 33 , 34 , 35 , 92 , 23 , 24 , 25 , 26 , <nl> 27 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , <nl> - 42 , 44 , 38 , 37 , 44 , 38 , 50 , 44 , 40 , 14 , <nl> - 15 , 16 , 17 , 18 , 19 , 20 , 38 , 22 , 125 , 126 , <nl> - 122 , 17 , 17 , 33 , 123 , 89 , 31 , 32 , 33 , 126 , <nl> - 137 , 136 , 139 , 140 , 39 , - 1 , 41 , - 1 , 43 , - 1 , <nl> - - 1 , - 1 , 149 , - 1 , 14 , 15 , 16 , 17 , 18 , 19 , <nl> - 20 , 158 , 22 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , <nl> - - 1 , 31 , 32 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , 39 , <nl> - - 1 , 41 , - 1 , 43 , 14 , 15 , 16 , 17 , 18 , 19 , <nl> - 20 , - 1 , 22 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , <nl> - - 1 , 31 , 32 , 12 , - 1 , - 1 , - 1 , - 1 , - 1 , 39 , <nl> - - 1 , 41 , - 1 , 43 , 23 , 24 , 25 , 26 , 27 , 28 , <nl> - 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , 12 , - 1 , <nl> - - 1 , 40 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , 23 , <nl> + 3 , 4 , 5 , 6 , 7 , 8 , 9 , 44 , 14 , 15 , <nl> + 16 , 17 , 18 , 19 , 20 , 38 , 22 , 42 , 125 , 126 , <nl> + 122 , 38 , 37 , 44 , 38 , 31 , 32 , 33 , 44 , 136 , <nl> + 40 , 138 , 139 , 39 , 38 , 41 , 17 , 43 , 50 , 17 , <nl> + 147 , 33 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 156 , <nl> + 22 , 123 , 126 , 89 , 135 , - 1 , - 1 , - 1 , - 1 , 31 , <nl> + 32 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , 39 , - 1 , 41 , <nl> + - 1 , 43 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , - 1 , <nl> + 22 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , 31 , <nl> + 32 , 12 , - 1 , - 1 , - 1 , - 1 , - 1 , 39 , - 1 , 41 , <nl> + - 1 , 43 , 23 , 24 , 25 , 26 , 27 , 28 , 29 , 30 , <nl> + 31 , 32 , 33 , 34 , 35 , 36 , 10 , 11 , 12 , 40 , <nl> + - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , 23 , <nl> 24 , 25 , 26 , 27 , 28 , 29 , 30 , 31 , 32 , 33 , <nl> - 34 , 35 , 36 , 10 , 11 , 12 , 40 , 27 , 28 , 29 , <nl> - 30 , 31 , 32 , 33 , 34 , 35 , 23 , 24 , 25 , 26 , <nl> - 27 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , <nl> - 12 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , <nl> - - 1 , 23 , 24 , 25 , 26 , 27 , 28 , 29 , 30 , 31 , <nl> - 32 , 33 , 34 , 35 , 36 , 37 , 12 , - 1 , - 1 , - 1 , <nl> - - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , 23 , 24 , 25 , <nl> + 34 , 35 , 36 , 12 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , <nl> + - 1 , - 1 , - 1 , - 1 , 23 , 24 , 25 , 26 , 27 , 28 , <nl> + 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , 37 , 12 , <nl> + - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , <nl> + 23 , 24 , 25 , 26 , 27 , 28 , 29 , 30 , 31 , 32 , <nl> + 33 , 34 , 35 , 36 , 12 , - 1 , - 1 , - 1 , - 1 , - 1 , <nl> + - 1 , - 1 , - 1 , - 1 , - 1 , 23 , 12 , 25 , 26 , 27 , <nl> + 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , 12 , 25 , <nl> 26 , 27 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , <nl> - 36 , 12 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , <nl> - - 1 , - 1 , 23 , 12 , 25 , 26 , 27 , 28 , 29 , 30 , <nl> - 31 , 32 , 33 , 34 , 35 , 12 , 25 , 26 , 27 , 28 , <nl> - 29 , 30 , 31 , 32 , 33 , 34 , 35 , - 1 , - 1 , - 1 , <nl> - 27 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 <nl> + - 1 , - 1 , - 1 , 27 , 28 , 29 , 30 , 31 , 32 , 33 , <nl> + 34 , 35 <nl> } ; <nl> <nl> / * YYSTOS [ STATE - NUM ] - - The ( internal number of the ) accessing <nl> static const yytype_uint8 yystos [ ] = <nl> 72 , 85 , 81 , 12 , 23 , 24 , 25 , 26 , 27 , 28 , <nl> 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , 43 , 50 , <nl> 17 , 62 , 63 , 72 , 95 , 67 , 68 , 72 , 19 , 38 , <nl> - 72 , 39 , 39 , 40 , 40 , 17 , 18 , 86 , 87 , 88 , <nl> + 72 , 72 , 39 , 40 , 40 , 17 , 18 , 86 , 87 , 88 , <nl> 94 , 72 , 82 , 83 , 72 , 72 , 72 , 72 , 72 , 72 , <nl> 72 , 72 , 72 , 72 , 72 , 72 , 72 , 72 , 72 , 33 , <nl> 72 , 17 , 13 , 38 , 64 , 21 , 38 , 10 , 11 , 69 , <nl> - 96 , 72 , 72 , 77 , 78 , 42 , 38 , 37 , 44 , 38 , <nl> - 37 , 44 , 44 , 95 , 63 , 72 , 68 , 40 , 40 , 38 , <nl> - 88 , 72 , 72 , 72 , 50 , 72 , 17 , 90 , 43 , 50 , <nl> - 72 , 17 , 44 <nl> + 96 , 72 , 77 , 78 , 42 , 38 , 37 , 44 , 38 , 37 , <nl> + 44 , 44 , 95 , 63 , 72 , 68 , 40 , 38 , 88 , 72 , <nl> + 72 , 72 , 50 , 72 , 17 , 90 , 43 , 50 , 72 , 17 , <nl> + 44 <nl> } ; <nl> <nl> # define yyerrok ( yyerrstatus = 0 ) <nl> YYLTYPE yylloc ; <nl> / * Line 1806 of yacc . c * / <nl> # line 245 " Ahuacatl / ahuacatl - grammar . y " <nl> { <nl> - TRI_aql_node_t * node = TRI_CreateNodeLetAql ( context , ( yyvsp [ ( 2 ) - ( 6 ) ] . strval ) , ( yyvsp [ ( 5 ) - ( 6 ) ] . node ) ) ; <nl> + TRI_aql_node_t * node = TRI_CreateNodeLetAql ( context , ( yyvsp [ ( 2 ) - ( 4 ) ] . strval ) , ( yyvsp [ ( 4 ) - ( 4 ) ] . node ) ) ; <nl> if ( ! node ) { <nl> ABORT_OOM <nl> } <nl> YYLTYPE yylloc ; <nl> <nl> <nl> / * Line 1806 of yacc . c * / <nl> - # line 2953 " Ahuacatl / ahuacatl - grammar . c " <nl> + # line 2948 " Ahuacatl / ahuacatl - grammar . c " <nl> default : break ; <nl> } <nl> / * User semantic actions sometimes alter yychar , and that requires <nl> mmm a / Ahuacatl / ahuacatl - grammar . y <nl> ppp b / Ahuacatl / ahuacatl - grammar . y <nl> filter_statement : <nl> ; <nl> <nl> let_statement : <nl> - T_LET variable_name T_ASSIGN T_OPEN expression T_CLOSE { <nl> - TRI_aql_node_t * node = TRI_CreateNodeLetAql ( context , $ 2 , $ 5 ) ; <nl> + T_LET variable_name T_ASSIGN expression { <nl> + TRI_aql_node_t * node = TRI_CreateNodeLetAql ( context , $ 2 , $ 4 ) ; <nl> if ( ! node ) { <nl> ABORT_OOM <nl> } <nl> | slightly simplified grammar | arangodb/arangodb | 3aa30004f6a6fb1a376fa5cf76e27bffd8da8725 | 2012-05-10T09:33:39Z |
mmm a / include / taichi / math / array_3d . h <nl> ppp b / include / taichi / math / array_3d . h <nl> class IndexND < 3 > { <nl> int i , j , k ; <nl> Vector3 storage_offset ; <nl> <nl> + TC_IO_DEF ( i , j , k , x , y , z , storage_offset ) ; <nl> using Index3D = IndexND < 3 > ; <nl> <nl> IndexND ( ) { <nl> class IndexND < 3 > { <nl> Vector3i get_ipos ( ) const { <nl> return Vector3i ( i , j , k ) ; <nl> } <nl> - <nl> - TC_IO_DECL { <nl> - TC_IO ( x ) ; <nl> - TC_IO ( y ) ; <nl> - TC_IO ( z ) ; <nl> - TC_IO ( i ) ; <nl> - TC_IO ( j ) ; <nl> - TC_IO ( k ) ; <nl> - TC_IO ( storage_offset ) ; <nl> - } <nl> } ; <nl> <nl> using Index3D = IndexND < 3 > ; <nl> | array IO update | taichi-dev/taichi | a53222c33513eae5a6bb8c200de7efba094dd6b1 | 2017-12-21T22:33:51Z |
mmm a / Makefile . in <nl> ppp b / Makefile . in <nl> OBJSXBMC + = \ <nl> lib / UnrarXLib / UnrarXLib . a <nl> endif <nl> <nl> - ifneq ( $ ( findstring arm , @ ARCH @ ) , arm ) <nl> - # Can ' t include libhts for arm due to GPLv3 <nl> OBJSXBMC + = \ <nl> lib / libhts / libhts . a <nl> - endif <nl> <nl> # platform dependend objects <nl> ifeq ( $ ( findstring osx , @ ARCH @ ) , osx ) <nl> | [ arm ] changed , libhts is build now | xbmc/xbmc | 5a8468bc5ea519d33ded2cdb512ff29465980f8f | 2011-03-22T22:46:17Z |
mmm a / include / swift / Parse / ASTGen . h <nl> ppp b / include / swift / Parse / ASTGen . h <nl> <nl> # define SWIFT_PARSE_ASTGEN_H <nl> <nl> # include " swift / AST / ASTContext . h " <nl> - # include " swift / AST / Decl . h " <nl> # include " swift / AST / Expr . h " <nl> - # include " swift / Parse / PersistentParserState . h " <nl> # include " swift / Syntax / SyntaxNodes . h " <nl> # include " llvm / ADT / DenseMap . h " <nl> <nl> namespace swift { <nl> / / / Generates AST nodes from Syntax nodes . <nl> class ASTGen { <nl> ASTContext & Context ; <nl> - <nl> - / / / Type cache to prevent multiple transformations of the same syntax node . <nl> - llvm : : DenseMap < syntax : : SyntaxNodeId , TypeRepr * > TypeCache ; <nl> - <nl> - PersistentParserState * * ParserState ; <nl> - <nl> - / / FIXME : remove when Syntax can represent all types and ASTGen can handle them <nl> - / / / Types that cannot be represented by Syntax or generated by ASTGen . <nl> - llvm : : DenseMap < SourceLoc , TypeRepr * > Types ; <nl> + / / A stack of source locations of syntax constructs . Allows us to get the <nl> + / / SourceLoc necessary to create AST nodes for nodes in not - yet - complete <nl> + / / Syntax tree . The topmost item should always correspond to the token / node <nl> + / / that has been parsed / transformed most recently . <nl> + / / todo [ gsoc ] : remove when possible <nl> + llvm : : SmallVector < SourceLoc , 16 > LocStack ; <nl> <nl> public : <nl> - ASTGen ( ASTContext & Context , PersistentParserState * * ParserState ) <nl> - : Context ( Context ) , ParserState ( ParserState ) { } <nl> - <nl> - SourceLoc generate ( syntax : : TokenSyntax Tok , SourceLoc & Loc ) ; <nl> - <nl> - Expr * generate ( syntax : : IntegerLiteralExprSyntax & Expr , SourceLoc & Loc ) ; <nl> - Expr * generate ( syntax : : FloatLiteralExprSyntax & Expr , SourceLoc & Loc ) ; <nl> - Expr * generate ( syntax : : NilLiteralExprSyntax & Expr , SourceLoc & Loc ) ; <nl> - Expr * generate ( syntax : : BooleanLiteralExprSyntax & Expr , SourceLoc & Loc ) ; <nl> - Expr * generate ( syntax : : PoundFileExprSyntax & Expr , SourceLoc & Loc ) ; <nl> - Expr * generate ( syntax : : PoundLineExprSyntax & Expr , SourceLoc & Loc ) ; <nl> - Expr * generate ( syntax : : PoundColumnExprSyntax & Expr , SourceLoc & Loc ) ; <nl> - Expr * generate ( syntax : : PoundFunctionExprSyntax & Expr , SourceLoc & Loc ) ; <nl> - Expr * generate ( syntax : : PoundDsohandleExprSyntax & Expr , SourceLoc & Loc ) ; <nl> - Expr * generate ( syntax : : UnknownExprSyntax & Expr , SourceLoc & Loc ) ; <nl> - <nl> - TypeRepr * generate ( syntax : : TypeSyntax Type , SourceLoc & Loc ) ; <nl> - TypeRepr * generate ( syntax : : SomeTypeSyntax Type , SourceLoc & Loc ) ; <nl> - TypeRepr * generate ( syntax : : CompositionTypeSyntax Type , SourceLoc & Loc ) ; <nl> - TypeRepr * generate ( syntax : : SimpleTypeIdentifierSyntax Type , SourceLoc & Loc ) ; <nl> - TypeRepr * generate ( syntax : : MemberTypeIdentifierSyntax Type , SourceLoc & Loc ) ; <nl> - TypeRepr * generate ( syntax : : DictionaryTypeSyntax Type , SourceLoc & Loc ) ; <nl> - TypeRepr * generate ( syntax : : ArrayTypeSyntax Type , SourceLoc & Loc ) ; <nl> - TypeRepr * generate ( syntax : : TupleTypeSyntax Type , SourceLoc & Loc ) ; <nl> - TypeRepr * generate ( syntax : : AttributedTypeSyntax Type , SourceLoc & Loc ) ; <nl> - TypeRepr * generate ( syntax : : FunctionTypeSyntax Type , SourceLoc & Loc ) ; <nl> - TypeRepr * generate ( syntax : : MetatypeTypeSyntax Type , SourceLoc & Loc ) ; <nl> - TypeRepr * generate ( syntax : : OptionalTypeSyntax Type , SourceLoc & Loc ) ; <nl> - TypeRepr * generate ( syntax : : ImplicitlyUnwrappedOptionalTypeSyntax Type , SourceLoc & Loc ) ; <nl> - TypeRepr * generate ( syntax : : UnknownTypeSyntax Type , SourceLoc & Loc ) ; <nl> - <nl> - TypeRepr * generate ( syntax : : GenericArgumentSyntax Arg , SourceLoc & Loc ) ; <nl> - llvm : : SmallVector < TypeRepr * , 4 > <nl> - generate ( syntax : : GenericArgumentListSyntax Args , SourceLoc & Loc ) ; <nl> + explicit ASTGen ( ASTContext & Context ) : Context ( Context ) { } <nl> + <nl> + IntegerLiteralExpr * generate ( syntax : : IntegerLiteralExprSyntax & Expr ) ; <nl> + FloatLiteralExpr * generate ( syntax : : FloatLiteralExprSyntax & Expr ) ; <nl> + NilLiteralExpr * generate ( syntax : : NilLiteralExprSyntax & Expr ) ; <nl> + BooleanLiteralExpr * generate ( syntax : : BooleanLiteralExprSyntax & Expr ) ; <nl> + MagicIdentifierLiteralExpr * generate ( syntax : : PoundFileExprSyntax & Expr ) ; <nl> + MagicIdentifierLiteralExpr * generate ( syntax : : PoundLineExprSyntax & Expr ) ; <nl> + MagicIdentifierLiteralExpr * generate ( syntax : : PoundColumnExprSyntax & Expr ) ; <nl> + MagicIdentifierLiteralExpr * generate ( syntax : : PoundFunctionExprSyntax & Expr ) ; <nl> + MagicIdentifierLiteralExpr * generate ( syntax : : PoundDsohandleExprSyntax & Expr ) ; <nl> + Expr * generate ( syntax : : UnknownExprSyntax & Expr ) ; <nl> + <nl> + / / / Stores source location necessary for AST creation . <nl> + void pushLoc ( SourceLoc Loc ) ; <nl> <nl> / / / Copy a numeric literal value into AST - owned memory , stripping underscores <nl> / / / so the semantic part of the value can be parsed by APInt / APFloat parsers . <nl> static StringRef copyAndStripUnderscores ( StringRef Orig , ASTContext & Context ) ; <nl> <nl> private : <nl> - Expr * generateMagicIdentifierLiteralExpression ( syntax : : TokenSyntax PoundToken , <nl> - SourceLoc & Loc ) ; <nl> - <nl> - TupleTypeRepr * generateTuple ( syntax : : TokenSyntax LParen , <nl> - syntax : : TupleTypeElementListSyntax Elements , <nl> - syntax : : TokenSyntax RParen , SourceLoc & Loc , <nl> - bool IsFunction = false ) ; <nl> - <nl> - void gatherTypeIdentifierComponents ( <nl> - syntax : : TypeSyntax Component , SourceLoc & Loc , <nl> - llvm : : SmallVectorImpl < ComponentIdentTypeRepr * > & Components ) ; <nl> - <nl> - template < typename T > <nl> - TypeRepr * generateSimpleOrMemberIdentifier ( T Type , SourceLoc & Loc ) ; <nl> - <nl> - template < typename T > <nl> - ComponentIdentTypeRepr * generateIdentifier ( T Type , SourceLoc & Loc ) ; <nl> - <nl> StringRef copyAndStripUnderscores ( StringRef Orig ) ; <nl> <nl> - static SourceLoc advanceLocBegin ( const SourceLoc & Loc , <nl> - const syntax : : Syntax & Node ) ; <nl> - static SourceLoc advanceLocEnd ( const SourceLoc & Loc , <nl> - const syntax : : TokenSyntax & Token ) ; <nl> - static SourceLoc advanceLocAfter ( const SourceLoc & Loc , <nl> - const syntax : : Syntax & Node ) ; <nl> - <nl> - static MagicIdentifierLiteralExpr : : Kind getMagicIdentifierLiteralKind ( tok Kind ) ; <nl> - <nl> - ValueDecl * lookupInScope ( DeclName Name ) ; <nl> - <nl> - TypeRepr * cacheType ( syntax : : TypeSyntax Type , TypeRepr * TypeAST ) ; <nl> - <nl> - TypeRepr * lookupType ( syntax : : TypeSyntax Type ) ; <nl> - <nl> - public : <nl> - TypeRepr * addType ( TypeRepr * Type , const SourceLoc & Loc ) ; <nl> + SourceLoc topLoc ( ) ; <nl> <nl> - bool hasType ( const SourceLoc & Loc ) const ; <nl> + MagicIdentifierLiteralExpr * <nl> + generateMagicIdentifierLiteralExpr ( const syntax : : TokenSyntax & PoundToken ) ; <nl> <nl> - TypeRepr * getType ( const SourceLoc & Loc ) const ; <nl> + / / / Map magic literal tokens such as # file to their MagicIdentifierLiteralExpr <nl> + / / / kind . <nl> + static MagicIdentifierLiteralExpr : : Kind <nl> + getMagicIdentifierLiteralKind ( tok Kind ) ; <nl> } ; <nl> } / / namespace swift <nl> <nl> mmm a / include / swift / Parse / ParsedRawSyntaxNode . h <nl> ppp b / include / swift / Parse / ParsedRawSyntaxNode . h <nl> class ParsedRawSyntaxNode { <nl> / / / Primary used for a deferred missing token . <nl> bool isMissing ( ) const { return IsMissing ; } <nl> <nl> - CharSourceRange getDeferredRange ( ) const { <nl> - switch ( DK ) { <nl> - case DataKind : : DeferredLayout : <nl> - return getDeferredLayoutRange ( ) ; <nl> - case DataKind : : DeferredToken : <nl> - return getDeferredTokenRangeWithoutBackticks ( ) ; <nl> - default : <nl> - llvm_unreachable ( " node not deferred " ) ; <nl> - } <nl> - } <nl> - <nl> / / Recorded Data = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = / / <nl> <nl> - CharSourceRange getRecordedRange ( ) const { <nl> + CharSourceRange getRange ( ) const { <nl> assert ( isRecorded ( ) ) ; <nl> return RecordedData . Range ; <nl> } <nl> class ParsedRawSyntaxNode { <nl> <nl> / / Deferred Layout Data = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = / / <nl> <nl> - CharSourceRange getDeferredLayoutRange ( ) const { <nl> - assert ( DK = = DataKind : : DeferredLayout ) ; <nl> - assert ( ! DeferredLayout . Children . empty ( ) ) ; <nl> - auto getLastNonNullChild = [ this ] ( ) { <nl> - for ( auto & & Child : llvm : : reverse ( getDeferredChildren ( ) ) ) <nl> - if ( ! Child . isNull ( ) ) <nl> - return Child ; <nl> - llvm_unreachable ( " layout node without non - null children " ) ; <nl> - } ; <nl> - auto firstRange = DeferredLayout . Children . front ( ) . getDeferredRange ( ) ; <nl> - auto lastRange = getLastNonNullChild ( ) . getDeferredRange ( ) ; <nl> - firstRange . widen ( lastRange ) ; <nl> - return firstRange ; <nl> - } <nl> ArrayRef < ParsedRawSyntaxNode > getDeferredChildren ( ) const { <nl> assert ( DK = = DataKind : : DeferredLayout ) ; <nl> return DeferredLayout . Children ; <nl> mmm a / include / swift / Parse / Parser . h <nl> ppp b / include / swift / Parse / Parser . h <nl> class Parser { <nl> <nl> const std : : vector < Token > & getSplitTokens ( ) const { return SplitTokens ; } <nl> <nl> - ParsedTokenSyntax markSplitTokenSyntax ( tok Kind , StringRef Txt ) ; <nl> - <nl> void markSplitToken ( tok Kind , StringRef Txt ) ; <nl> <nl> / / / Returns true if the parser reached EOF with incomplete source input , due <nl> class Parser { <nl> } ; <nl> friend class StructureMarkerRAII ; <nl> <nl> - / / / A RAII object that tells the SyntaxParsingContext to defer Syntax nodes . <nl> - class DeferringContextRAII { <nl> - SyntaxParsingContext & Ctx ; <nl> - bool WasDeferring ; <nl> - <nl> - public : <nl> - explicit DeferringContextRAII ( SyntaxParsingContext & SPCtx ) <nl> - : Ctx ( SPCtx ) , WasDeferring ( Ctx . shouldDefer ( ) ) { <nl> - Ctx . setShouldDefer ( ) ; <nl> - } <nl> - <nl> - ~ DeferringContextRAII ( ) { <nl> - Ctx . setShouldDefer ( WasDeferring ) ; <nl> - } <nl> - } ; <nl> - <nl> / / / The stack of structure markers indicating the locations of <nl> / / / structural elements actively being parsed , including the start <nl> / / / of declarations , statements , and opening operators of various <nl> class Parser { <nl> assert ( Tok . is ( K ) & & " Consuming wrong token kind " ) ; <nl> return consumeTokenSyntax ( ) ; <nl> } <nl> - SourceLoc leadingTriviaLoc ( ) { <nl> - return Tok . getLoc ( ) . getAdvancedLoc ( - LeadingTrivia . getLength ( ) ) ; <nl> - } <nl> - <nl> - ParsedTokenSyntax consumeIdentifierSyntax ( bool allowDollarIdentifier = false ) { <nl> - assert ( Tok . isAny ( tok : : identifier , tok : : kw_self , tok : : kw_Self ) ) ; <nl> - <nl> - Context . getIdentifier ( Tok . getText ( ) ) ; <nl> - <nl> - if ( Tok . getText ( ) [ 0 ] = = ' $ ' & & ! allowDollarIdentifier ) <nl> - diagnoseDollarIdentifier ( Tok ) ; <nl> - <nl> - return consumeTokenSyntax ( ) ; <nl> - } <nl> <nl> SourceLoc consumeIdentifier ( Identifier * Result = nullptr , <nl> bool allowDollarIdentifier = false ) { <nl> class Parser { <nl> return consumeToken ( ) ; <nl> } <nl> <nl> - ParsedTokenSyntax consumeArgumentLabelSyntax ( ) { <nl> - assert ( Tok . canBeArgumentLabel ( ) ) ; <nl> - if ( ! Tok . is ( tok : : kw__ ) ) { <nl> - Tok . setKind ( tok : : identifier ) ; <nl> - <nl> - if ( Tok . getText ( ) [ 0 ] = = ' $ ' ) <nl> - diagnoseDollarIdentifier ( Tok ) ; <nl> - } <nl> - return consumeTokenSyntax ( ) ; <nl> - } <nl> - <nl> / / / When we have a token that is an identifier starting with ' $ ' , <nl> / / / diagnose it if not permitted in this mode . <nl> void diagnoseDollarIdentifier ( const Token & tok ) { <nl> class Parser { <nl> / / / source location . <nl> SourceLoc getEndOfPreviousLoc ( ) const ; <nl> <nl> - / / / If the current token is the specified kind , consume it and <nl> - / / / return it . Otherwise , return None without consuming it . <nl> - llvm : : Optional < ParsedTokenSyntax > consumeTokenSyntaxIf ( tok K ) { <nl> - if ( Tok . isNot ( K ) ) <nl> - return llvm : : None ; <nl> - return consumeTokenSyntax ( ) ; <nl> - } <nl> - <nl> / / / If the current token is the specified kind , consume it and <nl> / / / return true . Otherwise , return false without consuming it . <nl> bool consumeIf ( tok K ) { <nl> class Parser { <nl> / / / Read tokens until we get to one of the specified tokens , then <nl> / / / return without consuming it . Because we cannot guarantee that the token <nl> / / / will ever occur , this skips to some likely good stopping point . <nl> - void skipUntilSyntax ( llvm : : SmallVectorImpl < ParsedSyntax > & Skipped , tok T1 , <nl> - tok T2 = tok : : NUM_TOKENS ) ; <nl> void skipUntil ( tok T1 , tok T2 = tok : : NUM_TOKENS ) ; <nl> void skipUntilAnyOperator ( ) ; <nl> <nl> class Parser { <nl> / / / Applies heuristics that are suitable when trying to find the end of a list <nl> / / / of generic parameters , generic arguments , or list of types in a protocol <nl> / / / composition . <nl> - void <nl> - skipUntilGreaterInTypeListSyntax ( llvm : : SmallVectorImpl < ParsedSyntax > & Skipped , <nl> - bool protocolComposition = false ) ; <nl> SourceLoc skipUntilGreaterInTypeList ( bool protocolComposition = false ) ; <nl> <nl> / / / skipUntilDeclStmtRBrace - Skip to the next decl or ' } ' . <nl> class Parser { <nl> void skipUntilDeclStmtRBrace ( tok T1 , tok T2 ) ; <nl> <nl> void skipUntilDeclRBrace ( tok T1 , tok T2 ) ; <nl> - <nl> + <nl> void skipListUntilDeclRBrace ( SourceLoc startLoc , tok T1 , tok T2 ) ; <nl> - void skipListUntilDeclRBraceSyntax ( SmallVectorImpl < ParsedSyntax > & Skipped , <nl> - SourceLoc startLoc , tok T1 , tok T2 ) ; <nl> - <nl> + <nl> / / / Skip a single token , but match parentheses , braces , and square brackets . <nl> / / / <nl> / / / Note : this does \ em not match angle brackets ( " < " and " > " ) ! These are <nl> / / / matched in the source when they refer to a generic type , <nl> / / / but not when used as comparison operators . <nl> - void skipSingleSyntax ( llvm : : SmallVectorImpl < ParsedSyntax > & Skipped ) ; <nl> void skipSingle ( ) ; <nl> <nl> / / / Skip until the next ' # else ' , ' # endif ' or until eof . <nl> class Parser { <nl> / / / Consume the starting ' < ' of the current token , which may either <nl> / / / be a complete ' < ' token or some kind of operator token starting with ' < ' , <nl> / / / e . g . , ' < > ' . <nl> - ParsedTokenSyntax consumeStartingLessSyntax ( ) ; <nl> SourceLoc consumeStartingLess ( ) ; <nl> <nl> / / / Consume the starting ' > ' of the current token , which may either <nl> / / / be a complete ' > ' token or some kind of operator token starting with ' > ' , <nl> / / / e . g . , ' > > ' . <nl> - ParsedTokenSyntax consumeStartingGreaterSyntax ( ) ; <nl> SourceLoc consumeStartingGreater ( ) ; <nl> <nl> / / / Consume the starting character of the current token , and split the <nl> / / / remainder of the token into a new token ( or tokens ) . <nl> - ParsedTokenSyntax <nl> - consumeStartingCharacterOfCurrentTokenSyntax ( tok Kind , size_t Len = 1 ) ; <nl> - SourceLoc consumeStartingCharacterOfCurrentToken ( tok Kind , size_t Len = 1 ) ; <nl> + SourceLoc <nl> + consumeStartingCharacterOfCurrentToken ( tok Kind = tok : : oper_binary_unspaced , <nl> + size_t Len = 1 ) ; <nl> <nl> swift : : ScopeInfo & getScopeInfo ( ) { return State - > getScopeInfo ( ) ; } <nl> <nl> class Parser { <nl> / / / <nl> / / / \ returns false on success , true on error . <nl> bool parseIdentifier ( Identifier & Result , SourceLoc & Loc , const Diagnostic & D ) ; <nl> - llvm : : Optional < ParsedTokenSyntax > parseIdentifierSyntax ( const Diagnostic & D ) ; <nl> <nl> / / / Consume an identifier with a specific expected name . This is useful for <nl> / / / contextually sensitive keywords that must always be present . <nl> class Parser { <nl> / / / <nl> / / / If the input is malformed , this emits the specified error diagnostic . <nl> bool parseToken ( tok K , SourceLoc & TokLoc , const Diagnostic & D ) ; <nl> - llvm : : Optional < ParsedTokenSyntax > parseTokenSyntax ( tok K , <nl> - const Diagnostic & D ) ; <nl> - <nl> + <nl> template < typename . . . DiagArgTypes , typename . . . ArgTypes > <nl> bool parseToken ( tok K , Diag < DiagArgTypes . . . > ID , ArgTypes . . . Args ) { <nl> SourceLoc L ; <nl> class Parser { <nl> bool parseMatchingToken ( tok K , SourceLoc & TokLoc , Diag < > ErrorDiag , <nl> SourceLoc OtherLoc ) ; <nl> <nl> - llvm : : Optional < ParsedTokenSyntax > <nl> - parseMatchingTokenSyntax ( tok K , Diag < > ErrorDiag , SourceLoc OtherLoc ) ; <nl> - <nl> / / / Returns the proper location for a missing right brace , parenthesis , etc . <nl> SourceLoc getLocForMissingMatchingToken ( ) const ; <nl> <nl> class Parser { <nl> bool AllowSepAfterLast , Diag < > ErrorDiag , <nl> syntax : : SyntaxKind Kind , <nl> llvm : : function_ref < ParserStatus ( ) > callback ) ; <nl> - ParserStatus parseListSyntax ( tok RightK , SourceLoc LeftLoc , <nl> - llvm : : Optional < ParsedTokenSyntax > & LastComma , <nl> - SourceLoc & RightLoc , <nl> - llvm : : Optional < ParsedTokenSyntax > & Right , <nl> - llvm : : SmallVectorImpl < ParsedSyntax > & Junk , <nl> - bool AllowSepAfterLast , Diag < > ErrorDiag , <nl> - llvm : : function_ref < ParserStatus ( ) > callback ) ; <nl> <nl> void consumeTopLevelDecl ( ParserPosition BeginParserPosition , <nl> TopLevelCodeDecl * TLCD ) ; <nl> class Parser { <nl> <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - = = = / / <nl> / / Type Parsing <nl> + <nl> + ParserResult < TypeRepr > parseType ( ) ; <nl> + ParserResult < TypeRepr > parseType ( Diag < > MessageID , <nl> + bool HandleCodeCompletion = true , <nl> + bool IsSILFuncDecl = false ) ; <nl> <nl> - using TypeASTResult = ParserResult < TypeRepr > ; <nl> - using TypeResult = ParsedSyntaxResult < ParsedTypeSyntax > ; <nl> - using TypeErrorResult = ParsedSyntaxResult < ParsedUnknownTypeSyntax > ; <nl> + ParserResult < TypeRepr > <nl> + parseTypeSimpleOrComposition ( Diag < > MessageID , <nl> + bool HandleCodeCompletion = true ) ; <nl> <nl> + ParserResult < TypeRepr > parseTypeSimple ( Diag < > MessageID , <nl> + bool HandleCodeCompletion = true ) ; <nl> + <nl> + / / / Parse layout constraint . <nl> LayoutConstraint parseLayoutConstraint ( Identifier LayoutConstraintID ) ; <nl> <nl> - TypeASTResult parseType ( ) ; <nl> - TypeASTResult parseType ( Diag < > MessageID , bool HandleCodeCompletion = true , <nl> - bool IsSILFuncDecl = false ) ; <nl> - ParserStatus <nl> - parseGenericArgumentsAST ( llvm : : SmallVectorImpl < TypeRepr * > & ArgsAST , <nl> - SourceLoc & LAngleLoc , SourceLoc & RAngleLoc ) ; <nl> - TypeASTResult parseSILBoxType ( GenericParamList * generics , <nl> - const TypeAttributes & attrs , <nl> - Optional < Scope > & GenericsScope ) ; <nl> - TypeASTResult parseTypeSimpleOrCompositionAST ( Diag < > MessageID , <nl> - bool HandleCodeCompletion ) ; <nl> - TypeASTResult parseAnyTypeAST ( ) ; <nl> - <nl> - ParsedSyntaxResult < ParsedGenericArgumentClauseSyntax > <nl> - parseGenericArgumentClauseSyntax ( ) ; <nl> - <nl> - TypeResult parseTypeSimple ( Diag < > MessageID , bool HandleCodeCompletion ) ; <nl> - TypeResult parseTypeSimpleOrComposition ( Diag < > MessageID , bool HandleCodeCompletion ) ; <nl> - TypeResult parseTypeIdentifier ( ) ; <nl> - TypeResult parseAnyType ( ) ; <nl> - TypeResult parseTypeTupleBody ( ) ; <nl> - TypeResult parseTypeCollection ( ) ; <nl> - TypeResult parseMetatypeType ( ParsedTypeSyntax Base ) ; <nl> - TypeResult parseOptionalType ( ParsedTypeSyntax Base ) ; <nl> - TypeResult parseImplicitlyUnwrappedOptionalType ( ParsedTypeSyntax Base ) ; <nl> - <nl> - TypeErrorResult parseTypeArray ( ParsedTypeSyntax Base , SourceLoc BaseLoc ) ; <nl> - TypeErrorResult parseOldStyleProtocolComposition ( ) ; <nl> + ParserStatus parseGenericArguments ( SmallVectorImpl < TypeRepr * > & Args , <nl> + SourceLoc & LAngleLoc , <nl> + SourceLoc & RAngleLoc ) ; <nl> + <nl> + ParserResult < TypeRepr > parseTypeIdentifier ( ) ; <nl> + ParserResult < TypeRepr > parseOldStyleProtocolComposition ( ) ; <nl> + ParserResult < CompositionTypeRepr > parseAnyType ( ) ; <nl> + ParserResult < TypeRepr > parseSILBoxType ( GenericParamList * generics , <nl> + const TypeAttributes & attrs , <nl> + Optional < Scope > & GenericsScope ) ; <nl> + <nl> + ParserResult < TupleTypeRepr > parseTypeTupleBody ( ) ; <nl> + ParserResult < TypeRepr > parseTypeArray ( TypeRepr * Base ) ; <nl> + <nl> + / / / Parse a collection type . <nl> + / / / type - simple : <nl> + / / / ' [ ' type ' ] ' <nl> + / / / ' [ ' type ' : ' type ' ] ' <nl> + SyntaxParserResult < ParsedTypeSyntax , TypeRepr > parseTypeCollection ( ) ; <nl> + <nl> + SyntaxParserResult < ParsedTypeSyntax , OptionalTypeRepr > <nl> + parseTypeOptional ( TypeRepr * Base ) ; <nl> + <nl> + SyntaxParserResult < ParsedTypeSyntax , ImplicitlyUnwrappedOptionalTypeRepr > <nl> + parseTypeImplicitlyUnwrappedOptional ( TypeRepr * Base ) ; <nl> <nl> bool isOptionalToken ( const Token & T ) const ; <nl> - ParsedTokenSyntax consumeOptionalTokenSyntax ( ) ; <nl> SourceLoc consumeOptionalToken ( ) ; <nl> - <nl> + <nl> bool isImplicitlyUnwrappedOptionalToken ( const Token & T ) const ; <nl> - ParsedTokenSyntax consumeImplicitlyUnwrappedOptionalTokenSyntax ( ) ; <nl> SourceLoc consumeImplicitlyUnwrappedOptionalToken ( ) ; <nl> <nl> TypeRepr * applyAttributeToType ( TypeRepr * Ty , const TypeAttributes & Attr , <nl> mmm a / include / swift / Parse / ParserResult . h <nl> ppp b / include / swift / Parse / ParserResult . h <nl> template < typename T > class ParserResult { <nl> void setHasCodeCompletion ( ) { <nl> PtrAndBits . setInt ( PtrAndBits . getInt ( ) | IsError | IsCodeCompletion ) ; <nl> } <nl> - <nl> - ParserStatus getStatus ( ) const ; <nl> } ; <nl> <nl> / / / Create a successful parser result . <nl> template < typename T > ParserResult < T > : : ParserResult ( ParserStatus Status ) { <nl> setHasCodeCompletion ( ) ; <nl> } <nl> <nl> - template < typename T > <nl> - ParserStatus ParserResult < T > : : getStatus ( ) const { <nl> - ParserStatus S ; <nl> - if ( isParseError ( ) ) <nl> - S . setIsParseError ( ) ; <nl> - if ( hasCodeCompletion ( ) ) <nl> - S . setHasCodeCompletion ( ) ; <nl> - return S ; <nl> - } <nl> - <nl> } / / namespace swift <nl> <nl> # endif / / LLVM_SWIFT_PARSER_PARSER_RESULT_H <nl> mmm a / include / swift / Parse / SyntaxParserResult . h <nl> ppp b / include / swift / Parse / SyntaxParserResult . h <nl> <nl> <nl> namespace swift { <nl> <nl> - enum class ResultDataKind : uint8_t { <nl> - Success , <nl> - Error , <nl> - CodeCompletion , <nl> - } ; <nl> - <nl> - template < typename ParsedSyntaxNode > class ParsedSyntaxResult { <nl> - public : <nl> - template < typename OtherParsedSyntaxNode > <nl> - friend class ParsedSyntaxResult ; <nl> - <nl> - private : <nl> - / / todo [ gsoc ] : use some kind of a proper sum type <nl> - llvm : : Optional < ParsedSyntaxNode > SuccessNode ; <nl> - llvm : : Optional < llvm : : SmallVector < ParsedSyntax , 0 > > ErrorNodes ; <nl> - llvm : : Optional < llvm : : SmallVector < ParsedSyntax , 0 > > CodeCompletionNodes ; <nl> - <nl> - ResultDataKind DK ; <nl> - <nl> - public : <nl> - explicit ParsedSyntaxResult ( ParsedSyntaxNode Node ) <nl> - : SuccessNode ( Node ) , DK ( ResultDataKind : : Success ) { } <nl> - <nl> - ParsedSyntaxResult ( ArrayRef < ParsedSyntax > Nodes , <nl> - ResultDataKind Kind ) <nl> - : DK ( Kind ) { <nl> - switch ( DK ) { <nl> - case ResultDataKind : : Error : <nl> - ErrorNodes . emplace ( Nodes . begin ( ) , Nodes . end ( ) ) ; <nl> - break ; <nl> - case ResultDataKind : : CodeCompletion : <nl> - CodeCompletionNodes . emplace ( Nodes . begin ( ) , Nodes . end ( ) ) ; <nl> - break ; <nl> - default : <nl> - llvm_unreachable ( " success cannot contain multiple nodes " ) ; <nl> - } <nl> - } <nl> - <nl> - ParsedSyntaxResult ( const ParsedSyntaxResult & Other ) { <nl> - DK = Other . DK ; <nl> - <nl> - switch ( DK ) { <nl> - case ResultDataKind : : Success : <nl> - SuccessNode = Other . SuccessNode ; <nl> - break ; <nl> - case ResultDataKind : : Error : <nl> - ErrorNodes = Other . ErrorNodes ; <nl> - break ; <nl> - case ResultDataKind : : CodeCompletion : <nl> - CodeCompletionNodes = Other . CodeCompletionNodes ; <nl> - break ; <nl> - } <nl> - } <nl> - <nl> - template < typename OtherParsedSyntaxNode , <nl> - typename Enable = typename std : : enable_if < std : : is_base_of < <nl> - ParsedSyntaxNode , OtherParsedSyntaxNode > : : value > : : type > <nl> - ParsedSyntaxResult ( ParsedSyntaxResult < OtherParsedSyntaxNode > Other ) { <nl> - DK = Other . DK ; <nl> - <nl> - switch ( DK ) { <nl> - case ResultDataKind : : Success : <nl> - SuccessNode = * Other . SuccessNode ; <nl> - break ; <nl> - case ResultDataKind : : Error : <nl> - ErrorNodes = * Other . ErrorNodes ; <nl> - break ; <nl> - case ResultDataKind : : CodeCompletion : <nl> - CodeCompletionNodes = * Other . CodeCompletionNodes ; <nl> - break ; <nl> - } <nl> - } <nl> - <nl> - bool isSuccess ( ) const { <nl> - return DK = = ResultDataKind : : Success ; <nl> - } <nl> - <nl> - bool isError ( ) const { <nl> - return DK = = ResultDataKind : : Error ; <nl> - } <nl> - <nl> - bool isCodeCompletion ( ) const { <nl> - return DK = = ResultDataKind : : CodeCompletion ; <nl> - } <nl> - <nl> - ParsedSyntaxNode getResult ( ) const { <nl> - assert ( isSuccess ( ) & & " unsuccessful parse doesn ' t have any result " ) ; <nl> - return * SuccessNode ; <nl> - } <nl> - <nl> - ArrayRef < ParsedSyntax > getUnknownNodes ( ) const { <nl> - assert ( ! isSuccess ( ) & & " successful parse doesn ' t contain unknown nodes " ) ; <nl> - switch ( DK ) { <nl> - case ResultDataKind : : Error : <nl> - return * ErrorNodes ; <nl> - case ResultDataKind : : CodeCompletion : <nl> - return * CodeCompletionNodes ; <nl> - default : <nl> - llvm_unreachable ( " cannot get here " ) ; <nl> - } <nl> - } <nl> - <nl> - ParserStatus getStatus ( ) const { <nl> - ParserStatus S ; <nl> - if ( isError ( ) ) <nl> - S . setIsParseError ( ) ; <nl> - if ( isCodeCompletion ( ) ) <nl> - S . setHasCodeCompletion ( ) ; <nl> - return S ; <nl> - } <nl> - } ; <nl> - <nl> - template < typename ParsedSyntaxNode > <nl> - static ParsedSyntaxResult < ParsedSyntaxNode > <nl> - makeParsedSuccess ( ParsedSyntaxNode Node ) { <nl> - return ParsedSyntaxResult < ParsedSyntaxNode > ( Node ) ; <nl> - } <nl> - <nl> - template < typename ParsedSyntaxNode > <nl> - static ParsedSyntaxResult < ParsedSyntaxNode > <nl> - makeParsedError ( ArrayRef < ParsedSyntax > Nodes ) { <nl> - return ParsedSyntaxResult < ParsedSyntaxNode > ( Nodes , ResultDataKind : : Error ) ; <nl> - } <nl> - <nl> - template < typename ParsedSyntaxNode > <nl> - static ParsedSyntaxResult < ParsedSyntaxNode > makeParsedErrorEmpty ( ) { <nl> - return ParsedSyntaxResult < ParsedSyntaxNode > ( { } , ResultDataKind : : Error ) ; <nl> - } <nl> - <nl> - template < typename ParsedSyntaxNode > <nl> - static ParsedSyntaxResult < ParsedSyntaxNode > <nl> - makeParsedCodeCompletion ( ArrayRef < ParsedSyntax > Nodes ) { <nl> - return ParsedSyntaxResult < ParsedSyntaxNode > ( Nodes , <nl> - ResultDataKind : : CodeCompletion ) ; <nl> - } <nl> - <nl> - template < typename ParsedSyntaxNode > <nl> - static ParsedSyntaxResult < ParsedSyntaxNode > <nl> - makeParsedResult ( ArrayRef < ParsedSyntax > Nodes , <nl> - ParserStatus Status ) { <nl> - return Status . hasCodeCompletion ( ) <nl> - ? makeParsedCodeCompletion < ParsedSyntaxNode > ( Nodes ) <nl> - : makeParsedError < ParsedSyntaxNode > ( Nodes ) ; <nl> - } <nl> - <nl> template < typename Syntax , typename AST > class SyntaxParserResult { <nl> llvm : : Optional < Syntax > SyntaxNode ; <nl> ParserResult < AST > ASTResult ; <nl> mmm a / include / swift / Parse / SyntaxParsingContext . h <nl> ppp b / include / swift / Parse / SyntaxParsingContext . h <nl> class alignas ( 1 < < SyntaxAlignInBits ) SyntaxParsingContext { <nl> / / / true if it ' s in backtracking context . <nl> bool IsBacktracking = false ; <nl> <nl> - / / / true if ParsedSyntaxBuilders and ParsedSyntaxRecorder should create <nl> - / / / deferred nodes <nl> - bool ShouldDefer = false ; <nl> - <nl> / / / Create a syntax node using the tail \ c N elements of collected parts and <nl> / / / replace those parts with the single result . <nl> void createNodeInPlace ( SyntaxKind Kind , size_t N , <nl> class alignas ( 1 < < SyntaxAlignInBits ) SyntaxParsingContext { <nl> SyntaxParsingContext ( SyntaxParsingContext * & CtxtHolder ) <nl> : RootDataOrParent ( CtxtHolder ) , CtxtHolder ( CtxtHolder ) , <nl> RootData ( CtxtHolder - > RootData ) , Offset ( RootData - > Storage . size ( ) ) , <nl> - IsBacktracking ( CtxtHolder - > IsBacktracking ) , <nl> - ShouldDefer ( CtxtHolder - > ShouldDefer ) { <nl> + IsBacktracking ( CtxtHolder - > IsBacktracking ) { <nl> assert ( CtxtHolder - > isTopOfContextStack ( ) & & <nl> " SyntaxParsingContext cannot have multiple children " ) ; <nl> assert ( CtxtHolder - > Mode ! = AccumulationMode : : SkippedForIncrementalUpdate & & <nl> class alignas ( 1 < < SyntaxAlignInBits ) SyntaxParsingContext { <nl> / / / Add Syntax to the parts . <nl> void addSyntax ( ParsedSyntax Node ) ; <nl> <nl> - template < typename SyntaxNode > <nl> + template < SyntaxKind Kind > <nl> bool isTopNode ( ) { <nl> - auto parts = getParts ( ) ; <nl> - return ( ! parts . empty ( ) & & SyntaxNode : : kindof ( parts . back ( ) . getKind ( ) ) ) ; <nl> + return getStorage ( ) . back ( ) . getKind ( ) = = Kind ; <nl> } <nl> <nl> / / / Returns the topmost Syntax node . <nl> template < typename SyntaxNode > SyntaxNode topNode ( ) { <nl> ParsedRawSyntaxNode TopNode = getStorage ( ) . back ( ) ; <nl> <nl> - if ( TopNode . isRecorded ( ) ) { <nl> - OpaqueSyntaxNode OpaqueNode = TopNode . getOpaqueNode ( ) ; <nl> - return getSyntaxCreator ( ) . getLibSyntaxNodeFor < SyntaxNode > ( OpaqueNode ) ; <nl> - } <nl> - <nl> - return getSyntaxCreator ( ) . createNode < SyntaxNode > ( TopNode ) ; <nl> + if ( IsBacktracking ) <nl> + return getSyntaxCreator ( ) . createNode < SyntaxNode > ( TopNode ) ; <nl> + <nl> + OpaqueSyntaxNode OpaqueNode = TopNode . getOpaqueNode ( ) ; <nl> + return getSyntaxCreator ( ) . getLibSyntaxNodeFor < SyntaxNode > ( OpaqueNode ) ; <nl> } <nl> <nl> - template < typename SyntaxNode > <nl> + template < typename SyntaxNode > <nl> llvm : : Optional < SyntaxNode > popIf ( ) { <nl> auto & Storage = getStorage ( ) ; <nl> - if ( Storage . size ( ) < = Offset ) <nl> - return llvm : : None ; <nl> - auto rawNode = Storage . back ( ) ; <nl> - if ( ! SyntaxNode : : kindof ( rawNode . getKind ( ) ) ) <nl> - return llvm : : None ; <nl> - Storage . pop_back ( ) ; <nl> - return SyntaxNode ( rawNode ) ; <nl> + assert ( Storage . size ( ) > Offset ) ; <nl> + if ( SyntaxNode : : kindof ( Storage . back ( ) . getKind ( ) ) ) { <nl> + auto rawNode = std : : move ( Storage . back ( ) ) ; <nl> + Storage . pop_back ( ) ; <nl> + return SyntaxNode ( rawNode ) ; <nl> + } <nl> + return None ; <nl> } <nl> <nl> ParsedTokenSyntax popToken ( ) ; <nl> class alignas ( 1 < < SyntaxAlignInBits ) SyntaxParsingContext { <nl> <nl> bool isBacktracking ( ) const { return IsBacktracking ; } <nl> <nl> - void setShouldDefer ( bool Value = true ) { ShouldDefer = Value ; } <nl> - <nl> - bool shouldDefer ( ) const { <nl> - return ShouldDefer | | IsBacktracking | | Mode = = AccumulationMode : : Discard ; <nl> - } <nl> - <nl> / / / Explicitly finalizing syntax tree creation . <nl> / / / This function will be called during the destroying of a root syntax <nl> / / / parsing context . However , we can explicitly call this function to get <nl> mmm a / include / swift / Parse / Token . h <nl> ppp b / include / swift / Parse / Token . h <nl> class Token { <nl> <nl> / / / True if the token is any keyword . <nl> bool isKeyword ( ) const { <nl> - return isTokenKeyword ( Kind ) ; <nl> + switch ( Kind ) { <nl> + # define KEYWORD ( X ) case tok : : kw_ # # X : return true ; <nl> + # include " swift / Syntax / TokenKinds . def " <nl> + default : return false ; <nl> + } <nl> } <nl> <nl> / / / True if the token is any literal . <nl> mmm a / include / swift / Syntax / TokenKinds . h <nl> ppp b / include / swift / Syntax / TokenKinds . h <nl> bool isTokenTextDetermined ( tok kind ) ; <nl> / / / If a token kind has determined text , return the text ; otherwise assert . <nl> StringRef getTokenText ( tok kind ) ; <nl> <nl> - / / / True if the token is any keyword . <nl> - bool isTokenKeyword ( tok kind ) ; <nl> - <nl> void dumpTokenKind ( llvm : : raw_ostream & os , tok kind ) ; <nl> } / / end namespace swift <nl> <nl> mmm a / lib / AST / ASTDumper . cpp <nl> ppp b / lib / AST / ASTDumper . cpp <nl> class PrintTypeRepr : public TypeReprVisitor < PrintTypeRepr > { <nl> PrintWithColorRAII ( OS , ParenthesisColor ) < < ' ) ' ; <nl> } <nl> <nl> - void visitImplicitlyUnwrappedOptionalTypeRepr ( <nl> - ImplicitlyUnwrappedOptionalTypeRepr * T ) { <nl> - printCommon ( " implicitly_unwrapped_optional " ) ; <nl> - OS < < " \ n " ; <nl> - printRec ( T - > getBase ( ) ) ; <nl> - } <nl> - <nl> void visitCompositionTypeRepr ( CompositionTypeRepr * T ) { <nl> printCommon ( " type_composite " ) ; <nl> for ( auto elem : T - > getTypes ( ) ) { <nl> mmm a / lib / Parse / ASTGen . cpp <nl> ppp b / lib / Parse / ASTGen . cpp <nl> <nl> / / <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> <nl> - # include " swift / Basic / SourceManager . h " <nl> # include " swift / Parse / ASTGen . h " <nl> <nl> using namespace swift ; <nl> using namespace swift : : syntax ; <nl> <nl> - SourceLoc ASTGen : : generate ( TokenSyntax Tok , SourceLoc & Loc ) { <nl> - return advanceLocBegin ( Loc , Tok ) ; <nl> + IntegerLiteralExpr * ASTGen : : generate ( IntegerLiteralExprSyntax & Expr ) { <nl> + TokenSyntax Digits = Expr . getDigits ( ) ; <nl> + StringRef Text = copyAndStripUnderscores ( Digits . getText ( ) ) ; <nl> + SourceLoc Loc = topLoc ( ) ; <nl> + return new ( Context ) IntegerLiteralExpr ( Text , Loc ) ; <nl> } <nl> <nl> - Expr * ASTGen : : generate ( IntegerLiteralExprSyntax & Expr , SourceLoc & Loc ) { <nl> - auto Digits = Expr . getDigits ( ) ; <nl> - auto Text = copyAndStripUnderscores ( Digits . getText ( ) ) ; <nl> - auto DigitsLoc = advanceLocBegin ( Loc , Digits ) ; <nl> - return new ( Context ) IntegerLiteralExpr ( Text , DigitsLoc ) ; <nl> + FloatLiteralExpr * ASTGen : : generate ( FloatLiteralExprSyntax & Expr ) { <nl> + TokenSyntax FloatingDigits = Expr . getFloatingDigits ( ) ; <nl> + StringRef Text = copyAndStripUnderscores ( FloatingDigits . getText ( ) ) ; <nl> + SourceLoc Loc = topLoc ( ) ; <nl> + return new ( Context ) FloatLiteralExpr ( Text , Loc ) ; <nl> } <nl> <nl> - Expr * ASTGen : : generate ( FloatLiteralExprSyntax & Expr , SourceLoc & Loc ) { <nl> - auto Digits = Expr . getFloatingDigits ( ) ; <nl> - auto Text = copyAndStripUnderscores ( Digits . getText ( ) ) ; <nl> - auto DigitsLoc = advanceLocBegin ( Loc , Digits ) ; <nl> - return new ( Context ) FloatLiteralExpr ( Text , DigitsLoc ) ; <nl> + NilLiteralExpr * ASTGen : : generate ( NilLiteralExprSyntax & Expr ) { <nl> + TokenSyntax Nil = Expr . getNilKeyword ( ) ; <nl> + SourceLoc Loc = topLoc ( ) ; <nl> + return new ( Context ) NilLiteralExpr ( Loc ) ; <nl> } <nl> <nl> - Expr * ASTGen : : generate ( NilLiteralExprSyntax & Expr , SourceLoc & Loc ) { <nl> - auto Nil = Expr . getNilKeyword ( ) ; <nl> - auto NilLoc = advanceLocBegin ( Loc , Nil ) ; <nl> - return new ( Context ) NilLiteralExpr ( NilLoc ) ; <nl> + BooleanLiteralExpr * ASTGen : : generate ( BooleanLiteralExprSyntax & Expr ) { <nl> + TokenSyntax Literal = Expr . getBooleanLiteral ( ) ; <nl> + bool Value = Literal . getTokenKind ( ) = = tok : : kw_true ; <nl> + SourceLoc Loc = topLoc ( ) ; <nl> + return new ( Context ) BooleanLiteralExpr ( Value , Loc ) ; <nl> } <nl> <nl> - Expr * ASTGen : : generate ( BooleanLiteralExprSyntax & Expr , SourceLoc & Loc ) { <nl> - auto Boolean = Expr . getBooleanLiteral ( ) ; <nl> - auto Value = Boolean . getTokenKind ( ) = = tok : : kw_true ; <nl> - auto BooleanLoc = advanceLocBegin ( Loc , Boolean ) ; <nl> - return new ( Context ) BooleanLiteralExpr ( Value , BooleanLoc ) ; <nl> + MagicIdentifierLiteralExpr * ASTGen : : generate ( PoundFileExprSyntax & Expr ) { <nl> + return generateMagicIdentifierLiteralExpr ( Expr . getPoundFile ( ) ) ; <nl> } <nl> <nl> - Expr * ASTGen : : generate ( PoundFileExprSyntax & Expr , SourceLoc & Loc ) { <nl> - return generateMagicIdentifierLiteralExpression ( Expr . getPoundFile ( ) , Loc ) ; <nl> + MagicIdentifierLiteralExpr * ASTGen : : generate ( PoundLineExprSyntax & Expr ) { <nl> + return generateMagicIdentifierLiteralExpr ( Expr . getPoundLine ( ) ) ; <nl> } <nl> <nl> - Expr * ASTGen : : generate ( PoundLineExprSyntax & Expr , SourceLoc & Loc ) { <nl> - return generateMagicIdentifierLiteralExpression ( Expr . getPoundLine ( ) , Loc ) ; <nl> + MagicIdentifierLiteralExpr * ASTGen : : generate ( PoundColumnExprSyntax & Expr ) { <nl> + return generateMagicIdentifierLiteralExpr ( Expr . getPoundColumn ( ) ) ; <nl> } <nl> <nl> - Expr * ASTGen : : generate ( PoundColumnExprSyntax & Expr , SourceLoc & Loc ) { <nl> - return generateMagicIdentifierLiteralExpression ( Expr . getPoundColumn ( ) , Loc ) ; <nl> + MagicIdentifierLiteralExpr * ASTGen : : generate ( PoundFunctionExprSyntax & Expr ) { <nl> + return generateMagicIdentifierLiteralExpr ( Expr . getPoundFunction ( ) ) ; <nl> } <nl> <nl> - Expr * ASTGen : : generate ( PoundFunctionExprSyntax & Expr , SourceLoc & Loc ) { <nl> - return generateMagicIdentifierLiteralExpression ( Expr . getPoundFunction ( ) , Loc ) ; <nl> + MagicIdentifierLiteralExpr * ASTGen : : generate ( PoundDsohandleExprSyntax & Expr ) { <nl> + return generateMagicIdentifierLiteralExpr ( Expr . getPoundDsohandle ( ) ) ; <nl> } <nl> <nl> - Expr * ASTGen : : generate ( PoundDsohandleExprSyntax & Expr , SourceLoc & Loc ) { <nl> - return generateMagicIdentifierLiteralExpression ( Expr . getPoundDsohandle ( ) , Loc ) ; <nl> - } <nl> - <nl> - Expr * ASTGen : : generate ( UnknownExprSyntax & Expr , SourceLoc & Loc ) { <nl> + Expr * ASTGen : : generate ( UnknownExprSyntax & Expr ) { <nl> if ( Expr . getNumChildren ( ) = = 1 & & Expr . getChild ( 0 ) - > isToken ( ) ) { <nl> Syntax Token = * Expr . getChild ( 0 ) ; <nl> tok Kind = Token . getRaw ( ) - > getTokenKind ( ) ; <nl> Expr * ASTGen : : generate ( UnknownExprSyntax & Expr , SourceLoc & Loc ) { <nl> case tok : : kw___FUNCTION__ : <nl> case tok : : kw___DSO_HANDLE__ : { <nl> auto MagicKind = getMagicIdentifierLiteralKind ( Kind ) ; <nl> - auto KindLoc = advanceLocBegin ( Loc , Token ) ; <nl> - return new ( Context ) MagicIdentifierLiteralExpr ( MagicKind , KindLoc ) ; <nl> + SourceLoc Loc = topLoc ( ) ; <nl> + return new ( Context ) MagicIdentifierLiteralExpr ( MagicKind , Loc ) ; <nl> } <nl> default : <nl> return nullptr ; <nl> Expr * ASTGen : : generate ( UnknownExprSyntax & Expr , SourceLoc & Loc ) { <nl> return nullptr ; <nl> } <nl> <nl> - TypeRepr * ASTGen : : generate ( TypeSyntax Type , SourceLoc & Loc ) { <nl> - TypeRepr * TypeAST = lookupType ( Type ) ; <nl> - <nl> - if ( TypeAST ) <nl> - return TypeAST ; <nl> - <nl> - if ( auto SimpleIdentifier = Type . getAs < SimpleTypeIdentifierSyntax > ( ) ) <nl> - TypeAST = generate ( * SimpleIdentifier , Loc ) ; <nl> - else if ( auto MemberIdentifier = Type . getAs < MemberTypeIdentifierSyntax > ( ) ) <nl> - TypeAST = generate ( * MemberIdentifier , Loc ) ; <nl> - else if ( auto Composition = Type . getAs < CompositionTypeSyntax > ( ) ) <nl> - TypeAST = generate ( * Composition , Loc ) ; <nl> - else if ( auto Function = Type . getAs < FunctionTypeSyntax > ( ) ) <nl> - TypeAST = generate ( * Function , Loc ) ; <nl> - else if ( auto Metatype = Type . getAs < MetatypeTypeSyntax > ( ) ) <nl> - TypeAST = generate ( * Metatype , Loc ) ; <nl> - else if ( auto Array = Type . getAs < ArrayTypeSyntax > ( ) ) <nl> - TypeAST = generate ( * Array , Loc ) ; <nl> - else if ( auto Dictionary = Type . getAs < DictionaryTypeSyntax > ( ) ) <nl> - TypeAST = generate ( * Dictionary , Loc ) ; <nl> - else if ( auto Tuple = Type . getAs < TupleTypeSyntax > ( ) ) <nl> - TypeAST = generate ( * Tuple , Loc ) ; <nl> - else if ( auto Some = Type . getAs < SomeTypeSyntax > ( ) ) <nl> - TypeAST = generate ( * Some , Loc ) ; <nl> - else if ( auto Optional = Type . getAs < OptionalTypeSyntax > ( ) ) <nl> - TypeAST = generate ( * Optional , Loc ) ; <nl> - else if ( auto Unwrapped = Type . getAs < ImplicitlyUnwrappedOptionalTypeSyntax > ( ) ) <nl> - TypeAST = generate ( * Unwrapped , Loc ) ; <nl> - else if ( auto Attributed = Type . getAs < AttributedTypeSyntax > ( ) ) <nl> - TypeAST = generate ( * Attributed , Loc ) ; <nl> - else if ( auto Unknown = Type . getAs < UnknownTypeSyntax > ( ) ) <nl> - TypeAST = generate ( * Unknown , Loc ) ; <nl> - <nl> - / / todo [ gsoc ] : handle InheritedTypeSyntax & ClassRestrictionTypeSyntax ? <nl> - <nl> - if ( ! TypeAST & & hasType ( advanceLocBegin ( Loc , Type ) ) ) <nl> - TypeAST = getType ( advanceLocBegin ( Loc , Type ) ) ; <nl> - <nl> - return cacheType ( Type , TypeAST ) ; <nl> - } <nl> - <nl> - TypeRepr * ASTGen : : generate ( FunctionTypeSyntax Type , SourceLoc & Loc ) { <nl> - auto ArgumentTypes = generateTuple ( Type . getLeftParen ( ) , Type . getArguments ( ) , <nl> - Type . getRightParen ( ) , Loc , <nl> - / * IsFunction = * / true ) ; <nl> - <nl> - auto ThrowsLoc = Type . getThrowsOrRethrowsKeyword ( ) <nl> - ? generate ( * Type . getThrowsOrRethrowsKeyword ( ) , Loc ) <nl> - : SourceLoc ( ) ; <nl> - <nl> - auto ArrowLoc = generate ( Type . getArrow ( ) , Loc ) ; <nl> - auto ReturnType = generate ( Type . getReturnType ( ) , Loc ) ; <nl> - <nl> - return new ( Context ) <nl> - FunctionTypeRepr ( nullptr , ArgumentTypes , ThrowsLoc , ArrowLoc , ReturnType ) ; <nl> - } <nl> - <nl> - TupleTypeRepr * ASTGen : : generateTuple ( TokenSyntax LParen , <nl> - TupleTypeElementListSyntax Elements , <nl> - TokenSyntax RParen , SourceLoc & Loc , <nl> - bool IsFunction ) { <nl> - auto LPLoc = generate ( LParen , Loc ) ; <nl> - auto RPLoc = generate ( RParen , Loc ) ; <nl> - <nl> - SmallVector < TupleTypeReprElement , 4 > TupleElements ; <nl> - <nl> - SourceLoc EllipsisLoc ; <nl> - unsigned EllipsisIdx = Elements . size ( ) ; <nl> - <nl> - for ( unsigned i = 0 ; i < Elements . getNumChildren ( ) ; i + + ) { <nl> - auto Element = Elements . getChild ( i ) - > castTo < TupleTypeElementSyntax > ( ) ; <nl> - TupleTypeReprElement ElementAST ; <nl> - if ( auto Name = Element . getName ( ) ) { <nl> - ElementAST . NameLoc = generate ( * Name , Loc ) ; <nl> - ElementAST . Name = Name - > getText ( ) = = " _ " <nl> - ? Identifier ( ) <nl> - : Context . getIdentifier ( Name - > getText ( ) ) ; <nl> - } <nl> - if ( auto Colon = Element . getColon ( ) ) <nl> - ElementAST . ColonLoc = generate ( * Colon , Loc ) ; <nl> - if ( auto SecondName = Element . getSecondName ( ) ) { <nl> - ElementAST . SecondNameLoc = generate ( * SecondName , Loc ) ; <nl> - ElementAST . SecondName = <nl> - SecondName - > getText ( ) = = " _ " <nl> - ? Identifier ( ) <nl> - : Context . getIdentifier ( SecondName - > getText ( ) ) ; <nl> - if ( IsFunction ) { <nl> - / / Form the named parameter type representation . <nl> - ElementAST . UnderscoreLoc = ElementAST . NameLoc ; <nl> - ElementAST . Name = ElementAST . SecondName ; <nl> - ElementAST . NameLoc = ElementAST . SecondNameLoc ; <nl> - } <nl> - } <nl> - ElementAST . Type = generate ( Element . getType ( ) , Loc ) ; <nl> - if ( auto InOut = Element . getInOut ( ) ) { <nl> - / / don ' t apply multiple inout specifiers to a type : that ' s invalid and was <nl> - / / already reported in the parser , handle gracefully <nl> - if ( ! isa < InOutTypeRepr > ( ElementAST . Type ) ) { <nl> - auto InOutLoc = generate ( * InOut , Loc ) ; <nl> - ElementAST . Type = <nl> - new ( Context ) InOutTypeRepr ( ElementAST . Type , InOutLoc ) ; <nl> - } <nl> - } <nl> - if ( auto Comma = Element . getTrailingComma ( ) ) <nl> - ElementAST . TrailingCommaLoc = generate ( * Comma , Loc ) ; <nl> - if ( auto Ellipsis = Element . getEllipsis ( ) ) { <nl> - EllipsisLoc = generate ( * Ellipsis , Loc ) ; <nl> - if ( EllipsisIdx = = Elements . size ( ) ) <nl> - EllipsisIdx = i ; <nl> - } <nl> - TupleElements . push_back ( ElementAST ) ; <nl> - } <nl> - <nl> - return TupleTypeRepr : : create ( Context , TupleElements , { LPLoc , RPLoc } , <nl> - EllipsisLoc , EllipsisIdx ) ; <nl> - } <nl> - <nl> - TypeRepr * ASTGen : : generate ( AttributedTypeSyntax Type , SourceLoc & Loc ) { <nl> - / / todo [ gsoc ] : improve this after refactoring attribute parsing <nl> - <nl> - auto TypeAST = generate ( Type . getBaseType ( ) , Loc ) ; <nl> - <nl> - if ( auto Attributes = Type . getAttributes ( ) ) { <nl> - TypeAttributes TypeAttrs ; <nl> - <nl> - for ( auto Attribute : * Attributes ) { <nl> - auto Attr = Attribute . castTo < AttributeSyntax > ( ) ; <nl> - auto AttrNameStr = Attr . getAttributeName ( ) . getText ( ) ; <nl> - <nl> - auto AtLoc = advanceLocBegin ( Loc , Attr . getAtSignToken ( ) ) ; <nl> - auto AttrKind = TypeAttributes : : getAttrKindFromString ( AttrNameStr ) ; <nl> - <nl> - TypeAttrs . setAttr ( AttrKind , AtLoc ) ; <nl> - <nl> - if ( AttrKind = = TAK_convention ) { <nl> - auto Argument = Attr . getArgument ( ) - > castTo < TokenSyntax > ( ) ; <nl> - auto Begin = advanceLocBegin ( Loc , Argument ) ; <nl> - auto End = advanceLocEnd ( Loc , Argument ) ; <nl> - CharSourceRange Range { Context . SourceMgr , Begin , End } ; <nl> - TypeAttrs . convention = Range . str ( ) ; <nl> - } <nl> - <nl> - if ( AttrKind = = TAK_opened ) { <nl> - auto AttrText = Attr . getArgument ( ) - > castTo < TokenSyntax > ( ) . getText ( ) ; <nl> - auto LiteralText = AttrText . slice ( 1 , AttrText . size ( ) - 1 ) ; <nl> - TypeAttrs . OpenedID = UUID : : fromString ( LiteralText . str ( ) . c_str ( ) ) ; <nl> - } <nl> - <nl> - if ( TypeAttrs . AtLoc . isInvalid ( ) ) <nl> - TypeAttrs . AtLoc = AtLoc ; <nl> - } <nl> - <nl> - if ( ! TypeAttrs . empty ( ) ) <nl> - TypeAST = new ( Context ) AttributedTypeRepr ( TypeAttrs , TypeAST ) ; <nl> - } <nl> - <nl> - if ( auto Specifier = Type . getSpecifier ( ) ) { <nl> - auto SpecifierLoc = generate ( * Specifier , Loc ) ; <nl> - auto SpecifierText = Specifier - > getText ( ) ; <nl> - <nl> - / / don ' t apply multiple specifiers to a type : that ' s invalid and was already <nl> - / / reported in the parser , handle gracefully <nl> - if ( ! isa < SpecifierTypeRepr > ( TypeAST ) ) { <nl> - if ( SpecifierText = = " inout " ) <nl> - TypeAST = new ( Context ) InOutTypeRepr ( TypeAST , SpecifierLoc ) ; <nl> - else if ( SpecifierText = = " __owned " ) <nl> - TypeAST = new ( Context ) OwnedTypeRepr ( TypeAST , SpecifierLoc ) ; <nl> - else if ( SpecifierText = = " __shared " ) <nl> - TypeAST = new ( Context ) SharedTypeRepr ( TypeAST , SpecifierLoc ) ; <nl> - } <nl> - } <nl> - <nl> - return TypeAST ; <nl> - } <nl> - <nl> - TypeRepr * ASTGen : : generate ( TupleTypeSyntax Type , SourceLoc & Loc ) { <nl> - return generateTuple ( Type . getLeftParen ( ) , Type . getElements ( ) , <nl> - Type . getRightParen ( ) , Loc ) ; <nl> - } <nl> - <nl> - TypeRepr * ASTGen : : generate ( SomeTypeSyntax Type , SourceLoc & Loc ) { <nl> - auto Some = Type . getSomeSpecifier ( ) ; <nl> - auto SomeLoc = generate ( Some , Loc ) ; <nl> - auto BaseType = generate ( Type . getBaseType ( ) , Loc ) ; <nl> - return new ( Context ) OpaqueReturnTypeRepr ( SomeLoc , BaseType ) ; <nl> - } <nl> - <nl> - TypeRepr * ASTGen : : generate ( CompositionTypeSyntax Type , SourceLoc & Loc ) { <nl> - auto Elements = Type . getElements ( ) ; <nl> - auto FirstElem = Elements [ 0 ] ; <nl> - auto LastElem = Elements [ Elements . size ( ) - 1 ] ; <nl> - <nl> - SmallVector < TypeRepr * , 4 > ElemTypes ; <nl> - for ( unsigned i = 0 ; i < Elements . size ( ) ; i + + ) { <nl> - auto ElemType = Elements [ i ] . getType ( ) ; <nl> - <nl> - TypeRepr * ElemTypeR = nullptr ; <nl> - if ( auto Some = ElemType . getAs < SomeTypeSyntax > ( ) ) { <nl> - / / the invalid ` some ` after an ampersand was already diagnosed by the <nl> - / / parser , handle it gracefully <nl> - ElemTypeR = generate ( Some - > getBaseType ( ) , Loc ) ; <nl> - } else { <nl> - ElemTypeR = generate ( ElemType , Loc ) ; <nl> - } <nl> - <nl> - if ( ElemTypeR ) { <nl> - if ( auto Comp = dyn_cast < CompositionTypeRepr > ( ElemTypeR ) ) { <nl> - / / Accept protocol < P1 , P2 > & P3 ; explode it . <nl> - auto TyRs = Comp - > getTypes ( ) ; <nl> - ElemTypes . append ( TyRs . begin ( ) , TyRs . end ( ) ) ; <nl> - } else { <nl> - ElemTypes . push_back ( ElemTypeR ) ; <nl> - } <nl> - } <nl> - } <nl> - <nl> - auto FirstTypeLoc = advanceLocBegin ( Loc , FirstElem ) ; <nl> - auto FirstAmpersandLoc = advanceLocBegin ( Loc , * FirstElem . getAmpersand ( ) ) ; <nl> - auto LastTypeLoc = advanceLocBegin ( Loc , LastElem ) ; <nl> - return CompositionTypeRepr : : create ( Context , ElemTypes , FirstTypeLoc , <nl> - { FirstAmpersandLoc , LastTypeLoc } ) ; <nl> - } <nl> - <nl> - void ASTGen : : gatherTypeIdentifierComponents ( <nl> - TypeSyntax Component , SourceLoc & Loc , <nl> - SmallVectorImpl < ComponentIdentTypeRepr * > & Components ) { <nl> - if ( auto SimpleIdentifier = Component . getAs < SimpleTypeIdentifierSyntax > ( ) ) { <nl> - auto ComponentType = generateIdentifier ( * SimpleIdentifier , Loc ) ; <nl> - Components . push_back ( ComponentType ) ; <nl> - return ; <nl> - } <nl> - <nl> - if ( auto MemberIdentifier = Component . getAs < MemberTypeIdentifierSyntax > ( ) ) { <nl> - auto ComponentType = generateIdentifier ( * MemberIdentifier , Loc ) ; <nl> - Components . push_back ( ComponentType ) ; <nl> - gatherTypeIdentifierComponents ( MemberIdentifier - > getBaseType ( ) , Loc , <nl> - Components ) ; <nl> - return ; <nl> - } <nl> - <nl> - llvm_unreachable ( " unexpected type identifier component " ) ; <nl> - } <nl> - <nl> - template < typename T > <nl> - TypeRepr * ASTGen : : generateSimpleOrMemberIdentifier ( T Type , SourceLoc & Loc ) { <nl> - SmallVector < ComponentIdentTypeRepr * , 4 > Components ; <nl> - gatherTypeIdentifierComponents ( Type , Loc , Components ) ; <nl> - std : : reverse ( Components . begin ( ) , Components . end ( ) ) ; <nl> - <nl> - auto IdentType = IdentTypeRepr : : create ( Context , Components ) ; <nl> - auto FirstComponent = IdentType - > getComponentRange ( ) . front ( ) ; <nl> - / / Lookup element # 0 through our current scope chains in case it is some <nl> - / / thing local ( this returns null if nothing is found ) . <nl> - if ( auto Entry = lookupInScope ( FirstComponent - > getIdentifier ( ) ) ) <nl> - if ( auto * TD = dyn_cast < TypeDecl > ( Entry ) ) <nl> - FirstComponent - > setValue ( TD , nullptr ) ; <nl> - <nl> - return IdentType ; <nl> - } <nl> - <nl> - template < typename T > <nl> - ComponentIdentTypeRepr * ASTGen : : generateIdentifier ( T Type , SourceLoc & Loc ) { <nl> - auto IdentifierLoc = advanceLocBegin ( Loc , Type . getName ( ) ) ; <nl> - auto Identifier = Context . getIdentifier ( Type . getName ( ) . getText ( ) ) ; <nl> - if ( auto Clause = Type . getGenericArgumentClause ( ) ) { <nl> - auto Args = Clause - > getArguments ( ) ; <nl> - if ( ! Args . empty ( ) ) { <nl> - auto LAngleLoc = advanceLocBegin ( Loc , Clause - > getLeftAngleBracket ( ) ) ; <nl> - auto RAngleLoc = advanceLocBegin ( Loc , Clause - > getRightAngleBracket ( ) ) ; <nl> - SourceRange Range { LAngleLoc , RAngleLoc } ; <nl> - auto ArgsAST = generate ( Args , Loc ) ; <nl> - return GenericIdentTypeRepr : : create ( Context , IdentifierLoc , Identifier , <nl> - ArgsAST , Range ) ; <nl> - } <nl> - } <nl> - return new ( Context ) SimpleIdentTypeRepr ( IdentifierLoc , Identifier ) ; <nl> - } <nl> - <nl> - TypeRepr * ASTGen : : generate ( SimpleTypeIdentifierSyntax Type , SourceLoc & Loc ) { <nl> - if ( Type . getName ( ) . getTokenKind ( ) = = tok : : kw_Any ) { <nl> - auto AnyLoc = advanceLocBegin ( Loc , Type . getName ( ) ) ; <nl> - return CompositionTypeRepr : : createEmptyComposition ( Context , AnyLoc ) ; <nl> - } <nl> - <nl> - return generateSimpleOrMemberIdentifier ( Type , Loc ) ; <nl> - } <nl> - <nl> - TypeRepr * ASTGen : : generate ( MemberTypeIdentifierSyntax Type , SourceLoc & Loc ) { <nl> - return generateSimpleOrMemberIdentifier ( Type , Loc ) ; <nl> - } <nl> - <nl> - TypeRepr * ASTGen : : generate ( DictionaryTypeSyntax Type , SourceLoc & Loc ) { <nl> - TypeRepr * ValueType = generate ( Type . getValueType ( ) , Loc ) ; <nl> - TypeRepr * KeyType = generate ( Type . getKeyType ( ) , Loc ) ; <nl> - auto LBraceLoc = advanceLocBegin ( Loc , Type . getLeftSquareBracket ( ) ) ; <nl> - auto ColonLoc = advanceLocBegin ( Loc , Type . getColon ( ) ) ; <nl> - auto RBraceLoc = advanceLocBegin ( Loc , Type . getRightSquareBracket ( ) ) ; <nl> - SourceRange Range { LBraceLoc , RBraceLoc } ; <nl> - return new ( Context ) DictionaryTypeRepr ( KeyType , ValueType , ColonLoc , Range ) ; <nl> - } <nl> - <nl> - TypeRepr * ASTGen : : generate ( ArrayTypeSyntax Type , SourceLoc & Loc ) { <nl> - TypeRepr * ElementType = generate ( Type . getElementType ( ) , Loc ) ; <nl> - auto LBraceLoc = advanceLocBegin ( Loc , Type . getLeftSquareBracket ( ) ) ; <nl> - auto RBraceLoc = advanceLocBegin ( Loc , Type . getRightSquareBracket ( ) ) ; <nl> - SourceRange Range { LBraceLoc , RBraceLoc } ; <nl> - return new ( Context ) ArrayTypeRepr ( ElementType , Range ) ; <nl> - } <nl> - <nl> - TypeRepr * ASTGen : : generate ( MetatypeTypeSyntax Type , SourceLoc & Loc ) { <nl> - TypeRepr * BaseType = generate ( Type . getBaseType ( ) , Loc ) ; <nl> - auto TypeOrProtocol = Type . getTypeOrProtocol ( ) ; <nl> - auto TypeOrProtocolLoc = advanceLocBegin ( Loc , TypeOrProtocol ) ; <nl> - if ( TypeOrProtocol . getText ( ) = = " Type " ) <nl> - return new ( Context ) MetatypeTypeRepr ( BaseType , TypeOrProtocolLoc ) ; <nl> - return new ( Context ) ProtocolTypeRepr ( BaseType , TypeOrProtocolLoc ) ; <nl> - } <nl> - <nl> - TypeRepr * ASTGen : : generate ( OptionalTypeSyntax Type , SourceLoc & Loc ) { <nl> - TypeRepr * WrappedType = generate ( Type . getWrappedType ( ) , Loc ) ; <nl> - auto QuestionLoc = advanceLocBegin ( Loc , Type . getQuestionMark ( ) ) ; <nl> - return new ( Context ) OptionalTypeRepr ( WrappedType , QuestionLoc ) ; <nl> - } <nl> - <nl> - TypeRepr * ASTGen : : generate ( ImplicitlyUnwrappedOptionalTypeSyntax Type , <nl> - SourceLoc & Loc ) { <nl> - TypeRepr * WrappedType = generate ( Type . getWrappedType ( ) , Loc ) ; <nl> - auto ExclamationLoc = advanceLocBegin ( Loc , Type . getExclamationMark ( ) ) ; <nl> - return new ( Context ) <nl> - ImplicitlyUnwrappedOptionalTypeRepr ( WrappedType , ExclamationLoc ) ; <nl> - } <nl> - <nl> - TypeRepr * ASTGen : : generate ( UnknownTypeSyntax Type , SourceLoc & Loc ) { <nl> - auto ChildrenCount = Type . getNumChildren ( ) ; <nl> - <nl> - / / Recover from C - style array type : <nl> - / / type ' [ ' ' ] ' <nl> - / / type ' [ ' expr ' ] ' <nl> - if ( ChildrenCount = = 3 | | ChildrenCount = = 4 ) { <nl> - auto Element = Type . getChild ( 0 ) - > getAs < TypeSyntax > ( ) ; <nl> - auto LSquare = Type . getChild ( 1 ) - > getAs < TokenSyntax > ( ) ; <nl> - auto Last = Type . getChild ( ChildrenCount - 1 ) ; <nl> - <nl> - if ( Element & & LSquare & & LSquare - > getTokenKind ( ) = = tok : : l_square ) { <nl> - auto ElementType = generate ( * Element , Loc ) ; <nl> - auto Begin = advanceLocBegin ( Loc , * Element ) ; <nl> - auto End = advanceLocBegin ( Loc , * Last ) ; <nl> - return new ( Context ) ArrayTypeRepr ( ElementType , { Begin , End } ) ; <nl> - } <nl> - } <nl> - <nl> - / / Recover from extra ` [ ` : <nl> - / / type ` [ ` <nl> - if ( ChildrenCount = = 2 ) { <nl> - auto Element = Type . getChild ( 0 ) - > getAs < TypeSyntax > ( ) ; <nl> - auto LSquare = Type . getChild ( 1 ) - > getAs < TokenSyntax > ( ) ; <nl> - <nl> - if ( Element & & LSquare & & LSquare - > getTokenKind ( ) = = tok : : l_square ) { <nl> - return generate ( * Element , Loc ) ; <nl> - } <nl> - } <nl> - <nl> - / / Recover from old - style protocol composition : <nl> - / / ` protocol ` ` < ` protocols ` > ` <nl> - if ( ChildrenCount > = 2 ) { <nl> - auto Protocol = Type . getChild ( 0 ) - > getAs < TokenSyntax > ( ) ; <nl> - <nl> - if ( Protocol & & Protocol - > getText ( ) = = " protocol " ) { <nl> - auto LAngle = Type . getChild ( 1 ) ; <nl> - <nl> - SmallVector < TypeSyntax , 4 > Protocols ; <nl> - for ( unsigned i = 2 ; i < Type . getNumChildren ( ) ; i + + ) <nl> - if ( auto PType = Type . getChild ( i ) - > getAs < TypeSyntax > ( ) ) <nl> - Protocols . push_back ( * PType ) ; <nl> - <nl> - auto RAngle = Type . getChild ( ChildrenCount - 1 ) ; <nl> - <nl> - auto ProtocolLoc = advanceLocBegin ( Loc , * Protocol ) ; <nl> - auto LAngleLoc = advanceLocBegin ( Loc , * LAngle ) ; <nl> - auto RAngleLoc = advanceLocBegin ( Loc , * RAngle ) ; <nl> - <nl> - SmallVector < TypeRepr * , 4 > ProtocolTypes ; <nl> - for ( auto & & P : llvm : : reverse ( Protocols ) ) <nl> - ProtocolTypes . push_back ( generate ( P , Loc ) ) ; <nl> - std : : reverse ( std : : begin ( ProtocolTypes ) , std : : end ( ProtocolTypes ) ) ; <nl> - <nl> - return CompositionTypeRepr : : create ( Context , ProtocolTypes , ProtocolLoc , <nl> - { LAngleLoc , RAngleLoc } ) ; <nl> - } <nl> - } <nl> - <nl> - / / Create ErrorTypeRepr for keywords . <nl> - if ( ChildrenCount = = 1 ) { <nl> - auto Keyword = Type . getChild ( 0 ) - > getAs < TokenSyntax > ( ) ; <nl> - if ( Keyword & & isTokenKeyword ( Keyword - > getTokenKind ( ) ) ) { <nl> - auto ErrorLoc = generate ( * Keyword , Loc ) ; <nl> - return new ( Context ) ErrorTypeRepr ( ErrorLoc ) ; <nl> - } <nl> - } <nl> - <nl> - / / Create empty TupleTypeRepr for types starting with ` ( ` . <nl> - if ( ChildrenCount > = 1 ) { <nl> - auto LParen = Type . getChild ( 0 ) - > getAs < TokenSyntax > ( ) ; <nl> - if ( LParen & & LParen - > getTokenKind ( ) = = tok : : l_paren ) { <nl> - auto LParenLoc = advanceLocBegin ( Loc , * LParen ) ; <nl> - auto EndLoc = advanceLocBegin ( Loc , * Type . getChild ( Type . getNumChildren ( ) - 1 ) ) ; <nl> - return TupleTypeRepr : : createEmpty ( Context , { LParenLoc , EndLoc } ) ; <nl> - } <nl> - } <nl> - <nl> - / / let ' s hope the main ` generate ` method can find this node in the type map <nl> - return nullptr ; <nl> - } <nl> - <nl> - SmallVector < TypeRepr * , 4 > ASTGen : : generate ( GenericArgumentListSyntax Args , <nl> - SourceLoc & Loc ) { <nl> - SmallVector < TypeRepr * , 4 > Types ; <nl> - Types . resize ( Args . size ( ) ) ; <nl> - <nl> - for ( int i = Args . size ( ) - 1 ; i > = 0 ; i - - ) { <nl> - auto Arg = Args . getChild ( i ) . getValue ( ) . castTo < GenericArgumentSyntax > ( ) ; <nl> - auto Type = generate ( Arg , Loc ) ; <nl> - Types [ i ] = Type ; <nl> - } <nl> - <nl> - return Types ; <nl> - } <nl> - <nl> - TypeRepr * ASTGen : : generate ( GenericArgumentSyntax Arg , SourceLoc & Loc ) { <nl> - return generate ( Arg . getArgumentType ( ) , Loc ) ; <nl> - } <nl> + void ASTGen : : pushLoc ( SourceLoc Loc ) { LocStack . push_back ( Loc ) ; } <nl> <nl> StringRef ASTGen : : copyAndStripUnderscores ( StringRef Orig , ASTContext & Context ) { <nl> char * start = static_cast < char * > ( Context . Allocate ( Orig . size ( ) , 1 ) ) ; <nl> StringRef ASTGen : : copyAndStripUnderscores ( StringRef Orig , ASTContext & Context ) { <nl> return StringRef ( start , p - start ) ; <nl> } <nl> <nl> - SourceLoc ASTGen : : advanceLocBegin ( const SourceLoc & Loc , const Syntax & Node ) { <nl> - return Loc . getAdvancedLoc ( Node . getAbsolutePosition ( ) . getOffset ( ) ) ; <nl> - } <nl> - <nl> - SourceLoc ASTGen : : advanceLocEnd ( const SourceLoc & Loc , const TokenSyntax & Token ) { <nl> - return advanceLocAfter ( Loc , Token . withTrailingTrivia ( { } ) ) ; <nl> - } <nl> - <nl> - SourceLoc ASTGen : : advanceLocAfter ( const SourceLoc & Loc , const Syntax & Node ) { <nl> - return Loc . getAdvancedLoc ( <nl> - Node . getAbsoluteEndPositionAfterTrailingTrivia ( ) . getOffset ( ) ) ; <nl> - } <nl> - <nl> StringRef ASTGen : : copyAndStripUnderscores ( StringRef Orig ) { <nl> return copyAndStripUnderscores ( Orig , Context ) ; <nl> } <nl> <nl> - Expr * ASTGen : : generateMagicIdentifierLiteralExpression ( TokenSyntax PoundToken , <nl> - SourceLoc & Loc ) { <nl> + SourceLoc ASTGen : : topLoc ( ) { <nl> + / / todo [ gsoc ] : create SourceLoc by pointing the offset of Syntax node into <nl> + / / the source buffer <nl> + return LocStack . back ( ) ; <nl> + } <nl> + <nl> + MagicIdentifierLiteralExpr * <nl> + ASTGen : : generateMagicIdentifierLiteralExpr ( const TokenSyntax & PoundToken ) { <nl> auto Kind = getMagicIdentifierLiteralKind ( PoundToken . getTokenKind ( ) ) ; <nl> - auto KindLoc = advanceLocBegin ( Loc , PoundToken ) ; <nl> - return new ( Context ) MagicIdentifierLiteralExpr ( Kind , KindLoc ) ; <nl> + SourceLoc Loc = topLoc ( ) ; <nl> + return new ( Context ) MagicIdentifierLiteralExpr ( Kind , Loc ) ; <nl> } <nl> <nl> - MagicIdentifierLiteralExpr : : Kind ASTGen : : getMagicIdentifierLiteralKind ( tok Kind ) { <nl> + MagicIdentifierLiteralExpr : : Kind <nl> + ASTGen : : getMagicIdentifierLiteralKind ( tok Kind ) { <nl> switch ( Kind ) { <nl> case tok : : kw___COLUMN__ : <nl> case tok : : pound_column : <nl> MagicIdentifierLiteralExpr : : Kind ASTGen : : getMagicIdentifierLiteralKind ( tok Kind ) <nl> llvm_unreachable ( " not a magic literal " ) ; <nl> } <nl> } <nl> - <nl> - ValueDecl * ASTGen : : lookupInScope ( DeclName Name ) { <nl> - return Context . LangOpts . EnableASTScopeLookup <nl> - ? nullptr <nl> - : ( * ParserState ) - > getScopeInfo ( ) . lookupValueName ( Name ) ; <nl> - } <nl> - <nl> - TypeRepr * ASTGen : : cacheType ( TypeSyntax Type , TypeRepr * TypeAST ) { <nl> - TypeCache [ Type . getId ( ) ] = TypeAST ; <nl> - return TypeAST ; <nl> - } <nl> - <nl> - TypeRepr * ASTGen : : lookupType ( TypeSyntax Type ) { <nl> - auto Found = TypeCache . find ( Type . getId ( ) ) ; <nl> - return Found ! = TypeCache . end ( ) ? Found - > second : nullptr ; <nl> - } <nl> - <nl> - TypeRepr * ASTGen : : addType ( TypeRepr * Type , const SourceLoc & Loc ) { <nl> - return Types . insert ( { Loc , Type } ) . first - > second ; <nl> - } <nl> - <nl> - bool ASTGen : : hasType ( const SourceLoc & Loc ) const { <nl> - return Types . find ( Loc ) ! = Types . end ( ) ; <nl> - } <nl> - <nl> - TypeRepr * ASTGen : : getType ( const SourceLoc & Loc ) const { <nl> - return Types . find ( Loc ) - > second ; <nl> - } <nl> mmm a / lib / Parse / Lexer . cpp <nl> ppp b / lib / Parse / Lexer . cpp <nl> void Lexer : : formToken ( tok Kind , const char * TokStart ) { <nl> <nl> StringRef TokenText { TokStart , static_cast < size_t > ( CurPtr - TokStart ) } ; <nl> <nl> - if ( TriviaRetention = = TriviaRetentionMode : : WithTrivia & & Kind ! = tok : : eof ) { <nl> + if ( TriviaRetention = = TriviaRetentionMode : : WithTrivia ) { <nl> lexTrivia ( TrailingTrivia , / * IsForTrailingTrivia * / true ) ; <nl> } <nl> <nl> mmm a / lib / Parse / ParseDecl . cpp <nl> ppp b / lib / Parse / ParseDecl . cpp <nl> bool Parser : : isStartOfDecl ( ) { <nl> void Parser : : consumeDecl ( ParserPosition BeginParserPosition , <nl> ParseDeclOptions Flags , <nl> bool IsTopLevel ) { <nl> - SyntaxParsingContext Discarding ( SyntaxContext ) ; <nl> - Discarding . setDiscard ( ) ; <nl> SourceLoc CurrentLoc = Tok . getLoc ( ) ; <nl> <nl> SourceLoc EndLoc = PreviousLoc ; <nl> mmm a / lib / Parse / ParseExpr . cpp <nl> ppp b / lib / Parse / ParseExpr . cpp <nl> Parser : : parseExprPostfixSuffix ( ParserResult < Expr > Result , bool isExprBasic , <nl> if ( canParseAsGenericArgumentList ( ) ) { <nl> SmallVector < TypeRepr * , 8 > args ; <nl> SourceLoc LAngleLoc , RAngleLoc ; <nl> - auto argStat = parseGenericArgumentsAST ( args , LAngleLoc , RAngleLoc ) ; <nl> + auto argStat = parseGenericArguments ( args , LAngleLoc , RAngleLoc ) ; <nl> if ( argStat . isError ( ) ) <nl> diagnose ( LAngleLoc , diag : : while_parsing_as_left_angle_bracket ) ; <nl> <nl> ParsedExprSyntax Parser : : parseExprSyntax < PoundDsohandleExprSyntax > ( ) { <nl> <nl> template < typename SyntaxNode > <nl> ParserResult < Expr > Parser : : parseExprAST ( ) { <nl> - auto Loc = leadingTriviaLoc ( ) ; <nl> auto ParsedExpr = parseExprSyntax < SyntaxNode > ( ) ; <nl> SyntaxContext - > addSyntax ( ParsedExpr ) ; <nl> / / todo [ gsoc ] : improve this somehow <nl> - if ( SyntaxContext - > isTopNode < UnknownExprSyntax > ( ) ) { <nl> + if ( SyntaxContext - > isTopNode < SyntaxKind : : UnknownExpr > ( ) ) { <nl> auto Expr = SyntaxContext - > topNode < UnknownExprSyntax > ( ) ; <nl> - auto ExprAST = Generator . generate ( Expr , Loc ) ; <nl> + auto ExprAST = Generator . generate ( Expr ) ; <nl> return makeParserResult ( ExprAST ) ; <nl> } <nl> auto Expr = SyntaxContext - > topNode < SyntaxNode > ( ) ; <nl> - auto ExprAST = Generator . generate ( Expr , Loc ) ; <nl> + auto ExprAST = Generator . generate ( Expr ) ; <nl> return makeParserResult ( ExprAST ) ; <nl> } <nl> <nl> ParserResult < Expr > Parser : : parseExprPrimary ( Diag < > ID , bool isExprBasic ) { <nl> <nl> case tok : : kw_Any : { / / Any <nl> ExprContext . setCreateSyntax ( SyntaxKind : : TypeExpr ) ; <nl> - auto TyR = parseAnyTypeAST ( ) ; <nl> + auto TyR = parseAnyType ( ) ; <nl> return makeParserResult ( new ( Context ) TypeExpr ( TypeLoc ( TyR . get ( ) ) ) ) ; <nl> } <nl> <nl> Expr * Parser : : parseExprIdentifier ( ) { <nl> if ( canParseAsGenericArgumentList ( ) ) { <nl> SyntaxContext - > createNodeInPlace ( SyntaxKind : : IdentifierExpr ) ; <nl> SyntaxContext - > setCreateSyntax ( SyntaxKind : : SpecializeExpr ) ; <nl> - auto argStat = parseGenericArgumentsAST ( args , LAngleLoc , RAngleLoc ) ; <nl> + auto argStat = parseGenericArguments ( args , LAngleLoc , RAngleLoc ) ; <nl> if ( argStat . isError ( ) ) <nl> diagnose ( LAngleLoc , diag : : while_parsing_as_left_angle_bracket ) ; <nl> <nl> mmm a / lib / Parse / ParseStmt . cpp <nl> ppp b / lib / Parse / ParseStmt . cpp <nl> bool Parser : : isTerminatorForBraceItemListKind ( BraceItemListKind Kind , <nl> <nl> void Parser : : consumeTopLevelDecl ( ParserPosition BeginParserPosition , <nl> TopLevelCodeDecl * TLCD ) { <nl> - SyntaxParsingContext Discarding ( SyntaxContext ) ; <nl> - Discarding . setDiscard ( ) ; <nl> SourceLoc EndLoc = PreviousLoc ; <nl> backtrackToPosition ( BeginParserPosition ) ; <nl> SourceLoc BeginLoc = Tok . getLoc ( ) ; <nl> mmm a / lib / Parse / ParseType . cpp <nl> ppp b / lib / Parse / ParseType . cpp <nl> LayoutConstraint Parser : : parseLayoutConstraint ( Identifier LayoutConstraintID ) { <nl> / / / type - simple ' ! ' <nl> / / / type - collection <nl> / / / type - array <nl> - Parser : : TypeResult Parser : : parseTypeSimple ( Diag < > MessageID , <nl> - bool HandleCodeCompletion ) { <nl> + ParserResult < TypeRepr > Parser : : parseTypeSimple ( Diag < > MessageID , <nl> + bool HandleCodeCompletion ) { <nl> + ParserResult < TypeRepr > ty ; <nl> + <nl> if ( Tok . is ( tok : : kw_inout ) | | <nl> ( Tok . is ( tok : : identifier ) & & ( Tok . getRawText ( ) . equals ( " __shared " ) | | <nl> Tok . getRawText ( ) . equals ( " __owned " ) ) ) ) { <nl> Parser : : TypeResult Parser : : parseTypeSimple ( Diag < > MessageID , <nl> consumeToken ( ) ; <nl> } <nl> <nl> - auto TypeLoc = leadingTriviaLoc ( ) ; <nl> - <nl> - Optional < TypeResult > Result ; <nl> switch ( Tok . getKind ( ) ) { <nl> case tok : : kw_Self : <nl> case tok : : kw_Any : <nl> - case tok : : identifier : <nl> - Result = parseTypeIdentifier ( ) ; <nl> + case tok : : identifier : { <nl> + ty = parseTypeIdentifier ( ) ; <nl> break ; <nl> + } <nl> case tok : : l_paren : <nl> - Result = parseTypeTupleBody ( ) ; <nl> + ty = parseTypeTupleBody ( ) ; <nl> break ; <nl> - case tok : : code_complete : { <nl> + case tok : : code_complete : <nl> if ( ! HandleCodeCompletion ) <nl> break ; <nl> if ( CodeCompletion ) <nl> CodeCompletion - > completeTypeSimpleBeginning ( ) ; <nl> / / Eat the code completion token because we handled it . <nl> - auto Token = consumeTokenSyntax ( tok : : code_complete ) ; <nl> - return makeParsedCodeCompletion < ParsedTypeSyntax > ( { Token } ) ; <nl> - } <nl> - case tok : : l_square : <nl> - Result = parseTypeCollection ( ) ; <nl> + consumeToken ( tok : : code_complete ) ; <nl> + return makeParserCodeCompletionResult < TypeRepr > ( ) ; <nl> + case tok : : l_square : { <nl> + auto Result = parseTypeCollection ( ) ; <nl> + if ( Result . hasSyntax ( ) ) <nl> + SyntaxContext - > addSyntax ( Result . getSyntax ( ) ) ; <nl> + ty = Result . getASTResult ( ) ; <nl> break ; <nl> + } <nl> case tok : : kw_protocol : <nl> if ( startsWithLess ( peekToken ( ) ) ) { <nl> - Result = parseOldStyleProtocolComposition ( ) ; <nl> + ty = parseOldStyleProtocolComposition ( ) ; <nl> break ; <nl> } <nl> LLVM_FALLTHROUGH ; <nl> Parser : : TypeResult Parser : : parseTypeSimple ( Diag < > MessageID , <nl> diag . fixItInsert ( getEndOfPreviousLoc ( ) , " < # type # > " ) ; <nl> } <nl> if ( Tok . isKeyword ( ) & & ! Tok . isAtStartOfLine ( ) ) { <nl> - auto Token = consumeTokenSyntax ( ) ; <nl> - return makeParsedError < ParsedTypeSyntax > ( { Token } ) ; <nl> + ty = makeParserErrorResult ( new ( Context ) ErrorTypeRepr ( Tok . getLoc ( ) ) ) ; <nl> + consumeToken ( ) ; <nl> + return ty ; <nl> } <nl> - <nl> checkForInputIncomplete ( ) ; <nl> - return makeParsedErrorEmpty < ParsedTypeSyntax > ( ) ; <nl> + return nullptr ; <nl> } <nl> <nl> + auto makeMetatypeTypeSyntax = [ & ] ( ) { <nl> + ParsedMetatypeTypeSyntaxBuilder Builder ( * SyntaxContext ) ; <nl> + auto TypeOrProtocol = SyntaxContext - > popToken ( ) ; <nl> + auto Period = SyntaxContext - > popToken ( ) ; <nl> + auto BaseType = SyntaxContext - > popIf < ParsedTypeSyntax > ( ) . getValue ( ) ; <nl> + Builder <nl> + . useTypeOrProtocol ( TypeOrProtocol ) <nl> + . usePeriod ( Period ) <nl> + . useBaseType ( BaseType ) ; <nl> + SyntaxContext - > addSyntax ( Builder . build ( ) ) ; <nl> + } ; <nl> + <nl> / / ' . Type ' , ' . Protocol ' , ' ? ' , ' ! ' , and ' [ ] ' still leave us with type - simple . <nl> - while ( Result - > isSuccess ( ) | | ! Result - > getUnknownNodes ( ) . empty ( ) ) { <nl> - auto PrevType = Result - > isSuccess ( ) <nl> - ? Result - > getResult ( ) <nl> - : ParsedSyntaxRecorder : : makeUnknownType ( <nl> - Result - > getUnknownNodes ( ) , * SyntaxContext ) ; <nl> - if ( ( Tok . is ( tok : : period ) | | Tok . is ( tok : : period_prefix ) ) & & <nl> - ( peekToken ( ) . isContextualKeyword ( " Type " ) | | <nl> - peekToken ( ) . isContextualKeyword ( " Protocol " ) ) ) { <nl> - Result = parseMetatypeType ( PrevType ) ; <nl> - continue ; <nl> + while ( ty . isNonNull ( ) ) { <nl> + if ( ( Tok . is ( tok : : period ) | | Tok . is ( tok : : period_prefix ) ) ) { <nl> + if ( peekToken ( ) . isContextualKeyword ( " Type " ) ) { <nl> + consumeToken ( ) ; <nl> + SourceLoc metatypeLoc = consumeToken ( tok : : identifier ) ; <nl> + ty = makeParserResult ( ty , <nl> + new ( Context ) MetatypeTypeRepr ( ty . get ( ) , metatypeLoc ) ) ; <nl> + makeMetatypeTypeSyntax ( ) ; <nl> + continue ; <nl> + } <nl> + if ( peekToken ( ) . isContextualKeyword ( " Protocol " ) ) { <nl> + consumeToken ( ) ; <nl> + SourceLoc protocolLoc = consumeToken ( tok : : identifier ) ; <nl> + ty = makeParserResult ( ty , <nl> + new ( Context ) ProtocolTypeRepr ( ty . get ( ) , protocolLoc ) ) ; <nl> + makeMetatypeTypeSyntax ( ) ; <nl> + continue ; <nl> + } <nl> } <nl> <nl> if ( ! Tok . isAtStartOfLine ( ) ) { <nl> if ( isOptionalToken ( Tok ) ) { <nl> - Result = parseOptionalType ( PrevType ) ; <nl> + auto Result = parseTypeOptional ( ty . get ( ) ) ; <nl> + if ( Result . hasSyntax ( ) ) <nl> + SyntaxContext - > addSyntax ( Result . getSyntax ( ) ) ; <nl> + ty = Result . getASTResult ( ) ; <nl> continue ; <nl> } <nl> if ( isImplicitlyUnwrappedOptionalToken ( Tok ) ) { <nl> - Result = parseImplicitlyUnwrappedOptionalType ( PrevType ) ; <nl> + auto Result = parseTypeImplicitlyUnwrappedOptional ( ty . get ( ) ) ; <nl> + if ( Result . hasSyntax ( ) ) <nl> + SyntaxContext - > addSyntax ( Result . getSyntax ( ) ) ; <nl> + ty = Result . getASTResult ( ) ; <nl> continue ; <nl> } <nl> / / Parse legacy array types for migration . <nl> if ( Tok . is ( tok : : l_square ) ) { <nl> - Result = parseTypeArray ( PrevType , TypeLoc ) ; <nl> + ty = parseTypeArray ( ty . get ( ) ) ; <nl> continue ; <nl> } <nl> } <nl> - if ( ! Result - > isSuccess ( ) ) <nl> - Result = <nl> - makeParsedResult < ParsedTypeSyntax > ( { PrevType } , Result - > getStatus ( ) ) ; <nl> break ; <nl> } <nl> <nl> - return * Result ; <nl> + return ty ; <nl> } <nl> <nl> - Parser : : TypeASTResult Parser : : parseType ( ) { <nl> + ParserResult < TypeRepr > Parser : : parseType ( ) { <nl> return parseType ( diag : : expected_type ) ; <nl> } <nl> <nl> - Parser : : TypeASTResult Parser : : parseSILBoxType ( GenericParamList * generics , <nl> - const TypeAttributes & attrs , <nl> - Optional < Scope > & GenericsScope ) { <nl> + ParserResult < TypeRepr > Parser : : parseSILBoxType ( GenericParamList * generics , <nl> + const TypeAttributes & attrs , <nl> + Optional < Scope > & GenericsScope ) { <nl> auto LBraceLoc = consumeToken ( tok : : l_brace ) ; <nl> <nl> SmallVector < SILBoxTypeRepr : : Field , 4 > Fields ; <nl> Parser : : TypeASTResult Parser : : parseSILBoxType ( GenericParamList * generics , <nl> <nl> RAngleLoc = consumeToken ( ) ; <nl> } <nl> - <nl> - auto SILType = SILBoxTypeRepr : : create ( Context , generics , LBraceLoc , Fields , <nl> - RBraceLoc , LAngleLoc , Args , RAngleLoc ) ; <nl> - <nl> - auto AttributedType = applyAttributeToType ( <nl> - SILType , attrs , ParamDecl : : Specifier : : Owned , SourceLoc ( ) ) ; <nl> - <nl> - return makeParserResult ( AttributedType ) ; <nl> + <nl> + auto repr = SILBoxTypeRepr : : create ( Context , generics , <nl> + LBraceLoc , Fields , RBraceLoc , <nl> + LAngleLoc , Args , RAngleLoc ) ; <nl> + return makeParserResult ( applyAttributeToType ( repr , attrs , <nl> + ParamDecl : : Specifier : : Owned , <nl> + SourceLoc ( ) ) ) ; <nl> } <nl> <nl> + <nl> / / / parseType <nl> / / / type : <nl> / / / attribute - list type - composition <nl> Parser : : TypeASTResult Parser : : parseSILBoxType ( GenericParamList * generics , <nl> / / / type - function : <nl> / / / type - composition ' throws ' ? ' - > ' type <nl> / / / <nl> - Parser : : TypeASTResult Parser : : parseType ( Diag < > MessageID , <nl> - bool HandleCodeCompletion , <nl> - bool IsSILFuncDecl ) { <nl> + ParserResult < TypeRepr > Parser : : parseType ( Diag < > MessageID , <nl> + bool HandleCodeCompletion , <nl> + bool IsSILFuncDecl ) { <nl> / / Start a context for creating type syntax . <nl> SyntaxParsingContext TypeParsingContext ( SyntaxContext , <nl> SyntaxContextKind : : Type ) ; <nl> - auto TypeLoc = Tok . getLoc ( ) ; <nl> - <nl> / / Parse attributes . <nl> ParamDecl : : Specifier specifier ; <nl> SourceLoc specifierLoc ; <nl> Parser : : TypeASTResult Parser : : parseType ( Diag < > MessageID , <nl> <nl> / / In SIL mode , parse box types { . . . } . <nl> if ( isInSILMode ( ) & & Tok . is ( tok : : l_brace ) ) { <nl> - auto SILBoxType = parseSILBoxType ( generics , attrs , GenericsScope ) ; <nl> - Generator . addType ( SILBoxType . getPtrOrNull ( ) , TypeLoc ) ; <nl> - return SILBoxType ; <nl> + return parseSILBoxType ( generics , attrs , GenericsScope ) ; <nl> } <nl> <nl> - auto RealTypeLoc = Tok . getLoc ( ) ; <nl> - <nl> ParserResult < TypeRepr > ty = <nl> - parseTypeSimpleOrCompositionAST ( MessageID , HandleCodeCompletion ) ; <nl> + parseTypeSimpleOrComposition ( MessageID , HandleCodeCompletion ) ; <nl> if ( ty . hasCodeCompletion ( ) ) <nl> return makeParserCodeCompletionResult < TypeRepr > ( ) ; <nl> if ( ty . isNull ( ) ) <nl> Parser : : TypeASTResult Parser : : parseType ( Diag < > MessageID , <nl> / / Parse a throws specifier . <nl> / / Don ' t consume ' throws ' , if the next token is not ' - > ' , so we can emit a <nl> / / more useful diagnostic when parsing a function decl . <nl> - Optional < ParsedTokenSyntax > Throws ; <nl> + SourceLoc throwsLoc ; <nl> if ( Tok . isAny ( tok : : kw_throws , tok : : kw_rethrows , tok : : kw_throw ) & & <nl> peekToken ( ) . is ( tok : : arrow ) ) { <nl> if ( Tok . isNot ( tok : : kw_throws ) ) { <nl> Parser : : TypeASTResult Parser : : parseType ( Diag < > MessageID , <nl> diagnose ( Tok . getLoc ( ) , DiagID ) <nl> . fixItReplace ( Tok . getLoc ( ) , " throws " ) ; <nl> } <nl> - <nl> - Throws = consumeTokenSyntax ( ) ; <nl> + throwsLoc = consumeToken ( ) ; <nl> } <nl> <nl> if ( Tok . is ( tok : : arrow ) ) { <nl> / / Handle type - function if we have an arrow . <nl> - auto ArrowLoc = Tok . getLoc ( ) ; <nl> - auto Arrow = consumeTokenSyntax ( ) ; <nl> + SourceLoc arrowLoc = consumeToken ( ) ; <nl> if ( Tok . is ( tok : : kw_throws ) ) { <nl> Diag < > DiagID = diag : : throws_in_wrong_position ; <nl> diagnose ( Tok . getLoc ( ) , DiagID ) <nl> - . fixItInsert ( ArrowLoc , " throws " ) <nl> + . fixItInsert ( arrowLoc , " throws " ) <nl> . fixItRemove ( Tok . getLoc ( ) ) ; <nl> - Throws = consumeTokenSyntax ( ) ; <nl> + throwsLoc = consumeToken ( ) ; <nl> } <nl> ParserResult < TypeRepr > SecondHalf = <nl> parseType ( diag : : expected_type_function_result ) ; <nl> - if ( SecondHalf . isParseError ( ) ) { <nl> - if ( Throws ) <nl> - SyntaxContext - > addSyntax ( * Throws ) ; <nl> - SyntaxContext - > addSyntax ( Arrow ) ; <nl> - if ( SecondHalf . hasCodeCompletion ( ) ) <nl> - return makeParserCodeCompletionResult < TypeRepr > ( ) ; <nl> - if ( SecondHalf . isNull ( ) ) <nl> - return nullptr ; <nl> - } <nl> + if ( SecondHalf . hasCodeCompletion ( ) ) <nl> + return makeParserCodeCompletionResult < TypeRepr > ( ) ; <nl> + if ( SecondHalf . isNull ( ) ) <nl> + return nullptr ; <nl> <nl> ParsedFunctionTypeSyntaxBuilder Builder ( * SyntaxContext ) ; <nl> Builder . useReturnType ( SyntaxContext - > popIf < ParsedTypeSyntax > ( ) . getValue ( ) ) ; <nl> - Builder . useArrow ( Arrow ) ; <nl> - if ( Throws ) <nl> - Builder . useThrowsOrRethrowsKeyword ( * Throws ) ; <nl> + Builder . useArrow ( SyntaxContext - > popToken ( ) ) ; <nl> + if ( throwsLoc . isValid ( ) ) <nl> + Builder . useThrowsOrRethrowsKeyword ( SyntaxContext - > popToken ( ) ) ; <nl> <nl> auto InputNode = SyntaxContext - > popIf < ParsedTypeSyntax > ( ) . getValue ( ) ; <nl> - bool isVoid = false ; <nl> if ( auto TupleTypeNode = InputNode . getAs < ParsedTupleTypeSyntax > ( ) ) { <nl> / / Decompose TupleTypeSyntax and repack into FunctionType . <nl> auto LeftParen = TupleTypeNode - > getDeferredLeftParen ( ) ; <nl> Parser : : TypeASTResult Parser : : parseType ( Diag < > MessageID , <nl> . useArguments ( Arguments ) <nl> . useRightParen ( RightParen ) ; <nl> } else { <nl> - / / FIXME ( syntaxparse ) : Extract ' Void ' text from recoreded node . <nl> - if ( const auto Void = dyn_cast < SimpleIdentTypeRepr > ( tyR ) ) <nl> - isVoid = ( Void - > getIdentifier ( ) . str ( ) = = " Void " ) ; <nl> + Builder . addArgumentsMember ( ParsedSyntaxRecorder : : makeTupleTypeElement ( <nl> + InputNode , / * TrailingComma = * / None , * SyntaxContext ) ) ; <nl> + } <nl> + SyntaxContext - > addSyntax ( Builder . build ( ) ) ; <nl> + <nl> + TupleTypeRepr * argsTyR = nullptr ; <nl> + if ( auto * TTArgs = dyn_cast < TupleTypeRepr > ( tyR ) ) { <nl> + argsTyR = TTArgs ; <nl> + } else { <nl> + bool isVoid = false ; <nl> + if ( const auto Void = dyn_cast < SimpleIdentTypeRepr > ( tyR ) ) { <nl> + if ( Void - > getIdentifier ( ) . str ( ) = = " Void " ) { <nl> + isVoid = true ; <nl> + } <nl> + } <nl> <nl> if ( isVoid ) { <nl> diagnose ( tyR - > getStartLoc ( ) , diag : : function_type_no_parens ) <nl> . fixItReplace ( tyR - > getStartLoc ( ) , " ( ) " ) ; <nl> + argsTyR = TupleTypeRepr : : createEmpty ( Context , tyR - > getSourceRange ( ) ) ; <nl> } else { <nl> diagnose ( tyR - > getStartLoc ( ) , diag : : function_type_no_parens ) <nl> . highlight ( tyR - > getSourceRange ( ) ) <nl> . fixItInsert ( tyR - > getStartLoc ( ) , " ( " ) <nl> . fixItInsertAfter ( tyR - > getEndLoc ( ) , " ) " ) ; <nl> + argsTyR = TupleTypeRepr : : create ( Context , { tyR } , <nl> + tyR - > getSourceRange ( ) ) ; <nl> } <nl> - Builder . addArgumentsMember ( ParsedSyntaxRecorder : : makeTupleTypeElement ( <nl> - InputNode , / * TrailingComma = * / None , * SyntaxContext ) ) ; <nl> } <nl> - SyntaxContext - > addSyntax ( Builder . build ( ) ) ; <nl> <nl> - auto FunctionType = SyntaxContext - > topNode < FunctionTypeSyntax > ( ) ; <nl> - tyR = Generator . generate ( FunctionType , RealTypeLoc ) ; <nl> - <nl> - if ( generics | | isVoid ) { <nl> - auto FunctionTypeAST = cast < FunctionTypeRepr > ( tyR ) ; <nl> - <nl> - / / TODO ( syntaxparse ) : Represent ' Void - > ( ) ' in libSyntax ? <nl> - auto argsTyR = FunctionTypeAST - > getArgsTypeRepr ( ) ; <nl> - if ( isVoid ) <nl> - argsTyR = TupleTypeRepr : : createEmpty ( Context , tyR - > getSourceRange ( ) ) ; <nl> - <nl> - / / TODO ( syntaxparse ) : Represent SIL generic type in libSyntax . <nl> - tyR = new ( Context ) FunctionTypeRepr ( <nl> - generics , argsTyR , FunctionTypeAST - > getThrowsLoc ( ) , <nl> - FunctionTypeAST - > getArrowLoc ( ) , FunctionTypeAST - > getResultTypeRepr ( ) ) ; <nl> - } <nl> + tyR = new ( Context ) FunctionTypeRepr ( generics , argsTyR , throwsLoc , arrowLoc , <nl> + SecondHalf . get ( ) ) ; <nl> } else if ( generics ) { <nl> / / Only function types may be generic . <nl> auto brackets = generics - > getSourceRange ( ) ; <nl> Parser : : TypeASTResult Parser : : parseType ( Diag < > MessageID , <nl> if ( specifierLoc . isValid ( ) | | ! attrs . empty ( ) ) <nl> SyntaxContext - > setCreateSyntax ( SyntaxKind : : AttributedType ) ; <nl> <nl> - auto attributedType = applyAttributeToType ( tyR , attrs , specifier , specifierLoc ) ; <nl> - <nl> - Generator . addType ( attributedType , TypeLoc ) ; <nl> - <nl> - return makeParserResult ( attributedType ) ; <nl> + return makeParserResult ( applyAttributeToType ( tyR , attrs , specifier , <nl> + specifierLoc ) ) ; <nl> } <nl> <nl> - Parser : : TypeASTResult Parser : : parseDeclResultType ( Diag < > MessageID ) { <nl> + ParserResult < TypeRepr > Parser : : parseDeclResultType ( Diag < > MessageID ) { <nl> if ( Tok . is ( tok : : code_complete ) ) { <nl> if ( CodeCompletion ) <nl> CodeCompletion - > completeTypeDeclResultBeginning ( ) ; <nl> SourceLoc Parser : : getTypeErrorLoc ( ) const { <nl> return getErrorOrMissingLoc ( ) ; <nl> } <nl> <nl> - ParsedSyntaxResult < ParsedGenericArgumentClauseSyntax > <nl> - Parser : : parseGenericArgumentClauseSyntax ( ) { <nl> - assert ( startsWithLess ( Tok ) & & " Generic parameter list must start with ' < ' " ) ; <nl> - auto LAngleLoc = Tok . getLoc ( ) ; <nl> - auto LAngle = consumeStartingLessSyntax ( ) ; <nl> + ParserStatus Parser : : parseGenericArguments ( SmallVectorImpl < TypeRepr * > & Args , <nl> + SourceLoc & LAngleLoc , <nl> + SourceLoc & RAngleLoc ) { <nl> + SyntaxParsingContext GenericArgumentsContext ( <nl> + SyntaxContext , SyntaxKind : : GenericArgumentClause ) ; <nl> <nl> - SmallVector < ParsedGenericArgumentSyntax , 4 > Args ; <nl> - SmallVector < ParsedSyntax , 0 > Junk ; <nl> + / / Parse the opening ' < ' . <nl> + assert ( startsWithLess ( Tok ) & & " Generic parameter list must start with ' < ' " ) ; <nl> + LAngleLoc = consumeStartingLess ( ) ; <nl> + <nl> + { <nl> + SyntaxParsingContext ListContext ( SyntaxContext , <nl> + SyntaxKind : : GenericArgumentList ) ; <nl> + <nl> + while ( true ) { <nl> + SyntaxParsingContext ElementContext ( SyntaxContext , <nl> + SyntaxKind : : GenericArgument ) ; <nl> + ParserResult < TypeRepr > Ty = parseType ( diag : : expected_type ) ; <nl> + if ( Ty . isNull ( ) | | Ty . hasCodeCompletion ( ) ) { <nl> + / / Skip until we hit the ' > ' . <nl> + RAngleLoc = skipUntilGreaterInTypeList ( ) ; <nl> + return ParserStatus ( Ty ) ; <nl> + } <nl> <nl> - while ( true ) { <nl> - ParserResult < TypeRepr > Ty = parseType ( diag : : expected_type ) ; <nl> - auto Type = SyntaxContext - > popIf < ParsedTypeSyntax > ( ) ; <nl> - if ( Ty . isParseError ( ) | | Ty . hasCodeCompletion ( ) ) { <nl> - Junk . push_back ( LAngle ) ; <nl> - Junk . append ( Args . begin ( ) , Args . end ( ) ) ; <nl> - if ( Type ) <nl> - Junk . push_back ( * Type ) ; <nl> - skipUntilGreaterInTypeListSyntax ( Junk ) ; <nl> - return makeParsedResult < ParsedGenericArgumentClauseSyntax > ( Junk , Ty . getStatus ( ) ) ; <nl> + Args . push_back ( Ty . get ( ) ) ; <nl> + / / Parse the comma , if the list continues . <nl> + if ( ! consumeIf ( tok : : comma ) ) <nl> + break ; <nl> } <nl> - auto Comma = consumeTokenSyntaxIf ( tok : : comma ) ; <nl> - auto Arg = ParsedSyntaxRecorder : : makeGenericArgument ( * Type , Comma , * SyntaxContext ) ; <nl> - Args . push_back ( Arg ) ; <nl> - if ( ! Comma ) <nl> - break ; <nl> } <nl> <nl> if ( ! startsWithGreater ( Tok ) ) { <nl> Parser : : parseGenericArgumentClauseSyntax ( ) { <nl> diagnose ( Tok , diag : : expected_rangle_generic_arg_list ) ; <nl> diagnose ( LAngleLoc , diag : : opening_angle ) ; <nl> <nl> - Junk . push_back ( LAngle ) ; <nl> - for ( auto & & Arg : Args ) <nl> - Junk . push_back ( Arg ) ; <nl> - skipUntilGreaterInTypeListSyntax ( Junk ) ; <nl> - return makeParsedError < ParsedGenericArgumentClauseSyntax > ( Junk ) ; <nl> - } <nl> - <nl> - auto ArgList = <nl> - ParsedSyntaxRecorder : : makeGenericArgumentList ( Args , * SyntaxContext ) ; <nl> - auto RAngle = consumeStartingGreaterSyntax ( ) ; <nl> - auto Clause = ParsedSyntaxRecorder : : makeGenericArgumentClause ( <nl> - LAngle , ArgList , RAngle , * SyntaxContext ) ; <nl> - return makeParsedSuccess ( Clause ) ; <nl> - } <nl> - <nl> - ParserStatus <nl> - Parser : : parseGenericArgumentsAST ( SmallVectorImpl < TypeRepr * > & ArgsAST , <nl> - SourceLoc & LAngleLoc , SourceLoc & RAngleLoc ) { <nl> - auto StartLoc = leadingTriviaLoc ( ) ; <nl> - auto ParsedClauseResult = parseGenericArgumentClauseSyntax ( ) ; <nl> - <nl> - if ( ! ParsedClauseResult . isSuccess ( ) ) { <nl> - for ( auto & & Node : ParsedClauseResult . getUnknownNodes ( ) ) <nl> - SyntaxContext - > addSyntax ( Node ) ; <nl> - if ( ParsedClauseResult . isCodeCompletion ( ) ) <nl> - return makeParserCodeCompletionStatus ( ) ; <nl> + / / Skip until we hit the ' > ' . <nl> + RAngleLoc = skipUntilGreaterInTypeList ( ) ; <nl> return makeParserError ( ) ; <nl> + } else { <nl> + RAngleLoc = consumeStartingGreater ( ) ; <nl> } <nl> <nl> - SyntaxContext - > addSyntax ( ParsedClauseResult . getResult ( ) ) ; <nl> - auto Clause = SyntaxContext - > topNode < GenericArgumentClauseSyntax > ( ) ; <nl> - <nl> - LAngleLoc = Generator . generate ( Clause . getLeftAngleBracket ( ) , StartLoc ) ; <nl> - for ( auto & & ArgAST : Generator . generate ( Clause . getArguments ( ) , StartLoc ) ) <nl> - ArgsAST . push_back ( ArgAST ) ; <nl> - RAngleLoc = Generator . generate ( Clause . getRightAngleBracket ( ) , StartLoc ) ; <nl> return makeParserSuccess ( ) ; <nl> } <nl> <nl> Parser : : parseGenericArgumentsAST ( SmallVectorImpl < TypeRepr * > & ArgsAST , <nl> / / / type - identifier : <nl> / / / identifier generic - args ? ( ' . ' identifier generic - args ? ) * <nl> / / / <nl> - Parser : : TypeResult Parser : : parseTypeIdentifier ( ) { <nl> + ParserResult < TypeRepr > Parser : : parseTypeIdentifier ( ) { <nl> if ( Tok . isNot ( tok : : identifier ) & & Tok . isNot ( tok : : kw_Self ) ) { <nl> / / is this the ' Any ' type <nl> - if ( Tok . is ( tok : : kw_Any ) ) <nl> + if ( Tok . is ( tok : : kw_Any ) ) { <nl> return parseAnyType ( ) ; <nl> - <nl> - if ( Tok . is ( tok : : code_complete ) ) { <nl> + } else if ( Tok . is ( tok : : code_complete ) ) { <nl> if ( CodeCompletion ) <nl> CodeCompletion - > completeTypeSimpleBeginning ( ) ; <nl> / / Eat the code completion token because we handled it . <nl> - SmallVector < ParsedSyntax , 0 > CodeComplete { consumeTokenSyntax ( tok : : code_complete ) } ; <nl> - return makeParsedCodeCompletion < ParsedTypeSyntax > ( CodeComplete ) ; <nl> + consumeToken ( tok : : code_complete ) ; <nl> + return makeParserCodeCompletionResult < IdentTypeRepr > ( ) ; <nl> } <nl> <nl> diagnose ( Tok , diag : : expected_identifier_for_type ) ; <nl> <nl> / / If there is a keyword at the start of a new line , we won ' t want to <nl> / / skip it as a recovery but rather keep it . <nl> - if ( Tok . isKeyword ( ) & & ! Tok . isAtStartOfLine ( ) ) { <nl> - return makeParsedError < ParsedTypeSyntax > ( { consumeTokenSyntax ( ) } ) ; <nl> - } <nl> + if ( Tok . isKeyword ( ) & & ! Tok . isAtStartOfLine ( ) ) <nl> + consumeToken ( ) ; <nl> <nl> - return makeParsedErrorEmpty < ParsedTypeSyntax > ( ) ; <nl> + return nullptr ; <nl> } <nl> + SyntaxParsingContext IdentTypeCtxt ( SyntaxContext , SyntaxContextKind : : Type ) ; <nl> <nl> - SmallVector < ParsedSyntax , 0 > Junk ; <nl> - <nl> - auto BaseLoc = leadingTriviaLoc ( ) ; <nl> ParserStatus Status ; <nl> - Optional < ParsedTypeSyntax > Base ; <nl> - Optional < ParsedTokenSyntax > Period ; <nl> + SmallVector < ComponentIdentTypeRepr * , 4 > ComponentsR ; <nl> + SourceLoc EndLoc ; <nl> while ( true ) { <nl> - Optional < ParsedTokenSyntax > Identifier ; <nl> + SourceLoc Loc ; <nl> + Identifier Name ; <nl> if ( Tok . is ( tok : : kw_Self ) ) { <nl> - Identifier = consumeIdentifierSyntax ( ) ; <nl> + Loc = consumeIdentifier ( & Name ) ; <nl> } else { <nl> / / FIXME : specialize diagnostic for ' Type ' : type cannot start with <nl> / / ' metatype ' <nl> / / FIXME : offer a fixit : ' self ' - > ' Self ' <nl> - Identifier = <nl> - parseIdentifierSyntax ( diag : : expected_identifier_in_dotted_type ) ; <nl> - if ( ! Identifier ) { <nl> + if ( parseIdentifier ( Name , Loc , diag : : expected_identifier_in_dotted_type ) ) <nl> Status . setIsParseError ( ) ; <nl> - if ( Base ) <nl> - Junk . push_back ( * Base ) ; <nl> - if ( Period ) <nl> - Junk . push_back ( * Period ) ; <nl> - } <nl> } <nl> <nl> - if ( Identifier ) { <nl> - Optional < ParsedGenericArgumentClauseSyntax > GenericArgs ; <nl> - <nl> + if ( Loc . isValid ( ) ) { <nl> + SourceLoc LAngle , RAngle ; <nl> + SmallVector < TypeRepr * , 8 > GenericArgs ; <nl> if ( startsWithLess ( Tok ) ) { <nl> - SmallVector < TypeRepr * , 4 > GenericArgsAST ; <nl> - SourceLoc LAngleLoc , RAngleLoc ; <nl> - auto GenericArgsResult = <nl> - parseGenericArgumentsAST ( GenericArgsAST , LAngleLoc , RAngleLoc ) ; <nl> - if ( ! GenericArgsResult . isSuccess ( ) ) { <nl> - if ( Base ) <nl> - Junk . push_back ( * Base ) ; <nl> - if ( Period ) <nl> - Junk . push_back ( * Period ) ; <nl> - Junk . push_back ( * Identifier ) ; <nl> - if ( auto GenericJunk = SyntaxContext - > popIf < ParsedSyntax > ( ) ) <nl> - Junk . push_back ( * GenericJunk ) ; <nl> - return makeParsedResult < ParsedTypeSyntax > ( Junk , GenericArgsResult ) ; <nl> - } <nl> - GenericArgs = SyntaxContext - > popIf < ParsedGenericArgumentClauseSyntax > ( ) ; <nl> + auto genericArgsStatus = parseGenericArguments ( GenericArgs , LAngle , RAngle ) ; <nl> + if ( genericArgsStatus . isError ( ) ) <nl> + return genericArgsStatus ; <nl> } <nl> + EndLoc = Loc ; <nl> <nl> - if ( ! Base ) <nl> - Base = ParsedSyntaxRecorder : : makeSimpleTypeIdentifier ( <nl> - * Identifier , GenericArgs , * SyntaxContext ) ; <nl> + ComponentIdentTypeRepr * CompT ; <nl> + if ( ! GenericArgs . empty ( ) ) <nl> + CompT = GenericIdentTypeRepr : : create ( Context , Loc , Name , GenericArgs , <nl> + SourceRange ( LAngle , RAngle ) ) ; <nl> else <nl> - Base = ParsedSyntaxRecorder : : makeMemberTypeIdentifier ( <nl> - * Base , * Period , * Identifier , GenericArgs , * SyntaxContext ) ; <nl> + CompT = new ( Context ) SimpleIdentTypeRepr ( Loc , Name ) ; <nl> + ComponentsR . push_back ( CompT ) ; <nl> } <nl> + SyntaxContext - > createNodeInPlace ( ComponentsR . size ( ) = = 1 <nl> + ? SyntaxKind : : SimpleTypeIdentifier <nl> + : SyntaxKind : : MemberTypeIdentifier ) ; <nl> <nl> / / Treat ' Foo . < anything > ' as an attempt to write a dotted type <nl> / / unless < anything > is ' Type ' . <nl> Parser : : TypeResult Parser : : parseTypeIdentifier ( ) { <nl> Status . setHasCodeCompletion ( ) ; <nl> break ; <nl> } <nl> - if ( ! peekToken ( ) . isContextualKeyword ( " Type " ) & & <nl> - ! peekToken ( ) . isContextualKeyword ( " Protocol " ) ) { <nl> - Period = consumeTokenSyntax ( ) ; <nl> + if ( ! peekToken ( ) . isContextualKeyword ( " Type " ) <nl> + & & ! peekToken ( ) . isContextualKeyword ( " Protocol " ) ) { <nl> + consumeToken ( ) ; <nl> continue ; <nl> } <nl> } else if ( Tok . is ( tok : : code_complete ) ) { <nl> Parser : : TypeResult Parser : : parseTypeIdentifier ( ) { <nl> break ; <nl> } <nl> <nl> - if ( Status . hasCodeCompletion ( ) ) { <nl> - IdentTypeRepr * ITR = nullptr ; <nl> - <nl> - if ( Base ) { <nl> - SyntaxContext - > addSyntax ( * Base ) ; <nl> - auto T = SyntaxContext - > topNode < TypeSyntax > ( ) ; <nl> - SyntaxContext - > popIf < ParsedTypeSyntax > ( ) ; <nl> - ITR = dyn_cast < IdentTypeRepr > ( Generator . generate ( T , BaseLoc ) ) ; <nl> - Junk . push_back ( * Base ) ; <nl> - } <nl> + IdentTypeRepr * ITR = nullptr ; <nl> + if ( ! ComponentsR . empty ( ) ) { <nl> + / / Lookup element # 0 through our current scope chains in case it is some <nl> + / / thing local ( this returns null if nothing is found ) . <nl> + if ( auto Entry = lookupInScope ( ComponentsR [ 0 ] - > getIdentifier ( ) ) ) <nl> + if ( auto * TD = dyn_cast < TypeDecl > ( Entry ) ) <nl> + ComponentsR [ 0 ] - > setValue ( TD , nullptr ) ; <nl> + <nl> + ITR = IdentTypeRepr : : create ( Context , ComponentsR ) ; <nl> + } <nl> <nl> + if ( Status . hasCodeCompletion ( ) ) { <nl> if ( Tok . isNot ( tok : : code_complete ) ) { <nl> / / We have a dot . <nl> - auto Dot = consumeTokenSyntax ( ) ; <nl> - Junk . push_back ( Dot ) ; <nl> + consumeToken ( ) ; <nl> if ( CodeCompletion ) <nl> CodeCompletion - > completeTypeIdentifierWithDot ( ITR ) ; <nl> } else { <nl> Parser : : TypeResult Parser : : parseTypeIdentifier ( ) { <nl> CodeCompletion - > completeTypeIdentifierWithoutDot ( ITR ) ; <nl> } <nl> / / Eat the code completion token because we handled it . <nl> - Junk . push_back ( consumeTokenSyntax ( tok : : code_complete ) ) ; <nl> - return makeParsedCodeCompletion < ParsedTypeSyntax > ( Junk ) ; <nl> - } <nl> - <nl> - if ( Status . isError ( ) ) <nl> - return makeParsedError < ParsedTypeSyntax > ( Junk ) ; <nl> - <nl> - return makeParsedSuccess ( * Base ) ; <nl> - } <nl> - <nl> - Parser : : TypeASTResult <nl> - Parser : : parseTypeSimpleOrCompositionAST ( Diag < > MessageID , <nl> - bool HandleCodeCompletion ) { <nl> - auto Loc = leadingTriviaLoc ( ) ; <nl> - <nl> - auto CompositionResult = <nl> - parseTypeSimpleOrComposition ( MessageID , HandleCodeCompletion ) ; <nl> - <nl> - if ( ! CompositionResult . isSuccess ( ) ) { <nl> - auto nodes = CompositionResult . getUnknownNodes ( ) ; <nl> - if ( nodes . size ( ) > 0 ) { <nl> - if ( nodes . size ( ) ! = 1 | | ! nodes . front ( ) . is < ParsedTypeSyntax > ( ) ) { <nl> - auto ParsedUnknown = ParsedSyntaxRecorder : : makeUnknownType ( <nl> - nodes , * SyntaxContext ) ; <nl> - SyntaxContext - > addSyntax ( ParsedUnknown ) ; <nl> - } else { <nl> - SyntaxContext - > addSyntax ( nodes . front ( ) ) ; <nl> - } <nl> - } <nl> - TypeRepr * CorrectedAST = nullptr ; <nl> - if ( SyntaxContext - > isTopNode < TypeSyntax > ( ) ) { <nl> - auto Unknown = SyntaxContext - > topNode < TypeSyntax > ( ) ; <nl> - CorrectedAST = Generator . generate ( Unknown , Loc ) ; <nl> - } <nl> - return makeParserResult ( CompositionResult . getStatus ( ) , CorrectedAST ) ; <nl> + consumeToken ( tok : : code_complete ) ; <nl> } <nl> <nl> - SyntaxContext - > addSyntax ( CompositionResult . getResult ( ) ) ; <nl> - auto Composition = SyntaxContext - > topNode < TypeSyntax > ( ) ; <nl> - auto CompositionAST = Generator . generate ( Composition , Loc ) ; <nl> - <nl> - return makeParserResult ( CompositionAST ) ; <nl> + return makeParserResult ( Status , ITR ) ; <nl> } <nl> <nl> / / / parseTypeSimpleOrComposition <nl> Parser : : parseTypeSimpleOrCompositionAST ( Diag < > MessageID , <nl> / / / type - composition : <nl> / / / ' some ' ? type - simple <nl> / / / type - composition ' & ' type - simple <nl> - Parser : : TypeResult <nl> + ParserResult < TypeRepr > <nl> Parser : : parseTypeSimpleOrComposition ( Diag < > MessageID , <nl> bool HandleCodeCompletion ) { <nl> + SyntaxParsingContext SomeTypeContext ( SyntaxContext , SyntaxKind : : SomeType ) ; <nl> / / Check for the opaque modifier . <nl> / / This is only semantically allowed in certain contexts , but we parse it <nl> / / generally for diagnostics and recovery . <nl> - Optional < ParsedTokenSyntax > FirstSome ; <nl> + SourceLoc opaqueLoc ; <nl> if ( Tok . is ( tok : : identifier ) & & Tok . getRawText ( ) = = " some " ) { <nl> / / Treat some as a keyword . <nl> TokReceiver - > registerTokenKindChange ( Tok . getLoc ( ) , tok : : contextual_keyword ) ; <nl> - FirstSome = consumeTokenSyntax ( ) ; <nl> + opaqueLoc = consumeToken ( ) ; <nl> + } else { <nl> + / / This isn ' t a some type . <nl> + SomeTypeContext . setTransparent ( ) ; <nl> } <nl> - <nl> - auto ApplySome = [ this ] ( ParsedTypeSyntax Type , Optional < ParsedTokenSyntax > Some ) { <nl> - return Some ? ParsedSyntaxRecorder : : makeSomeType ( * Some , Type , * SyntaxContext ) <nl> - : Type ; <nl> + <nl> + auto applyOpaque = [ & ] ( TypeRepr * type ) - > TypeRepr * { <nl> + if ( opaqueLoc . isValid ( ) ) { <nl> + type = new ( Context ) OpaqueReturnTypeRepr ( opaqueLoc , type ) ; <nl> + } <nl> + return type ; <nl> } ; <nl> - <nl> - / / Parse the first type <nl> - auto FirstTypeResult = parseTypeSimple ( MessageID , HandleCodeCompletion ) ; <nl> - <nl> - / / todo [ gsoc ] : handle Junk properly here <nl> - if ( ! FirstTypeResult . isSuccess ( ) ) <nl> - return FirstTypeResult ; <nl> - <nl> - auto FirstType = FirstTypeResult . getResult ( ) ; <nl> - <nl> - if ( ! Tok . isContextualPunctuator ( " & " ) ) <nl> - return makeParsedSuccess ( ApplySome ( FirstType , FirstSome ) ) ; <nl> - <nl> - SmallVector < ParsedCompositionTypeElementSyntax , 4 > Elements ; <nl> <nl> - Optional < ParsedTokenSyntax > Ampersand = consumeTokenSyntax ( ) ; <nl> - auto FirstElement = ParsedSyntaxRecorder : : makeCompositionTypeElement ( <nl> - FirstType , * Ampersand , * SyntaxContext ) ; <nl> - Elements . push_back ( FirstElement ) ; <nl> + SyntaxParsingContext CompositionContext ( SyntaxContext , SyntaxContextKind : : Type ) ; <nl> + / / Parse the first type <nl> + ParserResult < TypeRepr > FirstType = parseTypeSimple ( MessageID , <nl> + HandleCodeCompletion ) ; <nl> + if ( FirstType . hasCodeCompletion ( ) ) <nl> + return makeParserCodeCompletionResult < TypeRepr > ( ) ; <nl> + if ( FirstType . isNull ( ) ) <nl> + return FirstType ; <nl> + if ( ! Tok . isContextualPunctuator ( " & " ) ) { <nl> + return makeParserResult ( ParserStatus ( FirstType ) , <nl> + applyOpaque ( FirstType . get ( ) ) ) ; <nl> + } <nl> <nl> - ParserStatus Status ; <nl> + SmallVector < TypeRepr * , 4 > Types ; <nl> + ParserStatus Status ( FirstType ) ; <nl> + SourceLoc FirstTypeLoc = FirstType . get ( ) - > getStartLoc ( ) ; <nl> + SourceLoc FirstAmpersandLoc = Tok . getLoc ( ) ; <nl> + <nl> + auto addType = [ & ] ( TypeRepr * T ) { <nl> + if ( ! T ) return ; <nl> + if ( auto Comp = dyn_cast < CompositionTypeRepr > ( T ) ) { <nl> + / / Accept protocol < P1 , P2 > & P3 ; explode it . <nl> + auto TyRs = Comp - > getTypes ( ) ; <nl> + if ( ! TyRs . empty ( ) ) / / If empty , is ' Any ' ; ignore . <nl> + Types . append ( TyRs . begin ( ) , TyRs . end ( ) ) ; <nl> + return ; <nl> + } <nl> + Types . push_back ( T ) ; <nl> + } ; <nl> <nl> + addType ( FirstType . get ( ) ) ; <nl> + SyntaxContext - > setCreateSyntax ( SyntaxKind : : CompositionType ) ; <nl> + assert ( Tok . isContextualPunctuator ( " & " ) ) ; <nl> do { <nl> + auto Type = SyntaxContext - > popIf < ParsedTypeSyntax > ( ) ; <nl> + consumeToken ( ) ; / / consume ' & ' <nl> + if ( Type ) { <nl> + ParsedCompositionTypeElementSyntaxBuilder Builder ( * SyntaxContext ) ; <nl> + auto Ampersand = SyntaxContext - > popToken ( ) ; <nl> + Builder <nl> + . useAmpersand ( Ampersand ) <nl> + . useType ( Type . getValue ( ) ) ; <nl> + SyntaxContext - > addSyntax ( Builder . build ( ) ) ; <nl> + } <nl> + <nl> / / Diagnose invalid ` some ` after an ampersand . <nl> - Optional < ParsedTokenSyntax > NextSome ; <nl> if ( Tok . is ( tok : : identifier ) & & Tok . getRawText ( ) = = " some " ) { <nl> - auto NextSomeLoc = Tok . getLoc ( ) ; <nl> - NextSome = consumeTokenSyntax ( ) ; <nl> + auto badLoc = consumeToken ( ) ; <nl> + <nl> / / TODO : Fixit to move to beginning of composition . <nl> - diagnose ( NextSomeLoc , diag : : opaque_mid_composition ) ; <nl> - } <nl> - <nl> - auto NextTypeResult = parseTypeSimple ( diag : : expected_identifier_for_type , <nl> - HandleCodeCompletion ) ; <nl> - <nl> - if ( ! NextTypeResult . isSuccess ( ) ) { <nl> - auto following = NextTypeResult . getUnknownNodes ( ) ; <nl> - if ( following . empty ( ) ) { <nl> - Status | = NextTypeResult . getStatus ( ) ; <nl> - break ; <nl> - } <nl> - SmallVector < ParsedSyntax , 0 > nodes = { FirstElement } ; <nl> - nodes . append ( following . begin ( ) , following . end ( ) ) ; <nl> - return makeParsedResult < ParsedTypeSyntax > ( nodes , NextTypeResult . getStatus ( ) ) ; <nl> + diagnose ( badLoc , diag : : opaque_mid_composition ) ; <nl> + <nl> + if ( opaqueLoc . isInvalid ( ) ) <nl> + opaqueLoc = badLoc ; <nl> } <nl> <nl> - auto NextType = ApplySome ( NextTypeResult . getResult ( ) , NextSome ) ; <nl> - Ampersand = Tok . isContextualPunctuator ( " & " ) <nl> - ? consumeTokenSyntax ( ) <nl> - : llvm : : Optional < ParsedTokenSyntax > ( ) ; <nl> - auto NextElement = ParsedSyntaxRecorder : : makeCompositionTypeElement ( <nl> - NextType , Ampersand , * SyntaxContext ) ; <nl> - Elements . push_back ( NextElement ) ; <nl> - } while ( Ampersand ) ; <nl> - <nl> - / / todo [ gsoc ] : handle failure here <nl> - <nl> - auto ElementList = <nl> - ParsedSyntaxRecorder : : makeCompositionTypeElementList ( Elements , * SyntaxContext ) ; <nl> - auto Composition = <nl> - ParsedSyntaxRecorder : : makeCompositionType ( ElementList , * SyntaxContext ) ; <nl> - if ( Status . isSuccess ( ) ) { <nl> - return makeParsedSuccess ( ApplySome ( Composition , FirstSome ) ) ; <nl> - } else { <nl> - return makeParsedResult < ParsedTypeSyntax > ( { ApplySome ( Composition , FirstSome ) } , Status ) ; <nl> + / / Parse next type . <nl> + ParserResult < TypeRepr > ty = <nl> + parseTypeSimple ( diag : : expected_identifier_for_type , HandleCodeCompletion ) ; <nl> + if ( ty . hasCodeCompletion ( ) ) <nl> + return makeParserCodeCompletionResult < TypeRepr > ( ) ; <nl> + Status | = ty ; <nl> + addType ( ty . getPtrOrNull ( ) ) ; <nl> + } while ( Tok . isContextualPunctuator ( " & " ) ) ; <nl> + <nl> + if ( auto synType = SyntaxContext - > popIf < ParsedTypeSyntax > ( ) ) { <nl> + auto LastNode = ParsedSyntaxRecorder : : makeCompositionTypeElement ( <nl> + synType . getValue ( ) , None , * SyntaxContext ) ; <nl> + SyntaxContext - > addSyntax ( LastNode ) ; <nl> } <nl> - <nl> - return makeParsedSuccess ( ApplySome ( Composition , FirstSome ) ) ; <nl> - } <nl> - <nl> - Parser : : TypeASTResult Parser : : parseAnyTypeAST ( ) { <nl> - auto AnyLoc = leadingTriviaLoc ( ) ; <nl> - auto ParsedAny = parseAnyType ( ) . getResult ( ) ; <nl> - SyntaxContext - > addSyntax ( ParsedAny ) ; <nl> - auto Any = SyntaxContext - > topNode < SimpleTypeIdentifierSyntax > ( ) ; <nl> - return makeParserResult ( Generator . generate ( Any , AnyLoc ) ) ; <nl> + SyntaxContext - > collectNodesInPlace ( SyntaxKind : : CompositionTypeElementList ) ; <nl> + <nl> + return makeParserResult ( Status , applyOpaque ( CompositionTypeRepr : : create ( <nl> + Context , Types , FirstTypeLoc , { FirstAmpersandLoc , PreviousLoc } ) ) ) ; <nl> } <nl> <nl> - Parser : : TypeResult Parser : : parseAnyType ( ) { <nl> - auto Any = consumeTokenSyntax ( tok : : kw_Any ) ; <nl> - auto Type = ParsedSyntaxRecorder : : makeSimpleTypeIdentifier ( Any , llvm : : None , <nl> - * SyntaxContext ) ; <nl> - return makeParsedSuccess ( Type ) ; <nl> + ParserResult < CompositionTypeRepr > <nl> + Parser : : parseAnyType ( ) { <nl> + SyntaxParsingContext IdentTypeCtxt ( SyntaxContext , <nl> + SyntaxKind : : SimpleTypeIdentifier ) ; <nl> + auto Loc = consumeToken ( tok : : kw_Any ) ; <nl> + auto TyR = CompositionTypeRepr : : createEmptyComposition ( Context , Loc ) ; <nl> + return makeParserResult ( TyR ) ; <nl> } <nl> <nl> / / / parseOldStyleProtocolComposition <nl> Parser : : TypeResult Parser : : parseAnyType ( ) { <nl> / / / type - composition - list - deprecated : <nl> / / / type - identifier <nl> / / / type - composition - list - deprecated ' , ' type - identifier <nl> - Parser : : TypeErrorResult Parser : : parseOldStyleProtocolComposition ( ) { <nl> - / / Defer all nodes so that we can de - structure the composed types in case we <nl> - / / need to emit a diagnostic ( below ) . <nl> - DeferringContextRAII Deferring ( * SyntaxContext ) ; <nl> + ParserResult < TypeRepr > Parser : : parseOldStyleProtocolComposition ( ) { <nl> + assert ( Tok . is ( tok : : kw_protocol ) & & startsWithLess ( peekToken ( ) ) ) ; <nl> <nl> - SmallVector < ParsedSyntax , 0 > Junk ; <nl> - <nl> - auto ProtocolLoc = Tok . getLoc ( ) ; <nl> - auto Protocol = consumeTokenSyntax ( ) ; <nl> - auto LAngleLoc = Tok . getLoc ( ) ; <nl> - auto LAngle = consumeStartingLessSyntax ( ) ; <nl> + / / Start a context for creating type syntax . <nl> + SyntaxParsingContext TypeParsingContext ( SyntaxContext , <nl> + SyntaxContextKind : : Type ) ; <nl> <nl> - Junk . push_back ( Protocol ) ; <nl> - Junk . push_back ( LAngle ) ; <nl> + SourceLoc ProtocolLoc = consumeToken ( ) ; <nl> + SourceLoc LAngleLoc = consumeStartingLess ( ) ; <nl> <nl> / / Parse the type - composition - list . <nl> ParserStatus Status ; <nl> - SmallVector < ParsedTypeSyntax , 4 > Protocols ; <nl> - Optional < ParsedTokenSyntax > Comma ; <nl> + SmallVector < TypeRepr * , 4 > Protocols ; <nl> bool IsEmpty = startsWithGreater ( Tok ) ; <nl> if ( ! IsEmpty ) { <nl> do { <nl> - bool IsAny = Tok . getKind ( ) = = tok : : kw_Any ; <nl> - auto TypeResult = parseTypeIdentifier ( ) ; <nl> - Status | = TypeResult . getStatus ( ) ; <nl> - if ( TypeResult . isSuccess ( ) ) { <nl> - auto Type = TypeResult . getResult ( ) ; <nl> - Junk . push_back ( Type ) ; <nl> - if ( ! IsAny ) <nl> - Protocols . push_back ( Type ) ; <nl> - } <nl> - Comma = consumeTokenSyntaxIf ( tok : : comma ) ; <nl> - if ( Comma ) <nl> - Junk . push_back ( * Comma ) ; <nl> - } while ( Comma ) ; <nl> + / / Parse the type - identifier . <nl> + ParserResult < TypeRepr > Protocol = parseTypeIdentifier ( ) ; <nl> + Status | = Protocol ; <nl> + if ( auto * ident = <nl> + dyn_cast_or_null < IdentTypeRepr > ( Protocol . getPtrOrNull ( ) ) ) <nl> + Protocols . push_back ( ident ) ; <nl> + } while ( consumeIf ( tok : : comma ) ) ; <nl> } <nl> <nl> / / Check for the terminating ' > ' . <nl> - Optional < SourceLoc > RAngleLoc ; <nl> + SourceLoc RAngleLoc = PreviousLoc ; <nl> if ( startsWithGreater ( Tok ) ) { <nl> - RAngleLoc = Tok . getLoc ( ) ; <nl> - auto RAngle = consumeStartingGreaterSyntax ( ) ; <nl> - Junk . push_back ( RAngle ) ; <nl> + RAngleLoc = consumeStartingGreater ( ) ; <nl> } else { <nl> if ( Status . isSuccess ( ) ) { <nl> diagnose ( Tok , diag : : expected_rangle_protocol ) ; <nl> diagnose ( LAngleLoc , diag : : opening_angle ) ; <nl> Status . setIsParseError ( ) ; <nl> } <nl> - <nl> - SmallVector < ParsedSyntax , 4 > RAngleJunk ; <nl> + <nl> / / Skip until we hit the ' > ' . <nl> - skipUntilGreaterInTypeListSyntax ( RAngleJunk , / * protocolComposition = * / true ) ; <nl> - for ( auto & & Piece : RAngleJunk ) <nl> - Junk . push_back ( Piece ) ; <nl> + RAngleLoc = skipUntilGreaterInTypeList ( / * protocolComposition = * / true ) ; <nl> } <nl> <nl> + auto composition = CompositionTypeRepr : : create ( <nl> + Context , Protocols , ProtocolLoc , { LAngleLoc , RAngleLoc } ) ; <nl> + <nl> if ( Status . isSuccess ( ) ) { <nl> + / / Only if we have complete protocol < . . . > construct , diagnose deprecated . <nl> SmallString < 32 > replacement ; <nl> if ( Protocols . empty ( ) ) { <nl> replacement = " Any " ; <nl> } else { <nl> - auto extractText = [ & ] ( ParsedTypeSyntax Type ) - > StringRef { <nl> - auto SourceRange = Type . getRaw ( ) . getDeferredRange ( ) ; <nl> - return SourceMgr . extractText ( SourceRange ) ; <nl> + auto extractText = [ & ] ( TypeRepr * Ty ) - > StringRef { <nl> + auto SourceRange = Ty - > getSourceRange ( ) ; <nl> + return SourceMgr . extractText ( <nl> + Lexer : : getCharSourceRangeFromSourceRange ( SourceMgr , SourceRange ) ) ; <nl> } ; <nl> auto Begin = Protocols . begin ( ) ; <nl> replacement + = extractText ( * Begin ) ; <nl> Parser : : TypeErrorResult Parser : : parseOldStyleProtocolComposition ( ) { <nl> <nl> / / Copy split token after ' > ' to the replacement string . <nl> / / FIXME : lexer should smartly separate ' > ' and trailing contents like ' ? ' . <nl> - StringRef TrailingContent = L - > getTokenAt ( * RAngleLoc ) . getRange ( ) . str ( ) . <nl> + StringRef TrailingContent = L - > getTokenAt ( RAngleLoc ) . getRange ( ) . str ( ) . <nl> substr ( 1 ) ; <nl> - if ( ! TrailingContent . empty ( ) ) <nl> + if ( ! TrailingContent . empty ( ) ) { <nl> replacement + = TrailingContent ; <nl> + } <nl> <nl> / / Replace ' protocol < T1 , T2 > ' with ' T1 & T2 ' <nl> diagnose ( ProtocolLoc , <nl> IsEmpty ? diag : : deprecated_any_composition : <nl> Protocols . size ( ) > 1 ? diag : : deprecated_protocol_composition : <nl> diag : : deprecated_protocol_composition_single ) <nl> - . highlight ( { ProtocolLoc , * RAngleLoc } ) <nl> - . fixItReplace ( { ProtocolLoc , * RAngleLoc } , replacement ) ; <nl> + . highlight ( composition - > getSourceRange ( ) ) <nl> + . fixItReplace ( composition - > getSourceRange ( ) , replacement ) ; <nl> } <nl> <nl> - auto Unknown = ParsedSyntaxRecorder : : makeUnknownType ( Junk , * SyntaxContext ) ; <nl> - return makeParsedSuccess ( Unknown ) ; <nl> + return makeParserResult ( Status , composition ) ; <nl> } <nl> <nl> / / / parseTypeTupleBody <nl> Parser : : TypeErrorResult Parser : : parseOldStyleProtocolComposition ( ) { <nl> / / / type - tuple - element : <nl> / / / identifier ? identifier ' : ' type <nl> / / / type <nl> - Parser : : TypeResult Parser : : parseTypeTupleBody ( ) { <nl> - / / Force the context to create deferred nodes , as we might need to <nl> - / / de - structure the tuple type to create a function type . <nl> - DeferringContextRAII Deferring ( * SyntaxContext ) ; <nl> + ParserResult < TupleTypeRepr > Parser : : parseTypeTupleBody ( ) { <nl> + SyntaxParsingContext TypeContext ( SyntaxContext , SyntaxKind : : TupleType ) ; <nl> + / / Create it as deferred because when parseType gets this it may need to turn <nl> + / / it into a FunctionType . <nl> + TypeContext . setDeferSyntax ( SyntaxKind : : TupleType ) ; <nl> Parser : : StructureMarkerRAII ParsingTypeTuple ( * this , Tok ) ; <nl> + <nl> + if ( ParsingTypeTuple . isFailed ( ) ) { <nl> + return makeParserError ( ) ; <nl> + } <nl> <nl> - if ( ParsingTypeTuple . isFailed ( ) ) <nl> - return makeParsedError < ParsedTypeSyntax > ( { } ) ; <nl> - <nl> - SmallVector < ParsedSyntax , 0 > Junk ; <nl> - <nl> - auto LParenLoc = Tok . getLoc ( ) ; <nl> - auto LParen = consumeTokenSyntax ( tok : : l_paren ) ; <nl> - <nl> - Junk . push_back ( LParen ) ; <nl> - <nl> - SmallVector < ParsedTupleTypeElementSyntax , 4 > Elements ; <nl> - SmallVector < std : : tuple < SourceLoc , SourceLoc , SourceLoc > , 4 > ElementsLoc ; <nl> - Optional < ParsedTokenSyntax > FirstEllipsis ; <nl> - SourceLoc FirstEllipsisLoc ; <nl> - <nl> - Optional < ParsedTokenSyntax > Comma ; <nl> - <nl> - SourceLoc RParenLoc ; <nl> - Optional < ParsedTokenSyntax > RParen ; <nl> + SourceLoc RPLoc , LPLoc = consumeToken ( tok : : l_paren ) ; <nl> + SourceLoc EllipsisLoc ; <nl> + unsigned EllipsisIdx ; <nl> + SmallVector < TupleTypeReprElement , 8 > ElementsR ; <nl> <nl> - ParserStatus Status = <nl> - parseListSyntax ( tok : : r_paren , LParenLoc , Comma , RParenLoc , RParen , Junk , <nl> - false , diag : : expected_rparen_tuple_type_list , [ & ] ( ) { <nl> - Optional < BacktrackingScope > Backtracking ; <nl> - SmallVector < ParsedSyntax , 0 > LocalJunk ; <nl> + ParserStatus Status = parseList ( tok : : r_paren , LPLoc , RPLoc , <nl> + / * AllowSepAfterLast = * / false , <nl> + diag : : expected_rparen_tuple_type_list , <nl> + SyntaxKind : : TupleTypeElementList , <nl> + [ & ] ( ) - > ParserStatus { <nl> + TupleTypeReprElement element ; <nl> <nl> / / ' inout ' here can be a obsoleted use of the marker in an argument list , <nl> / / consume it in backtracking context so we can determine it ' s really a <nl> / / deprecated use of it . <nl> - SourceLoc InOutLoc ; <nl> - Optional < ParsedTokenSyntax > InOut ; <nl> - bool IsInOutObsoleted = false ; <nl> + llvm : : Optional < BacktrackingScope > Backtracking ; <nl> + SourceLoc ObsoletedInOutLoc ; <nl> if ( Tok . is ( tok : : kw_inout ) ) { <nl> - InOutLoc = Tok . getLoc ( ) ; <nl> - InOut = consumeTokenSyntax ( tok : : kw_inout ) ; <nl> - IsInOutObsoleted = true ; <nl> - <nl> - LocalJunk . push_back ( * InOut ) ; <nl> + Backtracking . emplace ( * this ) ; <nl> + ObsoletedInOutLoc = consumeToken ( tok : : kw_inout ) ; <nl> } <nl> - <nl> + <nl> / / If the label is " some " , this could end up being an opaque type <nl> / / description if there ' s ` some < identifier > ` without a following colon , <nl> / / so we may need to backtrack as well . <nl> Parser : : TypeResult Parser : : parseTypeTupleBody ( ) { <nl> / / If the tuple element starts with a potential argument label followed by a <nl> / / ' : ' or another potential argument label , then the identifier is an <nl> / / element tag , and it is followed by a type annotation . <nl> - Optional < ParsedTokenSyntax > Name ; <nl> - Optional < ParsedTokenSyntax > SecondName ; <nl> - Optional < ParsedTokenSyntax > Colon ; <nl> - SourceLoc NameLoc ; <nl> - SourceLoc SecondNameLoc ; <nl> - if ( Tok . canBeArgumentLabel ( ) & & <nl> - ( peekToken ( ) . is ( tok : : colon ) | | peekToken ( ) . canBeArgumentLabel ( ) ) ) { <nl> + if ( Tok . canBeArgumentLabel ( ) <nl> + & & ( peekToken ( ) . is ( tok : : colon ) <nl> + | | peekToken ( ) . canBeArgumentLabel ( ) ) ) { <nl> / / Consume a name . <nl> - NameLoc = Tok . getLoc ( ) ; <nl> - Name = consumeArgumentLabelSyntax ( ) ; <nl> + element . NameLoc = consumeArgumentLabel ( element . Name ) ; <nl> <nl> / / If there is a second name , consume it as well . <nl> - if ( Tok . canBeArgumentLabel ( ) ) { <nl> - SecondNameLoc = Tok . getLoc ( ) ; <nl> - SecondName = consumeArgumentLabelSyntax ( ) ; <nl> - } <nl> + if ( Tok . canBeArgumentLabel ( ) ) <nl> + element . SecondNameLoc = consumeArgumentLabel ( element . SecondName ) ; <nl> <nl> / / Consume the ' : ' . <nl> - if ( ( Colon = consumeTokenSyntaxIf ( tok : : colon ) ) ) { <nl> + if ( consumeIf ( tok : : colon , element . ColonLoc ) ) { <nl> / / If we succeed , then we successfully parsed a label . <nl> if ( Backtracking ) <nl> Backtracking - > cancelBacktrack ( ) ; <nl> - / / Otherwise , if we can ' t backtrack to parse this as a type , <nl> - / / this is a syntax error . <nl> + / / Otherwise , if we can ' t backtrack to parse this as a type , <nl> + / / this is a syntax error . <nl> } else { <nl> - if ( ! Backtracking ) <nl> + if ( ! Backtracking ) { <nl> diagnose ( Tok , diag : : expected_parameter_colon ) ; <nl> - Name = None ; <nl> - SecondName = None ; <nl> - NameLoc = SourceLoc ( ) ; <nl> - SecondNameLoc = SourceLoc ( ) ; <nl> + } <nl> + element . NameLoc = SourceLoc ( ) ; <nl> + element . SecondNameLoc = SourceLoc ( ) ; <nl> } <nl> - } else if ( InOut ) { <nl> + <nl> + } else if ( Backtracking ) { <nl> / / If we don ' t have labels , ' inout ' is not a obsoleted use . <nl> - IsInOutObsoleted = false ; <nl> + ObsoletedInOutLoc = SourceLoc ( ) ; <nl> } <nl> - <nl> Backtracking . reset ( ) ; <nl> <nl> - if ( Name ) <nl> - LocalJunk . push_back ( * Name ) ; <nl> - if ( SecondName ) <nl> - LocalJunk . push_back ( * SecondName ) ; <nl> - if ( Colon ) <nl> - LocalJunk . push_back ( * Colon ) ; <nl> - <nl> / / Parse the type annotation . <nl> - auto TypeLoc = Tok . getLoc ( ) ; <nl> - auto TypeASTResult = parseType ( diag : : expected_type ) ; <nl> - if ( TypeASTResult . hasCodeCompletion ( ) | | TypeASTResult . isNull ( ) ) { <nl> - skipListUntilDeclRBraceSyntax ( Junk , LParenLoc , tok : : r_paren , tok : : comma ) ; <nl> - for ( auto & & Item : LocalJunk ) <nl> - Junk . push_back ( Item ) ; <nl> - return TypeASTResult . hasCodeCompletion ( ) <nl> - ? makeParserCodeCompletionStatus ( ) <nl> - : makeParserError ( ) ; <nl> - } <nl> - <nl> - auto Type = * SyntaxContext - > popIf < ParsedTypeSyntax > ( ) ; <nl> - <nl> - if ( IsInOutObsoleted ) { <nl> - bool IsTypeAlreadyAttributed = false ; <nl> - if ( auto AttributedType = Type . getAs < ParsedAttributedTypeSyntax > ( ) ) <nl> - IsTypeAlreadyAttributed = AttributedType - > getDeferredSpecifier ( ) . hasValue ( ) ; <nl> + auto type = parseType ( diag : : expected_type ) ; <nl> + if ( type . hasCodeCompletion ( ) ) <nl> + return makeParserCodeCompletionStatus ( ) ; <nl> + if ( type . isNull ( ) ) <nl> + return makeParserError ( ) ; <nl> + element . Type = type . get ( ) ; <nl> <nl> - if ( IsTypeAlreadyAttributed ) { <nl> - / / If the parsed type is already attributed , suggest removing ` inout ` . <nl> + / / Complain obsoleted ' inout ' etc . position ; ( inout name : Ty ) <nl> + if ( ObsoletedInOutLoc . isValid ( ) ) { <nl> + if ( isa < SpecifierTypeRepr > ( element . Type ) ) { <nl> + / / If the parsed type is already a inout type et al , just remove it . <nl> diagnose ( Tok , diag : : parameter_specifier_repeated ) <nl> - . fixItRemove ( InOutLoc ) ; <nl> + . fixItRemove ( ObsoletedInOutLoc ) ; <nl> } else { <nl> - diagnose ( InOutLoc , diag : : parameter_specifier_as_attr_disallowed , " inout " ) <nl> - . fixItRemove ( InOutLoc ) <nl> - . fixItInsert ( TypeLoc , " inout " ) ; <nl> + diagnose ( ObsoletedInOutLoc , <nl> + diag : : parameter_specifier_as_attr_disallowed , " inout " ) <nl> + . fixItRemove ( ObsoletedInOutLoc ) <nl> + . fixItInsert ( element . Type - > getStartLoc ( ) , " inout " ) ; <nl> + / / Build inout type . Note that we bury the inout locator within the <nl> + / / named locator . This is weird but required by Sema apparently . <nl> + element . Type = <nl> + new ( Context ) InOutTypeRepr ( element . Type , ObsoletedInOutLoc ) ; <nl> } <nl> } <nl> <nl> - Optional < ParsedTokenSyntax > ElementEllipsis ; <nl> + / / Parse optional ' . . . ' . <nl> if ( Tok . isEllipsis ( ) ) { <nl> Tok . setKind ( tok : : ellipsis ) ; <nl> - auto ElementEllipsisLoc = Tok . getLoc ( ) ; <nl> - ElementEllipsis = consumeTokenSyntax ( ) ; <nl> - if ( ! FirstEllipsis ) { <nl> - FirstEllipsis = ElementEllipsis ; <nl> - FirstEllipsisLoc = ElementEllipsisLoc ; <nl> + auto ElementEllipsisLoc = consumeToken ( ) ; <nl> + if ( EllipsisLoc . isInvalid ( ) ) { <nl> + EllipsisLoc = ElementEllipsisLoc ; <nl> + EllipsisIdx = ElementsR . size ( ) ; <nl> } else { <nl> diagnose ( ElementEllipsisLoc , diag : : multiple_ellipsis_in_tuple ) <nl> - . highlight ( FirstEllipsisLoc ) <nl> - . fixItRemove ( ElementEllipsisLoc ) ; <nl> + . highlight ( EllipsisLoc ) <nl> + . fixItRemove ( ElementEllipsisLoc ) ; <nl> } <nl> } <nl> <nl> - Optional < ParsedTokenSyntax > Equal ; <nl> - Optional < ParsedInitializerClauseSyntax > Initializer ; <nl> + / / Parse ' = expr ' here so we can complain about it directly , rather <nl> + / / than dying when we see it . <nl> if ( Tok . is ( tok : : equal ) ) { <nl> - auto EqualLoc = Tok . getLoc ( ) ; <nl> - Equal = consumeTokenSyntax ( tok : : equal ) ; <nl> - auto Init = parseExpr ( diag : : expected_init_value ) ; <nl> - auto InFlight = diagnose ( EqualLoc , diag : : tuple_type_init ) ; <nl> - if ( Init . isNonNull ( ) ) <nl> - InFlight . fixItRemove ( SourceRange ( EqualLoc , Init . get ( ) - > getEndLoc ( ) ) ) ; <nl> - auto Expr = * SyntaxContext - > popIf < ParsedExprSyntax > ( ) ; <nl> - Initializer = ParsedSyntaxRecorder : : makeInitializerClause ( * Equal , Expr , <nl> - * SyntaxContext ) ; <nl> + SyntaxParsingContext InitContext ( SyntaxContext , <nl> + SyntaxKind : : InitializerClause ) ; <nl> + SourceLoc equalLoc = consumeToken ( tok : : equal ) ; <nl> + auto init = parseExpr ( diag : : expected_init_value ) ; <nl> + auto inFlight = diagnose ( equalLoc , diag : : tuple_type_init ) ; <nl> + if ( init . isNonNull ( ) ) <nl> + inFlight . fixItRemove ( SourceRange ( equalLoc , init . get ( ) - > getEndLoc ( ) ) ) ; <nl> } <nl> <nl> - Comma = consumeTokenSyntaxIf ( tok : : comma ) ; <nl> - <nl> - auto Element = ParsedSyntaxRecorder : : makeTupleTypeElement ( <nl> - InOut , Name , SecondName , Colon , Type , ElementEllipsis , Initializer , <nl> - Comma , * SyntaxContext ) ; <nl> - <nl> - Junk . push_back ( Element ) ; <nl> - <nl> - Elements . push_back ( Element ) ; <nl> - ElementsLoc . emplace_back ( NameLoc , SecondNameLoc , TypeLoc ) ; <nl> + / / Record the ' , ' location . <nl> + if ( Tok . is ( tok : : comma ) ) <nl> + element . TrailingCommaLoc = Tok . getLoc ( ) ; <nl> <nl> + ElementsR . push_back ( element ) ; <nl> return makeParserSuccess ( ) ; <nl> } ) ; <nl> <nl> - if ( ! Status . isSuccess ( ) ) <nl> - return makeParsedResult < ParsedTupleTypeSyntax > ( Junk , Status ) ; <nl> - <nl> - auto ElementList = <nl> - ParsedSyntaxRecorder : : makeTupleTypeElementList ( Elements , * SyntaxContext ) ; <nl> - <nl> - auto TupleType = ParsedSyntaxRecorder : : makeTupleType ( LParen , ElementList , <nl> - * RParen , * SyntaxContext ) ; <nl> - <nl> - bool IsFunctionType = Tok . isAny ( tok : : arrow , tok : : kw_throws , tok : : kw_rethrows ) ; <nl> + if ( EllipsisLoc . isInvalid ( ) ) <nl> + EllipsisIdx = ElementsR . size ( ) ; <nl> <nl> - auto GetNameText = [ this ] ( Optional < ParsedTokenSyntax > Name ) { <nl> - return ! Name ? StringRef ( ) <nl> - : SourceMgr . extractText ( <nl> - Name - > getRaw ( ) . getDeferredTokenRangeWithoutBackticks ( ) , <nl> - L - > getBufferID ( ) ) ; <nl> - } ; <nl> + bool isFunctionType = Tok . isAny ( tok : : arrow , tok : : kw_throws , <nl> + tok : : kw_rethrows ) ; <nl> <nl> - if ( ! IsFunctionType ) { <nl> - for ( unsigned i = 0 ; i < Elements . size ( ) ; i + + ) { <nl> - / / true tuples have labels <nl> - auto Element = Elements [ i ] ; <nl> - SourceLoc NameLoc , SecondNameLoc , TypeLoc ; <nl> - std : : tie ( NameLoc , SecondNameLoc , TypeLoc ) = ElementsLoc [ i ] ; <nl> + / / If there were any labels , figure out which labels should go into the type <nl> + / / representation . <nl> + for ( auto & element : ElementsR ) { <nl> + / / True tuples have labels . <nl> + if ( ! isFunctionType ) { <nl> / / If there were two names , complain . <nl> - if ( NameLoc . isValid ( ) & & SecondNameLoc . isValid ( ) ) { <nl> - auto Diag = diagnose ( NameLoc , diag : : tuple_type_multiple_labels ) ; <nl> - auto Name = Element . getDeferredName ( ) ; <nl> - auto NameText = SourceMgr . extractText ( <nl> - Name - > getRaw ( ) . getDeferredTokenRangeWithoutBackticks ( ) , <nl> - L - > getBufferID ( ) ) ; <nl> - if ( NameText = = " _ " ) { <nl> - Diag . fixItRemoveChars ( NameLoc , TypeLoc ) ; <nl> + if ( element . NameLoc . isValid ( ) & & element . SecondNameLoc . isValid ( ) ) { <nl> + auto diag = diagnose ( element . NameLoc , diag : : tuple_type_multiple_labels ) ; <nl> + if ( element . Name . empty ( ) ) { <nl> + diag . fixItRemoveChars ( element . NameLoc , <nl> + element . Type - > getStartLoc ( ) ) ; <nl> } else { <nl> - Diag . fixItRemove ( SourceRange ( <nl> - Lexer : : getLocForEndOfToken ( SourceMgr , NameLoc ) , SecondNameLoc ) ) ; <nl> + diag . fixItRemove ( <nl> + SourceRange ( Lexer : : getLocForEndOfToken ( SourceMgr , element . NameLoc ) , <nl> + element . SecondNameLoc ) ) ; <nl> } <nl> } <nl> + continue ; <nl> } <nl> - } else { <nl> - for ( unsigned i = 0 ; i < Elements . size ( ) ; i + + ) { <nl> - / / If there was a first name , complain ; arguments in function types are <nl> - / / always unlabeled . <nl> - auto Element = Elements [ i ] ; <nl> - SourceLoc NameLoc , SecondNameLoc , TypeLoc ; <nl> - std : : tie ( NameLoc , SecondNameLoc , TypeLoc ) = ElementsLoc [ i ] ; <nl> - if ( NameLoc . isValid ( ) ) { <nl> - auto NameText = GetNameText ( Element . getDeferredName ( ) ) ; <nl> - if ( NameText ! = " _ " ) { <nl> - auto NameIdentifier = Context . getIdentifier ( NameText ) ; <nl> - auto Diag = diagnose ( NameLoc , diag : : function_type_argument_label , <nl> - NameIdentifier ) ; <nl> - auto SecondNameText = GetNameText ( Element . getDeferredSecondName ( ) ) ; <nl> - if ( SecondNameLoc . isInvalid ( ) ) <nl> - Diag . fixItInsert ( NameLoc , " _ " ) ; <nl> - else if ( SecondNameText = = " _ " ) <nl> - Diag . fixItRemoveChars ( NameLoc , TypeLoc ) ; <nl> - else <nl> - Diag . fixItReplace ( SourceRange ( NameLoc ) , " _ " ) ; <nl> - } <nl> - } <nl> + <nl> + / / If there was a first name , complain ; arguments in function types are <nl> + / / always unlabeled . <nl> + if ( element . NameLoc . isValid ( ) & & ! element . Name . empty ( ) ) { <nl> + auto diag = diagnose ( element . NameLoc , diag : : function_type_argument_label , <nl> + element . Name ) ; <nl> + if ( element . SecondNameLoc . isInvalid ( ) ) <nl> + diag . fixItInsert ( element . NameLoc , " _ " ) ; <nl> + else if ( element . SecondName . empty ( ) ) <nl> + diag . fixItRemoveChars ( element . NameLoc , <nl> + element . Type - > getStartLoc ( ) ) ; <nl> + else <nl> + diag . fixItReplace ( SourceRange ( element . NameLoc ) , " _ " ) ; <nl> + } <nl> + <nl> + if ( element . SecondNameLoc . isValid ( ) ) { <nl> + / / Form the named parameter type representation . <nl> + element . UnderscoreLoc = element . NameLoc ; <nl> + element . Name = element . SecondName ; <nl> + element . NameLoc = element . SecondNameLoc ; <nl> } <nl> } <nl> <nl> - return makeParsedSuccess ( TupleType ) ; <nl> + return makeParserResult ( Status , <nl> + TupleTypeRepr : : create ( Context , ElementsR , <nl> + SourceRange ( LPLoc , RPLoc ) , <nl> + EllipsisLoc , EllipsisIdx ) ) ; <nl> } <nl> <nl> + <nl> / / / parseTypeArray - Parse the type - array production , given that we <nl> / / / are looking at the initial l_square . Note that this index <nl> / / / clause is actually the outermost ( first - indexed ) clause . <nl> Parser : : TypeResult Parser : : parseTypeTupleBody ( ) { <nl> / / / type - array ' [ ' ' ] ' <nl> / / / type - array ' [ ' expr ' ] ' <nl> / / / <nl> - Parser : : TypeErrorResult Parser : : parseTypeArray ( ParsedTypeSyntax Base , <nl> - SourceLoc BaseLoc ) { <nl> + ParserResult < TypeRepr > Parser : : parseTypeArray ( TypeRepr * Base ) { <nl> assert ( Tok . isFollowingLSquare ( ) ) ; <nl> Parser : : StructureMarkerRAII ParsingArrayBound ( * this , Tok ) ; <nl> - SmallVector < ParsedSyntax , 0 > Junk { Base } ; <nl> - auto LSquareLoc = Tok . getLoc ( ) ; <nl> - auto LSquare = consumeTokenSyntax ( ) ; <nl> - Junk . push_back ( LSquare ) ; <nl> + SourceLoc lsquareLoc = consumeToken ( ) ; <nl> + ArrayTypeRepr * ATR = nullptr ; <nl> + <nl> + / / Handle a postfix [ ] production , a common typo for a C - like array . <nl> <nl> + / / If we have something that might be an array size expression , parse it as <nl> + / / such , for better error recovery . <nl> if ( Tok . isNot ( tok : : r_square ) ) { <nl> - auto SizeExprAST = parseExprBasic ( diag : : expected_expr ) ; <nl> - if ( SizeExprAST . hasCodeCompletion ( ) ) <nl> - return makeParsedCodeCompletion < ParsedUnknownTypeSyntax > ( Junk ) ; <nl> - if ( SizeExprAST . isNull ( ) ) <nl> - return makeParsedError < ParsedUnknownTypeSyntax > ( Junk ) ; <nl> - if ( auto ParsedSizeExpr = SyntaxContext - > popIf < ParsedExprSyntax > ( ) ) <nl> - Junk . push_back ( * ParsedSizeExpr ) ; <nl> - } <nl> - <nl> - auto RSquare = parseMatchingTokenSyntax ( <nl> - tok : : r_square , diag : : expected_rbracket_array_type , LSquareLoc ) ; <nl> - <nl> - if ( RSquare ) { <nl> - Junk . push_back ( * RSquare ) ; <nl> - / / If we parsed something valid , diagnose it with a fixit to rewrite it to <nl> - / / Swift syntax . <nl> - diagnose ( LSquareLoc , diag : : new_array_syntax ) <nl> - . fixItInsert ( BaseLoc , " [ " ) <nl> - . fixItRemove ( LSquareLoc ) ; <nl> + auto sizeEx = parseExprBasic ( diag : : expected_expr ) ; <nl> + if ( sizeEx . hasCodeCompletion ( ) ) <nl> + return makeParserCodeCompletionStatus ( ) ; <nl> + if ( sizeEx . isNull ( ) ) <nl> + return makeParserErrorResult ( Base ) ; <nl> } <nl> - <nl> - auto Unknown = ParsedSyntaxRecorder : : makeUnknownType ( Junk , * SyntaxContext ) ; <nl> - return makeParsedSuccess ( Unknown ) ; <nl> + <nl> + SourceLoc rsquareLoc ; <nl> + if ( parseMatchingToken ( tok : : r_square , rsquareLoc , <nl> + diag : : expected_rbracket_array_type , lsquareLoc ) ) <nl> + return makeParserErrorResult ( Base ) ; <nl> + <nl> + / / If we parsed something valid , diagnose it with a fixit to rewrite it to <nl> + / / Swift syntax . <nl> + diagnose ( lsquareLoc , diag : : new_array_syntax ) <nl> + . fixItInsert ( Base - > getStartLoc ( ) , " [ " ) <nl> + . fixItRemove ( lsquareLoc ) ; <nl> + <nl> + / / Build a normal array slice type for recovery . <nl> + ATR = new ( Context ) ArrayTypeRepr ( Base , <nl> + SourceRange ( Base - > getStartLoc ( ) , rsquareLoc ) ) ; <nl> + return makeParserResult ( ATR ) ; <nl> } <nl> <nl> - / / / Parse a collection type . <nl> - / / / type - simple : <nl> - / / / ' [ ' type ' ] ' <nl> - / / / ' [ ' type ' : ' type ' ] ' <nl> - Parser : : TypeResult Parser : : parseTypeCollection ( ) { <nl> + SyntaxParserResult < ParsedTypeSyntax , TypeRepr > Parser : : parseTypeCollection ( ) { <nl> ParserStatus Status ; <nl> + / / Parse the leading ' [ ' . <nl> assert ( Tok . is ( tok : : l_square ) ) ; <nl> Parser : : StructureMarkerRAII parsingCollection ( * this , Tok ) ; <nl> - auto LSquareLoc = Tok . getLoc ( ) ; <nl> - auto LSquare = consumeTokenSyntax ( tok : : l_square ) ; <nl> - <nl> - auto ElementTypeASTResult = parseType ( diag : : expected_element_type ) ; <nl> - auto ElementType = SyntaxContext - > popIf < ParsedTypeSyntax > ( ) ; <nl> - Status | = ElementTypeASTResult ; <nl> + SourceLoc lsquareLoc = consumeToken ( ) ; <nl> <nl> - Optional < ParsedTokenSyntax > Colon ; <nl> - ParserResult < TypeRepr > ValueTypeASTResult ; <nl> - Optional < ParsedTypeSyntax > ValueType ; <nl> + / / Parse the element type . <nl> + ParserResult < TypeRepr > firstTy = parseType ( diag : : expected_element_type ) ; <nl> + Status | = firstTy ; <nl> <nl> + / / If there is a ' : ' , this is a dictionary type . <nl> + SourceLoc colonLoc ; <nl> + ParserResult < TypeRepr > secondTy ; <nl> if ( Tok . is ( tok : : colon ) ) { <nl> - Colon = consumeTokenSyntax ( tok : : colon ) ; <nl> - ValueTypeASTResult = parseType ( diag : : expected_dictionary_value_type ) ; <nl> - ValueType = SyntaxContext - > popIf < ParsedTypeSyntax > ( ) ; <nl> - Status | = ValueTypeASTResult ; <nl> + colonLoc = consumeToken ( ) ; <nl> + <nl> + / / Parse the second type . <nl> + secondTy = parseType ( diag : : expected_dictionary_value_type ) ; <nl> + Status | = secondTy ; <nl> } <nl> <nl> - auto Diag = Colon ? diag : : expected_rbracket_dictionary_type <nl> - : diag : : expected_rbracket_array_type ; <nl> - auto RSquare = parseMatchingTokenSyntax ( tok : : r_square , Diag , LSquareLoc ) ; <nl> - if ( ! RSquare ) <nl> + / / Parse the closing ' ] ' . <nl> + SourceLoc rsquareLoc ; <nl> + if ( parseMatchingToken ( tok : : r_square , rsquareLoc , <nl> + colonLoc . isValid ( ) <nl> + ? diag : : expected_rbracket_dictionary_type <nl> + : diag : : expected_rbracket_array_type , <nl> + lsquareLoc ) ) <nl> Status . setIsParseError ( ) ; <nl> <nl> - if ( ! Status . isSuccess ( ) ) { <nl> - SmallVector < ParsedSyntax , 0 > Pieces ; <nl> - Pieces . push_back ( LSquare ) ; <nl> - if ( ElementType ) <nl> - Pieces . push_back ( * ElementType ) ; <nl> - if ( Colon ) <nl> - Pieces . push_back ( * Colon ) ; <nl> - if ( ValueType ) <nl> - Pieces . push_back ( * ValueType ) ; <nl> - if ( RSquare ) <nl> - Pieces . push_back ( * RSquare ) ; <nl> - <nl> - return makeParsedResult < ParsedTypeSyntax > ( Pieces , Status ) ; <nl> - } <nl> + if ( Status . hasCodeCompletion ( ) ) <nl> + return Status ; <nl> <nl> - if ( Colon ) <nl> - return makeParsedSuccess ( ParsedSyntaxRecorder : : makeDictionaryType ( <nl> - LSquare , * ElementType , * Colon , * ValueType , * RSquare , * SyntaxContext ) ) ; <nl> - <nl> - return makeParsedSuccess ( ParsedSyntaxRecorder : : makeArrayType ( <nl> - LSquare , * ElementType , * RSquare , * SyntaxContext ) ) ; <nl> - } <nl> + / / If we couldn ' t parse anything for one of the types , propagate the error . <nl> + if ( Status . isError ( ) ) <nl> + return makeParserError ( ) ; <nl> <nl> - Parser : : TypeResult Parser : : parseMetatypeType ( ParsedTypeSyntax Base ) { <nl> - auto Period = consumeTokenSyntax ( ) ; / / tok : : period or tok : : period_prefix <nl> - auto Keyword = consumeTokenSyntax ( tok : : identifier ) ; / / " Type " or " Protocol " <nl> - auto MetatypeType = ParsedSyntaxRecorder : : makeMetatypeType ( <nl> - Base , Period , Keyword , * SyntaxContext ) ; <nl> - return makeParsedSuccess ( MetatypeType ) ; <nl> + TypeRepr * TyR ; <nl> + llvm : : Optional < ParsedTypeSyntax > SyntaxNode ; <nl> + <nl> + SourceRange brackets ( lsquareLoc , rsquareLoc ) ; <nl> + if ( colonLoc . isValid ( ) ) { <nl> + / / Form the dictionary type . <nl> + TyR = new ( Context ) <nl> + DictionaryTypeRepr ( firstTy . get ( ) , secondTy . get ( ) , colonLoc , brackets ) ; <nl> + ParsedDictionaryTypeSyntaxBuilder Builder ( * SyntaxContext ) ; <nl> + auto RightSquareBracket = SyntaxContext - > popToken ( ) ; <nl> + auto ValueType = SyntaxContext - > popIf < ParsedTypeSyntax > ( ) . getValue ( ) ; <nl> + auto Colon = SyntaxContext - > popToken ( ) ; <nl> + auto KeyType = SyntaxContext - > popIf < ParsedTypeSyntax > ( ) . getValue ( ) ; <nl> + auto LeftSquareBracket = SyntaxContext - > popToken ( ) ; <nl> + Builder <nl> + . useRightSquareBracket ( RightSquareBracket ) <nl> + . useValueType ( ValueType ) <nl> + . useColon ( Colon ) <nl> + . useKeyType ( KeyType ) <nl> + . useLeftSquareBracket ( LeftSquareBracket ) ; <nl> + SyntaxNode . emplace ( Builder . build ( ) ) ; <nl> + } else { <nl> + / / Form the array type . <nl> + TyR = new ( Context ) ArrayTypeRepr ( firstTy . get ( ) , brackets ) ; <nl> + ParsedArrayTypeSyntaxBuilder Builder ( * SyntaxContext ) ; <nl> + auto RightSquareBracket = SyntaxContext - > popToken ( ) ; <nl> + auto ElementType = SyntaxContext - > popIf < ParsedTypeSyntax > ( ) . getValue ( ) ; <nl> + auto LeftSquareBracket = SyntaxContext - > popToken ( ) ; <nl> + Builder <nl> + . useRightSquareBracket ( RightSquareBracket ) <nl> + . useElementType ( ElementType ) <nl> + . useLeftSquareBracket ( LeftSquareBracket ) ; <nl> + SyntaxNode . emplace ( Builder . build ( ) ) ; <nl> + } <nl> + <nl> + return makeSyntaxResult ( Status , SyntaxNode , TyR ) ; <nl> } <nl> <nl> bool Parser : : isOptionalToken ( const Token & T ) const { <nl> bool Parser : : isImplicitlyUnwrappedOptionalToken ( const Token & T ) const { <nl> return false ; <nl> } <nl> <nl> - ParsedTokenSyntax Parser : : consumeOptionalTokenSyntax ( ) { <nl> - assert ( isOptionalToken ( Tok ) & & " not a ' ? ' token ? ! " ) ; <nl> - return consumeStartingCharacterOfCurrentTokenSyntax ( tok : : question_postfix , 1 ) ; <nl> - } <nl> - <nl> SourceLoc Parser : : consumeOptionalToken ( ) { <nl> assert ( isOptionalToken ( Tok ) & & " not a ' ? ' token ? ! " ) ; <nl> return consumeStartingCharacterOfCurrentToken ( tok : : question_postfix ) ; <nl> } <nl> <nl> - ParsedTokenSyntax Parser : : consumeImplicitlyUnwrappedOptionalTokenSyntax ( ) { <nl> - assert ( isImplicitlyUnwrappedOptionalToken ( Tok ) & & " not a ' ! ' token ? ! " ) ; <nl> - / / If the text of the token is just ' ! ' , grab the next token . <nl> - return consumeStartingCharacterOfCurrentTokenSyntax ( tok : : exclaim_postfix , 1 ) ; <nl> - } <nl> - <nl> SourceLoc Parser : : consumeImplicitlyUnwrappedOptionalToken ( ) { <nl> assert ( isImplicitlyUnwrappedOptionalToken ( Tok ) & & " not a ' ! ' token ? ! " ) ; <nl> / / If the text of the token is just ' ! ' , grab the next token . <nl> return consumeStartingCharacterOfCurrentToken ( tok : : exclaim_postfix ) ; <nl> } <nl> <nl> - Parser : : TypeResult Parser : : parseOptionalType ( ParsedTypeSyntax Base ) { <nl> - auto Question = consumeOptionalTokenSyntax ( ) ; <nl> - auto Optional = <nl> - ParsedSyntaxRecorder : : makeOptionalType ( Base , Question , * SyntaxContext ) ; <nl> - return makeParsedSuccess ( Optional ) ; <nl> + / / / Parse a single optional suffix , given that we are looking at the <nl> + / / / question mark . <nl> + SyntaxParserResult < ParsedTypeSyntax , OptionalTypeRepr > <nl> + Parser : : parseTypeOptional ( TypeRepr * base ) { <nl> + SourceLoc questionLoc = consumeOptionalToken ( ) ; <nl> + auto TyR = new ( Context ) OptionalTypeRepr ( base , questionLoc ) ; <nl> + llvm : : Optional < ParsedTypeSyntax > SyntaxNode ; <nl> + auto QuestionMark = SyntaxContext - > popToken ( ) ; <nl> + if ( auto WrappedType = SyntaxContext - > popIf < ParsedTypeSyntax > ( ) ) { <nl> + ParsedOptionalTypeSyntaxBuilder Builder ( * SyntaxContext ) ; <nl> + Builder <nl> + . useQuestionMark ( QuestionMark ) <nl> + . useWrappedType ( WrappedType . getValue ( ) ) ; <nl> + SyntaxNode . emplace ( Builder . build ( ) ) ; <nl> + } else { <nl> + / / Undo the popping of the question mark <nl> + SyntaxContext - > addSyntax ( QuestionMark ) ; <nl> + } <nl> + return makeSyntaxResult ( SyntaxNode , TyR ) ; <nl> } <nl> <nl> - Parser : : TypeResult <nl> - Parser : : parseImplicitlyUnwrappedOptionalType ( ParsedTypeSyntax Base ) { <nl> - auto Exclamation = consumeImplicitlyUnwrappedOptionalTokenSyntax ( ) ; <nl> - auto Unwrapped = ParsedSyntaxRecorder : : makeImplicitlyUnwrappedOptionalType ( <nl> - Base , Exclamation , * SyntaxContext ) ; <nl> - return makeParsedSuccess ( Unwrapped ) ; <nl> + / / / Parse a single implicitly unwrapped optional suffix , given that we <nl> + / / / are looking at the exclamation mark . <nl> + SyntaxParserResult < ParsedTypeSyntax , ImplicitlyUnwrappedOptionalTypeRepr > <nl> + Parser : : parseTypeImplicitlyUnwrappedOptional ( TypeRepr * base ) { <nl> + SourceLoc exclamationLoc = consumeImplicitlyUnwrappedOptionalToken ( ) ; <nl> + auto TyR = <nl> + new ( Context ) ImplicitlyUnwrappedOptionalTypeRepr ( base , exclamationLoc ) ; <nl> + llvm : : Optional < ParsedTypeSyntax > SyntaxNode ; <nl> + ParsedImplicitlyUnwrappedOptionalTypeSyntaxBuilder Builder ( * SyntaxContext ) ; <nl> + auto ExclamationMark = SyntaxContext - > popToken ( ) ; <nl> + auto WrappedType = SyntaxContext - > popIf < ParsedTypeSyntax > ( ) . getValue ( ) ; <nl> + Builder <nl> + . useExclamationMark ( ExclamationMark ) <nl> + . useWrappedType ( WrappedType ) ; <nl> + SyntaxNode . emplace ( Builder . build ( ) ) ; <nl> + return makeSyntaxResult ( SyntaxNode , TyR ) ; <nl> } <nl> <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> bool Parser : : canParseTypeIdentifier ( ) { <nl> } <nl> } <nl> <nl> + <nl> bool Parser : : canParseOldStyleProtocolComposition ( ) { <nl> consumeToken ( tok : : kw_protocol ) ; <nl> <nl> mmm a / lib / Parse / ParsedRawSyntaxRecorder . cpp <nl> ppp b / lib / Parse / ParsedRawSyntaxRecorder . cpp <nl> ParsedRawSyntaxRecorder : : recordRawSyntax ( SyntaxKind kind , <nl> subnodes . push_back ( nullptr ) ; <nl> } else { <nl> subnodes . push_back ( subnode . getOpaqueNode ( ) ) ; <nl> - auto range = subnode . getRecordedRange ( ) ; <nl> + auto range = subnode . getRange ( ) ; <nl> if ( range . isValid ( ) ) { <nl> if ( offset . isInvalid ( ) ) <nl> offset = range . getStart ( ) ; <nl> - length + = subnode . getRecordedRange ( ) . getByteLength ( ) ; <nl> + length + = subnode . getRange ( ) . getByteLength ( ) ; <nl> } <nl> } <nl> } <nl> mmm a / lib / Parse / ParsedSyntaxBuilders . cpp . gyb <nl> ppp b / lib / Parse / ParsedSyntaxBuilders . cpp . gyb <nl> Parsed $ { node . name } Builder : : makeDeferred ( ) { <nl> <nl> Parsed $ { node . name } <nl> Parsed $ { node . name } Builder : : build ( ) { <nl> - if ( SPCtx . shouldDefer ( ) ) <nl> + if ( SPCtx . isBacktracking ( ) ) <nl> return makeDeferred ( ) ; <nl> return record ( ) ; <nl> } <nl> mmm a / lib / Parse / ParsedSyntaxRecorder . cpp . gyb <nl> ppp b / lib / Parse / ParsedSyntaxRecorder . cpp . gyb <nl> ParsedSyntaxRecorder : : defer $ { node . syntax_kind } ( $ { child_params } , SyntaxParsingCon <nl> Parsed $ { node . name } <nl> ParsedSyntaxRecorder : : make $ { node . syntax_kind } ( $ { child_params } , <nl> SyntaxParsingContext & SPCtx ) { <nl> - if ( SPCtx . shouldDefer ( ) ) <nl> + if ( SPCtx . isBacktracking ( ) ) <nl> return defer $ { node . syntax_kind } ( $ { child_move_args } , SPCtx ) ; <nl> return record $ { node . syntax_kind } ( $ { child_move_args } , SPCtx . getRecorder ( ) ) ; <nl> } <nl> Parsed $ { node . name } <nl> ParsedSyntaxRecorder : : make $ { node . syntax_kind } ( <nl> ArrayRef < Parsed $ { node . collection_element_type } > elements , <nl> SyntaxParsingContext & SPCtx ) { <nl> - if ( SPCtx . shouldDefer ( ) ) <nl> + if ( SPCtx . isBacktracking ( ) ) <nl> return defer $ { node . syntax_kind } ( elements , SPCtx ) ; <nl> return record $ { node . syntax_kind } ( elements , SPCtx . getRecorder ( ) ) ; <nl> } <nl> Parsed $ { node . name } <nl> ParsedSyntaxRecorder : : makeBlank $ { node . syntax_kind } ( SourceLoc loc , <nl> SyntaxParsingContext & SPCtx ) { <nl> ParsedRawSyntaxNode raw ; <nl> - if ( SPCtx . shouldDefer ( ) ) { <nl> + if ( SPCtx . isBacktracking ( ) ) { <nl> / / FIXME : ' loc ' is not preserved when capturing a deferred layout . <nl> raw = ParsedRawSyntaxNode : : makeDeferred ( SyntaxKind : : $ { node . syntax_kind } , { } , SPCtx ) ; <nl> } else { <nl> Parsed $ { node . name } <nl> ParsedSyntaxRecorder : : make $ { node . syntax_kind } ( <nl> ArrayRef < ParsedSyntax > elements , <nl> SyntaxParsingContext & SPCtx ) { <nl> - if ( SPCtx . shouldDefer ( ) ) <nl> + if ( SPCtx . isBacktracking ( ) ) <nl> return defer $ { node . syntax_kind } ( elements , SPCtx ) ; <nl> return record $ { node . syntax_kind } ( elements , SPCtx . getRecorder ( ) ) ; <nl> } <nl> ParsedSyntaxRecorder : : makeToken ( const Token & Tok , <nl> const ParsedTrivia & TrailingTrivia , <nl> SyntaxParsingContext & SPCtx ) { <nl> ParsedRawSyntaxNode raw ; <nl> - if ( SPCtx . shouldDefer ( ) ) { <nl> + if ( SPCtx . isBacktracking ( ) ) { <nl> raw = ParsedRawSyntaxNode : : makeDeferred ( Tok , LeadingTrivia , TrailingTrivia , SPCtx ) ; <nl> } else { <nl> raw = SPCtx . getRecorder ( ) . recordToken ( Tok , LeadingTrivia , TrailingTrivia ) ; <nl> mmm a / lib / Parse / Parser . cpp <nl> ppp b / lib / Parse / Parser . cpp <nl> Parser : : Parser ( unsigned BufferID , SourceFile & SF , DiagnosticEngine * LexerDiags , <nl> SF . getASTContext ( ) . LangOpts . AttachCommentsToDecls <nl> ? CommentRetentionMode : : AttachToNextToken <nl> : CommentRetentionMode : : None , <nl> - TriviaRetentionMode : : WithTrivia ) ) , <nl> + SF . shouldBuildSyntaxTree ( ) <nl> + ? TriviaRetentionMode : : WithTrivia <nl> + : TriviaRetentionMode : : WithoutTrivia ) ) , <nl> SF , SIL , PersistentState , std : : move ( SPActions ) , DelayBodyParsing ) { } <nl> <nl> namespace { <nl> Parser : : Parser ( std : : unique_ptr < Lexer > Lex , SourceFile & SF , <nl> L - > getBufferID ( ) , <nl> SF . SyntaxParsingCache , <nl> SF . getASTContext ( ) . getSyntaxArena ( ) ) ) ) ) , <nl> - Generator ( SF . getASTContext ( ) , & State ) { <nl> + Generator ( SF . getASTContext ( ) ) { <nl> State = PersistentState ; <nl> if ( ! State ) { <nl> OwnedState . reset ( new PersistentParserState ( Context ) ) ; <nl> ParsedTokenSyntax Parser : : consumeTokenSyntax ( ) { <nl> TokReceiver - > receive ( Tok ) ; <nl> ParsedTokenSyntax ParsedToken = ParsedSyntaxRecorder : : makeToken ( <nl> Tok , LeadingTrivia , TrailingTrivia , * SyntaxContext ) ; <nl> + <nl> + / / todo [ gsoc ] : remove when possible <nl> + / / todo [ gsoc ] : handle backtracking properly <nl> + Generator . pushLoc ( Tok . getLoc ( ) ) ; <nl> + <nl> consumeTokenWithoutFeedingReceiver ( ) ; <nl> return ParsedToken ; <nl> } <nl> SourceLoc Parser : : getEndOfPreviousLoc ( ) const { <nl> return Lexer : : getLocForEndOfToken ( SourceMgr , PreviousLoc ) ; <nl> } <nl> <nl> - ParsedTokenSyntax <nl> - Parser : : consumeStartingCharacterOfCurrentTokenSyntax ( tok Kind , size_t Len ) { <nl> - / / Consumes prefix of token and returns its location . <nl> - / / ( like ' ? ' , ' < ' , ' > ' or ' ! ' immediately followed by ' < ' ) <nl> - assert ( Len > = 1 ) ; <nl> - <nl> - / / Current token can be either one - character token we want to consume . . . <nl> - if ( Tok . getLength ( ) = = Len ) { <nl> - Tok . setKind ( Kind ) ; <nl> - return consumeTokenSyntax ( ) ; <nl> - } <nl> - <nl> - auto Loc = Tok . getLoc ( ) ; <nl> - <nl> - / / . . . or a multi - character token with the first N characters being the one <nl> - / / that we want to consume as a separate token . <nl> - assert ( Tok . getLength ( ) > Len ) ; <nl> - auto Token = markSplitTokenSyntax ( Kind , Tok . getText ( ) . substr ( 0 , Len ) ) ; <nl> - <nl> - auto NewState = L - > getStateForBeginningOfTokenLoc ( Loc . getAdvancedLoc ( Len ) ) ; <nl> - restoreParserPosition ( ParserPosition ( NewState , Loc ) , <nl> - / * enableDiagnostics = * / true ) ; <nl> - return Token ; <nl> - } <nl> - <nl> SourceLoc Parser : : consumeStartingCharacterOfCurrentToken ( tok Kind , size_t Len ) { <nl> / / Consumes prefix of token and returns its location . <nl> / / ( like ' ? ' , ' < ' , ' > ' or ' ! ' immediately followed by ' < ' ) <nl> SourceLoc Parser : : consumeStartingCharacterOfCurrentToken ( tok Kind , size_t Len ) { <nl> return PreviousLoc ; <nl> } <nl> <nl> - ParsedTokenSyntax Parser : : markSplitTokenSyntax ( tok Kind , StringRef Txt ) { <nl> - SplitTokens . emplace_back ( ) ; <nl> - SplitTokens . back ( ) . setToken ( Kind , Txt ) ; <nl> - TokReceiver - > receive ( SplitTokens . back ( ) ) ; <nl> - return ParsedSyntaxRecorder : : makeToken ( SplitTokens . back ( ) , LeadingTrivia , <nl> - ParsedTrivia ( ) , * SyntaxContext ) ; <nl> - } <nl> - <nl> void Parser : : markSplitToken ( tok Kind , StringRef Txt ) { <nl> SplitTokens . emplace_back ( ) ; <nl> SplitTokens . back ( ) . setToken ( Kind , Txt ) ; <nl> void Parser : : markSplitToken ( tok Kind , StringRef Txt ) { <nl> TokReceiver - > receive ( SplitTokens . back ( ) ) ; <nl> } <nl> <nl> - ParsedTokenSyntax Parser : : consumeStartingLessSyntax ( ) { <nl> - assert ( startsWithLess ( Tok ) & & " Token does not start with ' < ' " ) ; <nl> - return consumeStartingCharacterOfCurrentTokenSyntax ( tok : : l_angle ) ; <nl> - } <nl> - <nl> SourceLoc Parser : : consumeStartingLess ( ) { <nl> assert ( startsWithLess ( Tok ) & & " Token does not start with ' < ' " ) ; <nl> return consumeStartingCharacterOfCurrentToken ( tok : : l_angle ) ; <nl> } <nl> <nl> - ParsedTokenSyntax Parser : : consumeStartingGreaterSyntax ( ) { <nl> - assert ( startsWithGreater ( Tok ) & & " Token does not start with ' > ' " ) ; <nl> - return consumeStartingCharacterOfCurrentTokenSyntax ( tok : : r_angle ) ; <nl> - } <nl> - <nl> SourceLoc Parser : : consumeStartingGreater ( ) { <nl> assert ( startsWithGreater ( Tok ) & & " Token does not start with ' > ' " ) ; <nl> return consumeStartingCharacterOfCurrentToken ( tok : : r_angle ) ; <nl> } <nl> <nl> - void Parser : : skipSingleSyntax ( SmallVectorImpl < ParsedSyntax > & Skipped ) { <nl> - switch ( Tok . getKind ( ) ) { <nl> - case tok : : l_paren : <nl> - Skipped . push_back ( consumeTokenSyntax ( ) ) ; <nl> - skipUntilSyntax ( Skipped , tok : : r_paren ) ; <nl> - if ( auto RParen = consumeTokenSyntaxIf ( tok : : r_paren ) ) <nl> - Skipped . push_back ( * RParen ) ; <nl> - break ; <nl> - case tok : : l_brace : <nl> - Skipped . push_back ( consumeTokenSyntax ( ) ) ; <nl> - skipUntilSyntax ( Skipped , tok : : r_brace ) ; <nl> - if ( auto RBrace = consumeTokenSyntaxIf ( tok : : r_brace ) ) <nl> - Skipped . push_back ( * RBrace ) ; <nl> - break ; <nl> - case tok : : l_square : <nl> - Skipped . push_back ( consumeTokenSyntax ( ) ) ; <nl> - skipUntilSyntax ( Skipped , tok : : r_square ) ; <nl> - if ( auto RSquare = consumeTokenSyntaxIf ( tok : : r_square ) ) <nl> - Skipped . push_back ( * RSquare ) ; <nl> - break ; <nl> - case tok : : pound_if : <nl> - case tok : : pound_else : <nl> - case tok : : pound_elseif : <nl> - Skipped . push_back ( consumeTokenSyntax ( ) ) ; <nl> - / / skipUntil also implicitly stops at tok : : pound_endif . <nl> - skipUntilSyntax ( Skipped , tok : : pound_else , tok : : pound_elseif ) ; <nl> - <nl> - if ( Tok . isAny ( tok : : pound_else , tok : : pound_elseif ) ) <nl> - skipSingleSyntax ( Skipped ) ; <nl> - else if ( auto Endif = consumeTokenSyntaxIf ( tok : : pound_endif ) ) <nl> - Skipped . push_back ( * Endif ) ; <nl> - break ; <nl> - <nl> - default : <nl> - Skipped . push_back ( consumeTokenSyntax ( ) ) ; <nl> - break ; <nl> - } <nl> - } <nl> - <nl> void Parser : : skipSingle ( ) { <nl> switch ( Tok . getKind ( ) ) { <nl> case tok : : l_paren : <nl> void Parser : : skipSingle ( ) { <nl> } <nl> } <nl> <nl> - void Parser : : skipUntilSyntax ( llvm : : SmallVectorImpl < ParsedSyntax > & Skipped , <nl> - tok T1 , tok T2 ) { <nl> - / / tok : : NUM_TOKENS is a sentinel that means " don ' t skip " . <nl> - if ( T1 = = tok : : NUM_TOKENS & & T2 = = tok : : NUM_TOKENS ) return ; <nl> - <nl> - while ( Tok . isNot ( T1 , T2 , tok : : eof , tok : : pound_endif , tok : : code_complete ) ) <nl> - skipSingleSyntax ( Skipped ) ; <nl> - } <nl> - <nl> void Parser : : skipUntil ( tok T1 , tok T2 ) { <nl> / / tok : : NUM_TOKENS is a sentinel that means " don ' t skip " . <nl> if ( T1 = = tok : : NUM_TOKENS & & T2 = = tok : : NUM_TOKENS ) return ; <nl> void Parser : : skipUntilAnyOperator ( ) { <nl> skipSingle ( ) ; <nl> } <nl> <nl> - void Parser : : skipUntilGreaterInTypeListSyntax ( <nl> - SmallVectorImpl < ParsedSyntax > & Skipped , bool protocolComposition ) { <nl> - while ( true ) { <nl> - switch ( Tok . getKind ( ) ) { <nl> - case tok : : eof : <nl> - case tok : : l_brace : <nl> - case tok : : r_brace : <nl> - case tok : : code_complete : <nl> - return ; <nl> - <nl> - # define KEYWORD ( X ) case tok : : kw_ # # X : <nl> - # define POUND_KEYWORD ( X ) case tok : : pound_ # # X : <nl> - # include " swift / Syntax / TokenKinds . def " <nl> - / / ' Self ' can appear in types , skip it . <nl> - if ( Tok . is ( tok : : kw_Self ) ) <nl> - break ; <nl> - if ( isStartOfStmt ( ) | | isStartOfDecl ( ) | | Tok . is ( tok : : pound_endif ) ) <nl> - return ; <nl> - break ; <nl> - <nl> - case tok : : l_paren : <nl> - case tok : : r_paren : <nl> - case tok : : l_square : <nl> - case tok : : r_square : <nl> - / / In generic type parameter list , skip ' [ ' ' ] ' ' ( ' ' ) ' , because they <nl> - / / can appear in types . <nl> - if ( protocolComposition ) <nl> - return ; <nl> - break ; <nl> - <nl> - default : <nl> - if ( Tok . isAnyOperator ( ) & & startsWithGreater ( Tok ) ) { <nl> - Skipped . push_back ( consumeStartingGreaterSyntax ( ) ) ; <nl> - return ; <nl> - } <nl> - <nl> - break ; <nl> - } <nl> - skipSingleSyntax ( Skipped ) ; <nl> - } <nl> - } <nl> - <nl> / / / Skip until a token that starts with ' > ' , and consume it if found . <nl> / / / Applies heuristics that are suitable when trying to find the end of a list <nl> / / / of generic parameters , generic arguments , or list of types in a protocol <nl> void Parser : : skipListUntilDeclRBrace ( SourceLoc startLoc , tok T1 , tok T2 ) { <nl> } <nl> } <nl> <nl> - void Parser : : skipListUntilDeclRBraceSyntax ( <nl> - SmallVectorImpl < ParsedSyntax > & Skipped , SourceLoc startLoc , tok T1 , tok T2 ) { <nl> - while ( Tok . isNot ( T1 , T2 , tok : : eof , tok : : r_brace , tok : : pound_endif , <nl> - tok : : pound_else , tok : : pound_elseif ) ) { <nl> - auto Comma = consumeTokenSyntaxIf ( tok : : comma ) ; <nl> - if ( Comma ) <nl> - Skipped . push_back ( * Comma ) ; <nl> - <nl> - bool hasDelimiter = Tok . getLoc ( ) = = startLoc | | Comma ; <nl> - bool possibleDeclStartsLine = Tok . isAtStartOfLine ( ) ; <nl> - <nl> - if ( isStartOfDecl ( ) ) { <nl> - / / Could have encountered something like ` _ var : ` <nl> - / / or ` let foo : ` or ` var : ` <nl> - if ( Tok . isAny ( tok : : kw_var , tok : : kw_let ) ) { <nl> - if ( possibleDeclStartsLine & & ! hasDelimiter ) { <nl> - break ; <nl> - } <nl> - <nl> - Parser : : BacktrackingScope backtrack ( * this ) ; <nl> - / / Consume the let or var <nl> - auto LetOrVar = consumeTokenSyntax ( ) ; <nl> - Skipped . push_back ( LetOrVar ) ; <nl> - <nl> - / / If the following token is either < identifier > or : , it means that <nl> - / / this ` var ` or ` let ` should be interpreted as a label <nl> - if ( ( Tok . canBeArgumentLabel ( ) & & peekToken ( ) . is ( tok : : colon ) ) | | <nl> - peekToken ( ) . is ( tok : : colon ) ) { <nl> - backtrack . cancelBacktrack ( ) ; <nl> - continue ; <nl> - } <nl> - } <nl> - break ; <nl> - } <nl> - skipSingleSyntax ( Skipped ) ; <nl> - } <nl> - } <nl> - <nl> void Parser : : skipUntilDeclRBrace ( tok T1 , tok T2 ) { <nl> while ( Tok . isNot ( T1 , T2 , tok : : eof , tok : : r_brace , tok : : pound_endif , <nl> tok : : pound_else , tok : : pound_elseif ) & & <nl> bool Parser : : StructureMarkerRAII : : pushStructureMarker ( <nl> / / Primitive Parsing <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> <nl> - Optional < ParsedTokenSyntax > Parser : : parseIdentifierSyntax ( const Diagnostic & D ) { <nl> - switch ( Tok . getKind ( ) ) { <nl> - case tok : : kw_self : <nl> - case tok : : kw_Self : <nl> - case tok : : identifier : <nl> - return consumeIdentifierSyntax ( ) ; <nl> - default : <nl> - checkForInputIncomplete ( ) ; <nl> - diagnose ( Tok , D ) ; <nl> - return None ; <nl> - } <nl> - } <nl> - <nl> bool Parser : : parseIdentifier ( Identifier & Result , SourceLoc & Loc , <nl> const Diagnostic & D ) { <nl> switch ( Tok . getKind ( ) ) { <nl> bool Parser : : parseMatchingToken ( tok K , SourceLoc & TokLoc , Diag < > ErrorDiag , <nl> return false ; <nl> } <nl> <nl> - Optional < ParsedTokenSyntax > Parser : : parseTokenSyntax ( tok K , const Diagnostic & D ) { <nl> - if ( Tok . is ( K ) ) { <nl> - return consumeTokenSyntax ( ) ; <nl> - } <nl> - <nl> - checkForInputIncomplete ( ) ; <nl> - diagnose ( Tok , D ) ; <nl> - return None ; <nl> - } <nl> - <nl> - Optional < ParsedTokenSyntax > <nl> - Parser : : parseMatchingTokenSyntax ( tok K , Diag < > ErrorDiag , SourceLoc OtherLoc ) { <nl> - Diag < > OtherNote ; <nl> - switch ( K ) { <nl> - case tok : : r_paren : OtherNote = diag : : opening_paren ; break ; <nl> - case tok : : r_square : OtherNote = diag : : opening_bracket ; break ; <nl> - case tok : : r_brace : OtherNote = diag : : opening_brace ; break ; <nl> - default : llvm_unreachable ( " unknown matching token ! " ) ; <nl> - } <nl> - <nl> - auto Token = parseTokenSyntax ( K , ErrorDiag ) ; <nl> - if ( ! Token ) <nl> - diagnose ( OtherLoc , OtherNote ) ; <nl> - return Token ; <nl> - } <nl> - <nl> SourceLoc Parser : : getLocForMissingMatchingToken ( ) const { <nl> / / At present , use the same location whether it ' s an error or whether <nl> / / the matching token is missing . <nl> static SyntaxKind getListElementKind ( SyntaxKind ListKind ) { <nl> } <nl> } <nl> <nl> - ParserStatus <nl> - Parser : : parseListSyntax ( tok RightK , SourceLoc LeftLoc , <nl> - Optional < ParsedTokenSyntax > & LastComma , <nl> - SourceLoc & RightLoc , <nl> - Optional < ParsedTokenSyntax > & Right , <nl> - SmallVectorImpl < ParsedSyntax > & Junk , <nl> - bool AllowSepAfterLast , Diag < > ErrorDiag , <nl> - llvm : : function_ref < ParserStatus ( ) > callback ) { <nl> - auto TokIsStringInterpolationEOF = [ & ] ( ) - > bool { <nl> - return Tok . is ( tok : : eof ) & & Tok . getText ( ) = = " ) " & & RightK = = tok : : r_paren ; <nl> - } ; <nl> - <nl> - if ( Tok . is ( RightK ) ) { <nl> - RightLoc = Tok . getLoc ( ) ; <nl> - Right = consumeTokenSyntax ( RightK ) ; <nl> - return makeParserSuccess ( ) ; <nl> - } <nl> - if ( TokIsStringInterpolationEOF ( ) ) { <nl> - Tok . setKind ( RightK ) ; <nl> - RightLoc = Tok . getLoc ( ) ; <nl> - Right = consumeTokenSyntax ( ) ; <nl> - return makeParserSuccess ( ) ; <nl> - } <nl> - <nl> - ParserStatus Status ; <nl> - while ( true ) { <nl> - while ( Tok . is ( tok : : comma ) ) { <nl> - diagnose ( Tok , diag : : unexpected_separator , " , " ) <nl> - . fixItRemove ( SourceRange ( Tok . getLoc ( ) ) ) ; <nl> - auto Comma = consumeTokenSyntax ( ) ; <nl> - Junk . push_back ( Comma ) ; <nl> - } <nl> - SourceLoc StartLoc = Tok . getLoc ( ) ; <nl> - <nl> - Status | = callback ( ) ; <nl> - if ( Tok . is ( RightK ) ) <nl> - break ; <nl> - / / If the lexer stopped with an EOF token whose spelling is " ) " , then this <nl> - / / is actually the tuple that is a string literal interpolation context . <nl> - / / Just accept the " ) " and build the tuple as we usually do . <nl> - if ( TokIsStringInterpolationEOF ( ) ) { <nl> - Tok . setKind ( RightK ) ; <nl> - RightLoc = Tok . getLoc ( ) ; <nl> - Right = consumeTokenSyntax ( ) ; <nl> - return Status ; <nl> - } <nl> - / / If we haven ' t made progress , or seeing any error , skip ahead . <nl> - if ( Tok . getLoc ( ) = = StartLoc | | Status . isError ( ) ) { <nl> - assert ( Status . isError ( ) & & " no progress without error " ) ; <nl> - skipListUntilDeclRBraceSyntax ( Junk , LeftLoc , RightK , tok : : comma ) ; <nl> - if ( Tok . is ( RightK ) | | Tok . isNot ( tok : : comma ) ) <nl> - break ; <nl> - } <nl> - if ( LastComma ) { <nl> - if ( Tok . isNot ( RightK ) ) <nl> - continue ; <nl> - if ( ! AllowSepAfterLast ) { <nl> - diagnose ( Tok , diag : : unexpected_separator , " , " ) <nl> - . fixItRemove ( SourceRange ( PreviousLoc ) ) ; <nl> - } <nl> - break ; <nl> - } <nl> - / / If we ' re in a comma - separated list , the next token is at the <nl> - / / beginning of a new line and can never start an element , break . <nl> - if ( Tok . isAtStartOfLine ( ) & & <nl> - ( Tok . is ( tok : : r_brace ) | | isStartOfDecl ( ) | | isStartOfStmt ( ) ) ) { <nl> - break ; <nl> - } <nl> - / / If we found EOF or such , bailout . <nl> - if ( Tok . isAny ( tok : : eof , tok : : pound_endif ) ) { <nl> - IsInputIncomplete = true ; <nl> - break ; <nl> - } <nl> - <nl> - diagnose ( Tok , diag : : expected_separator , " , " ) <nl> - . fixItInsertAfter ( PreviousLoc , " , " ) ; <nl> - Status . setIsParseError ( ) ; <nl> - } <nl> - <nl> - if ( Status . isError ( ) ) { <nl> - / / If we ' ve already got errors , don ' t emit missing RightK diagnostics . <nl> - RightLoc = Tok . is ( RightK ) ? consumeToken ( ) : PreviousLoc ; <nl> - } else { <nl> - Right = parseMatchingTokenSyntax ( RightK , ErrorDiag , LeftLoc ) ; <nl> - if ( ! Right ) <nl> - Status . setIsParseError ( ) ; <nl> - } <nl> - <nl> - return Status ; <nl> - } <nl> - <nl> ParserStatus <nl> Parser : : parseList ( tok RightK , SourceLoc LeftLoc , SourceLoc & RightLoc , <nl> bool AllowSepAfterLast , Diag < > ErrorDiag , SyntaxKind Kind , <nl> mmm a / lib / Parse / SyntaxParsingContext . cpp <nl> ppp b / lib / Parse / SyntaxParsingContext . cpp <nl> size_t SyntaxParsingContext : : lookupNode ( size_t LexerOffset , SourceLoc Loc ) { <nl> } <nl> Mode = AccumulationMode : : SkippedForIncrementalUpdate ; <nl> getStorage ( ) . push_back ( foundNode ) ; <nl> - return foundNode . getRecordedRange ( ) . getByteLength ( ) ; <nl> + return foundNode . getRange ( ) . getByteLength ( ) ; <nl> } <nl> <nl> ParsedRawSyntaxNode <nl> SyntaxParsingContext : : makeUnknownSyntax ( SyntaxKind Kind , <nl> ArrayRef < ParsedRawSyntaxNode > Parts ) { <nl> assert ( isUnknownKind ( Kind ) ) ; <nl> - if ( shouldDefer ( ) ) <nl> + if ( IsBacktracking ) <nl> return ParsedRawSyntaxNode : : makeDeferred ( Kind , Parts , * this ) ; <nl> else <nl> return getRecorder ( ) . recordRawSyntax ( Kind , Parts ) ; <nl> SyntaxParsingContext : : createSyntaxAs ( SyntaxKind Kind , <nl> ParsedRawSyntaxNode rawNode ; <nl> auto & rec = getRecorder ( ) ; <nl> auto formNode = [ & ] ( SyntaxKind kind , ArrayRef < ParsedRawSyntaxNode > layout ) { <nl> - if ( nodeCreateK = = SyntaxNodeCreationKind : : Deferred | | shouldDefer ( ) ) { <nl> + if ( nodeCreateK = = SyntaxNodeCreationKind : : Deferred | | IsBacktracking ) { <nl> rawNode = ParsedRawSyntaxNode : : makeDeferred ( kind , layout , * this ) ; <nl> } else { <nl> rawNode = rec . recordRawSyntax ( kind , layout ) ; <nl> void SyntaxParsingContext : : addToken ( Token & Tok , <nl> const ParsedTrivia & LeadingTrivia , <nl> const ParsedTrivia & TrailingTrivia ) { <nl> ParsedRawSyntaxNode raw ; <nl> - if ( shouldDefer ( ) ) <nl> + if ( IsBacktracking ) <nl> raw = ParsedRawSyntaxNode : : makeDeferred ( Tok , LeadingTrivia , TrailingTrivia , <nl> * this ) ; <nl> else <nl> ParsedRawSyntaxNode SyntaxParsingContext : : finalizeSourceFile ( ) { <nl> <nl> void SyntaxParsingContext : : synthesize ( tok Kind , SourceLoc Loc ) { <nl> ParsedRawSyntaxNode raw ; <nl> - if ( shouldDefer ( ) ) <nl> + if ( IsBacktracking ) <nl> raw = ParsedRawSyntaxNode : : makeDeferredMissing ( Kind , Loc ) ; <nl> else <nl> raw = getRecorder ( ) . recordMissingToken ( Kind , Loc ) ; <nl> mmm a / lib / ParseSIL / ParseSIL . cpp <nl> ppp b / lib / ParseSIL / ParseSIL . cpp <nl> bool SILParser : : parseSILType ( SILType & Result , <nl> SILValueCategory category = SILValueCategory : : Object ; <nl> if ( P . Tok . isAnyOperator ( ) & & P . Tok . getText ( ) . startswith ( " * " ) ) { <nl> category = SILValueCategory : : Address ; <nl> - P . consumeStartingCharacterOfCurrentToken ( tok : : oper_binary_unspaced ) ; <nl> + P . consumeStartingCharacterOfCurrentToken ( ) ; <nl> } <nl> <nl> / / Parse attributes . <nl> mmm a / lib / Syntax / SyntaxKind . cpp . gyb <nl> ppp b / lib / Syntax / SyntaxKind . cpp . gyb <nl> StringRef getTokenText ( tok kind ) { <nl> return getTokenTextInternal ( kind ) ; <nl> } <nl> <nl> - bool isTokenKeyword ( tok kind ) { <nl> - switch ( kind ) { <nl> - # define KEYWORD ( X ) case tok : : kw_ # # X : return true ; <nl> - # include " swift / Syntax / TokenKinds . def " <nl> - default : return false ; <nl> - } <nl> - } <nl> - <nl> bool parserShallOmitWhenNoChildren ( syntax : : SyntaxKind Kind ) { <nl> switch ( Kind ) { <nl> % for node in SYNTAX_NODES : <nl> mmm a / test / Parse / confusables . swift <nl> ppp b / test / Parse / confusables . swift <nl> <nl> let numberâ Int / / expected - note { { operator ' â ' contains possibly confused characters ; did you mean to use ' : ' ? } } { { 11 - 14 = : } } <nl> <nl> / / expected - warning @ + 3 2 { { integer literal is unused } } <nl> - / / expected - error @ + 2 { { invalid character in source file } } <nl> + / / expected - error @ + 2 2 { { invalid character in source file } } <nl> / / expected - error @ + 1 { { consecutive statements on a line must be separated by ' ; ' } } <nl> - 5 â 5 / / expected - note { { unicode character ' â ' looks similar to ' - ' ; did you mean to use ' - ' ? } } { { 3 - 6 = - } } <nl> + 5 â 5 / / expected - note 2 { { unicode character ' â ' looks similar to ' - ' ; did you mean to use ' - ' ? } } { { 3 - 6 = - } } <nl> <nl> / / expected - error @ + 2 { { use of unresolved identifier ' ê ¸ ê ¸ ê ¸ ' } } <nl> / / expected - error @ + 1 { { expected ' , ' separator } } <nl> mmm a / test / Parse / invalid - utf8 . swift <nl> ppp b / test / Parse / invalid - utf8 . swift <nl> <nl> / / RUN : % target - typecheck - verify - swift <nl> <nl> - var x = " " / / expected - error 2 { { invalid UTF - 8 found in source file } } { { 5 - 6 = } } <nl> + var x = " " / / expected - error { { invalid UTF - 8 found in source file } } { { 5 - 6 = } } <nl> <nl> / / Make sure we don ' t stop processing the whole file . <nl> static func foo ( ) { } / / expected - error { { static methods may only be declared on a type } } { { 1 - 8 = } } <nl> mmm a / test / Parse / recovery . swift <nl> ppp b / test / Parse / recovery . swift <nl> struct ErrorInFunctionSignatureResultArrayType1 { <nl> <nl> struct ErrorInFunctionSignatureResultArrayType2 { <nl> func foo ( ) - > Int [ 0 { / / expected - error { { expected ' ] ' in array type } } expected - note { { to match this opening ' [ ' } } <nl> - return [ 0 ] <nl> + return [ 0 ] / / expected - error { { cannot convert return expression of type ' [ Int ] ' to return type ' Int ' } } <nl> } <nl> } <nl> <nl> let curlyQuotes2 = â hello world ! " <nl> <nl> <nl> / / < rdar : / / problem / 21196171 > compiler should recover better from " unicode Specials " characters <nl> - let ï ¿ ¼tryx = 123 / / expected - error { { invalid character in source file } } { { 5 - 8 = } } <nl> + let ï ¿ ¼tryx = 123 / / expected - error 2 { { invalid character in source file } } { { 5 - 8 = } } <nl> <nl> <nl> / / < rdar : / / problem / 21369926 > Malformed Swift Enums crash playground service <nl> mmm a / test / Syntax / Outputs / round_trip_invalid . swift . withkinds <nl> ppp b / test / Syntax / Outputs / round_trip_invalid . swift . withkinds <nl> <nl> / / RUN : % swift - syntax - test - deserialize - raw - tree - input - source - filename % t . dump - output - filename % t <nl> / / RUN : diff - u % s % t <nl> <nl> - let < PatternBinding > < IdentifierPattern > strings < / IdentifierPattern > < TypeAnnotation > : [ < OptionalType > < SimpleTypeIdentifier > Strin < / SimpleTypeIdentifier > [ < UnresolvedPatternExpr > < IdentifierPattern > g < / IdentifierPattern > < / UnresolvedPatternExpr > ] ? < / OptionalType > < / TypeAnnotation > < / PatternBinding > < / VariableDecl > < FunctionDecl > <nl> + let < PatternBinding > < IdentifierPattern > strings < / IdentifierPattern > < TypeAnnotation > : [ < SimpleTypeIdentifier > Strin < / SimpleTypeIdentifier > [ < UnresolvedPatternExpr > < IdentifierPattern > g < / IdentifierPattern > < / UnresolvedPatternExpr > ] ? < / TypeAnnotation > < / PatternBinding > < / VariableDecl > < FunctionDecl > <nl> <nl> / / Function body without closing brace token . <nl> func foo < FunctionSignature > < ParameterClause > ( ) < / ParameterClause > < / FunctionSignature > < CodeBlock > { < VariableDecl > <nl> mmm a / test / Syntax / Outputs / round_trip_parse_gen . swift . withkinds <nl> ppp b / test / Syntax / Outputs / round_trip_parse_gen . swift . withkinds <nl> typealias G < TypeInitializerClause > = < FunctionType > ( < TupleTypeElement > a x : < Simp <nl> typealias H < TypeInitializerClause > = < FunctionType > ( ) rethrows - > < TupleType > ( ) < / TupleType > < / FunctionType > < / TypeInitializerClause > < / TypealiasDecl > < TypealiasDecl > <nl> typealias I < TypeInitializerClause > = < FunctionType > ( < TupleTypeElement > < CompositionType > < CompositionTypeElement > < SimpleTypeIdentifier > A < / SimpleTypeIdentifier > & < / CompositionTypeElement > < CompositionTypeElement > < SimpleTypeIdentifier > B < GenericArgumentClause > < < GenericArgument > < SimpleTypeIdentifier > C < / SimpleTypeIdentifier > < / GenericArgument > > < / GenericArgumentClause > < / SimpleTypeIdentifier > < / CompositionTypeElement > < / CompositionType > < / TupleTypeElement > ) - > < CompositionType > < CompositionTypeElement > < SimpleTypeIdentifier > C < / SimpleTypeIdentifier > & < / CompositionTypeElement > < CompositionTypeElement > < SimpleTypeIdentifier > D < / SimpleTypeIdentifier > < / CompositionTypeElement > < / CompositionType > < / FunctionType > < / TypeInitializerClause > < / TypealiasDecl > < TypealiasDecl > <nl> typealias J < TypeInitializerClause > = < AttributedType > inout < Attribute > @ autoclosure < / Attribute > < FunctionType > ( ) - > < SimpleTypeIdentifier > Int < / SimpleTypeIdentifier > < / FunctionType > < / AttributedType > < / TypeInitializerClause > < / TypealiasDecl > < TypealiasDecl > <nl> - typealias K < TypeInitializerClause > = < FunctionType > ( < TupleTypeElement > < Attribute > @ invalidAttr < / Attribute > < SimpleTypeIdentifier > Int < / SimpleTypeIdentifier > , < / TupleTypeElement > < TupleTypeElement > inout < SimpleTypeIdentifier > Int < / SimpleTypeIdentifier > , < / TupleTypeElement > < TupleTypeElement > < AttributedType > __shared < SimpleTypeIdentifier > Int < / SimpleTypeIdentifier > < / AttributedType > , < / TupleTypeElement > < TupleTypeElement > < AttributedType > __owned < SimpleTypeIdentifier > Int < / SimpleTypeIdentifier > < / AttributedType > < / TupleTypeElement > ) - > < TupleType > ( ) < / TupleType > < / FunctionType > < / TypeInitializerClause > < / TypealiasDecl > < TypealiasDecl > < Attribute > <nl> + typealias K < TypeInitializerClause > = < FunctionType > ( < TupleTypeElement > < Attribute > @ invalidAttr < / Attribute > < SimpleTypeIdentifier > Int < / SimpleTypeIdentifier > , < / TupleTypeElement > < TupleTypeElement > < AttributedType > inout < SimpleTypeIdentifier > Int < / SimpleTypeIdentifier > < / AttributedType > , < / TupleTypeElement > < TupleTypeElement > < AttributedType > __shared < SimpleTypeIdentifier > Int < / SimpleTypeIdentifier > < / AttributedType > , < / TupleTypeElement > < TupleTypeElement > < AttributedType > __owned < SimpleTypeIdentifier > Int < / SimpleTypeIdentifier > < / AttributedType > < / TupleTypeElement > ) - > < TupleType > ( ) < / TupleType > < / FunctionType > < / TypeInitializerClause > < / TypealiasDecl > < TypealiasDecl > < Attribute > <nl> <nl> @ objc < / Attribute > < DeclModifier > private < / DeclModifier > typealias T < GenericParameterClause > < < GenericParameter > a , < / GenericParameter > < GenericParameter > b < / GenericParameter > > < / GenericParameterClause > < TypeInitializerClause > = < SimpleTypeIdentifier > Int < / SimpleTypeIdentifier > < / TypeInitializerClause > < / TypealiasDecl > < TypealiasDecl > < Attribute > <nl> @ objc < / Attribute > < DeclModifier > private < / DeclModifier > typealias T < GenericParameterClause > < < GenericParameter > a , < / GenericParameter > < GenericParameter > b < / GenericParameter > > < / GenericParameterClause > < / TypealiasDecl > < ClassDecl > <nl> mmm a / test / Syntax / serialize_tupletype . swift <nl> ppp b / test / Syntax / serialize_tupletype . swift <nl> <nl> / / RUN : % swift - syntax - test - input - source - filename % s - serialize - raw - tree > % t . result <nl> / / RUN : diff % t . result % s . result <nl> <nl> - typealias x = ( b : Int , _ : String ) <nl> + typealias x = ( _ b : Int , _ : String ) <nl> mmm a / test / Syntax / serialize_tupletype . swift . result <nl> ppp b / test / Syntax / serialize_tupletype . swift . result <nl> <nl> { <nl> - " id " : 39 , <nl> + " id " : 24 , <nl> " kind " : " SourceFile " , <nl> " layout " : [ <nl> { <nl> - " id " : 38 , <nl> + " id " : 23 , <nl> " kind " : " CodeBlockItemList " , <nl> " layout " : [ <nl> { <nl> - " id " : 36 , <nl> + " id " : 21 , <nl> " kind " : " CodeBlockItem " , <nl> " layout " : [ <nl> { <nl> - " id " : 35 , <nl> + " id " : 20 , <nl> " kind " : " TypealiasDecl " , <nl> " layout " : [ <nl> null , <nl> <nl> } , <nl> null , <nl> { <nl> - " id " : 34 , <nl> + " id " : 19 , <nl> " kind " : " TypeInitializerClause " , <nl> " layout " : [ <nl> { <nl> <nl> " presence " : " Present " <nl> } , <nl> { <nl> - " id " : 33 , <nl> + " id " : 18 , <nl> " kind " : " TupleType " , <nl> " layout " : [ <nl> { <nl> - " id " : 20 , <nl> + " id " : 4 , <nl> " tokenKind " : { <nl> " kind " : " l_paren " <nl> } , <nl> <nl> " presence " : " Present " <nl> } , <nl> { <nl> - " id " : 31 , <nl> + " id " : 16 , <nl> " kind " : " TupleTypeElementList " , <nl> " layout " : [ <nl> { <nl> - " id " : 26 , <nl> + " id " : 11 , <nl> " kind " : " TupleTypeElement " , <nl> " layout " : [ <nl> null , <nl> { <nl> - " id " : 21 , <nl> + " id " : 5 , <nl> + " tokenKind " : { <nl> + " kind " : " kw__ " <nl> + } , <nl> + " leadingTrivia " : [ ] , <nl> + " trailingTrivia " : [ <nl> + { <nl> + " kind " : " Space " , <nl> + " value " : 1 <nl> + } <nl> + ] , <nl> + " presence " : " Present " <nl> + } , <nl> + { <nl> + " id " : 6 , <nl> " tokenKind " : { <nl> " kind " : " identifier " , <nl> " text " : " b " <nl> <nl> " trailingTrivia " : [ ] , <nl> " presence " : " Present " <nl> } , <nl> - null , <nl> { <nl> - " id " : 22 , <nl> + " id " : 7 , <nl> " tokenKind " : { <nl> " kind " : " colon " <nl> } , <nl> <nl> " presence " : " Present " <nl> } , <nl> { <nl> - " id " : 24 , <nl> + " id " : 9 , <nl> " kind " : " SimpleTypeIdentifier " , <nl> " layout " : [ <nl> { <nl> - " id " : 23 , <nl> + " id " : 8 , <nl> " tokenKind " : { <nl> " kind " : " identifier " , <nl> " text " : " Int " <nl> <nl> null , <nl> null , <nl> { <nl> - " id " : 25 , <nl> + " id " : 10 , <nl> " tokenKind " : { <nl> " kind " : " comma " <nl> } , <nl> <nl> " presence " : " Present " <nl> } , <nl> { <nl> - " id " : 30 , <nl> + " id " : 15 , <nl> " kind " : " TupleTypeElement " , <nl> " layout " : [ <nl> null , <nl> { <nl> - " id " : 27 , <nl> + " id " : 12 , <nl> " tokenKind " : { <nl> " kind " : " kw__ " <nl> } , <nl> <nl> } , <nl> null , <nl> { <nl> - " id " : 22 , <nl> + " id " : 7 , <nl> " tokenKind " : { <nl> " kind " : " colon " <nl> } , <nl> <nl> " presence " : " Present " <nl> } , <nl> { <nl> - " id " : 29 , <nl> + " id " : 14 , <nl> " kind " : " SimpleTypeIdentifier " , <nl> " layout " : [ <nl> { <nl> - " id " : 28 , <nl> + " id " : 13 , <nl> " tokenKind " : { <nl> " kind " : " identifier " , <nl> " text " : " String " <nl> <nl> " presence " : " Present " <nl> } , <nl> { <nl> - " id " : 32 , <nl> + " id " : 17 , <nl> " tokenKind " : { <nl> " kind " : " r_paren " <nl> } , <nl> <nl> " presence " : " Present " <nl> } , <nl> { <nl> - " id " : 37 , <nl> + " id " : 22 , <nl> " tokenKind " : { <nl> " kind " : " eof " , <nl> " text " : " " <nl> | Merge pull request from apple / revert - 26478 - gsoc - 2019 - parser - types | apple/swift | 8da33a90104b9afb6ad4bff921fb002ebc359c46 | 2019-08-27T21:31:09Z |
mmm a / src / keys . cc <nl> ppp b / src / keys . cc <nl> static bool ContainsOnlyValidKeys ( Handle < FixedArray > array ) { <nl> / / static <nl> MaybeHandle < FixedArray > KeyAccumulator : : GetKeys ( <nl> Handle < JSReceiver > object , KeyCollectionMode mode , PropertyFilter filter , <nl> - GetKeysConversion keys_conversion , bool is_for_in ) { <nl> + GetKeysConversion keys_conversion , bool is_for_in , bool skip_indices ) { <nl> Isolate * isolate = object - > GetIsolate ( ) ; <nl> - FastKeyAccumulator accumulator ( isolate , object , mode , filter ) ; <nl> - accumulator . set_is_for_in ( is_for_in ) ; <nl> + FastKeyAccumulator accumulator ( isolate , object , mode , filter , is_for_in , <nl> + skip_indices ) ; <nl> return accumulator . GetKeys ( keys_conversion ) ; <nl> } <nl> <nl> Handle < FixedArray > GetFastEnumPropertyKeys ( Isolate * isolate , <nl> template < bool fast_properties > <nl> MaybeHandle < FixedArray > GetOwnKeysWithElements ( Isolate * isolate , <nl> Handle < JSObject > object , <nl> - GetKeysConversion convert ) { <nl> + GetKeysConversion convert , <nl> + bool skip_indices ) { <nl> Handle < FixedArray > keys ; <nl> ElementsAccessor * accessor = object - > GetElementsAccessor ( ) ; <nl> if ( fast_properties ) { <nl> MaybeHandle < FixedArray > GetOwnKeysWithElements ( Isolate * isolate , <nl> / / TODO ( cbruni ) : preallocate big enough array to also hold elements . <nl> keys = KeyAccumulator : : GetOwnEnumPropertyKeys ( isolate , object ) ; <nl> } <nl> - MaybeHandle < FixedArray > result = <nl> - accessor - > PrependElementIndices ( object , keys , convert , ONLY_ENUMERABLE ) ; <nl> + <nl> + MaybeHandle < FixedArray > result ; <nl> + if ( skip_indices ) { <nl> + result = keys ; <nl> + } else { <nl> + result = <nl> + accessor - > PrependElementIndices ( object , keys , convert , ONLY_ENUMERABLE ) ; <nl> + } <nl> <nl> if ( FLAG_trace_for_in_enumerate ) { <nl> PrintF ( " | strings = % d symbols = 0 elements = % u | | prototypes > = 1 | | \ n " , <nl> MaybeHandle < FixedArray > FastKeyAccumulator : : GetKeysFast ( <nl> <nl> / / Do not try to use the enum - cache for dict - mode objects . <nl> if ( map - > is_dictionary_map ( ) ) { <nl> - return GetOwnKeysWithElements < false > ( isolate_ , object , keys_conversion ) ; <nl> + return GetOwnKeysWithElements < false > ( isolate_ , object , keys_conversion , <nl> + skip_indices_ ) ; <nl> } <nl> int enum_length = receiver_ - > map ( ) - > EnumLength ( ) ; <nl> if ( enum_length = = kInvalidEnumCacheSentinel ) { <nl> MaybeHandle < FixedArray > FastKeyAccumulator : : GetKeysFast ( <nl> } <nl> / / The properties - only case failed because there were probably elements on the <nl> / / receiver . <nl> - return GetOwnKeysWithElements < true > ( isolate_ , object , keys_conversion ) ; <nl> + return GetOwnKeysWithElements < true > ( isolate_ , object , keys_conversion , <nl> + skip_indices_ ) ; <nl> } <nl> <nl> MaybeHandle < FixedArray > <nl> MaybeHandle < FixedArray > FastKeyAccumulator : : GetKeysSlow ( <nl> GetKeysConversion keys_conversion ) { <nl> KeyAccumulator accumulator ( isolate_ , mode_ , filter_ ) ; <nl> accumulator . set_is_for_in ( is_for_in_ ) ; <nl> + accumulator . set_skip_indices ( skip_indices_ ) ; <nl> accumulator . set_last_non_empty_prototype ( last_non_empty_prototype_ ) ; <nl> <nl> MAYBE_RETURN ( accumulator . CollectKeys ( receiver_ , receiver_ ) , <nl> Maybe < bool > KeyAccumulator : : CollectOwnPropertyNames ( Handle < JSReceiver > receiver , <nl> Maybe < bool > KeyAccumulator : : CollectAccessCheckInterceptorKeys ( <nl> Handle < AccessCheckInfo > access_check_info , Handle < JSReceiver > receiver , <nl> Handle < JSObject > object ) { <nl> - MAYBE_RETURN ( ( CollectInterceptorKeysInternal ( <nl> - receiver , object , <nl> - handle ( InterceptorInfo : : cast ( <nl> - access_check_info - > indexed_interceptor ( ) ) , <nl> - isolate_ ) , <nl> - this , kIndexed ) ) , <nl> - Nothing < bool > ( ) ) ; <nl> + if ( ! skip_indices_ ) { <nl> + MAYBE_RETURN ( ( CollectInterceptorKeysInternal ( <nl> + receiver , object , <nl> + handle ( InterceptorInfo : : cast ( <nl> + access_check_info - > indexed_interceptor ( ) ) , <nl> + isolate_ ) , <nl> + this , kIndexed ) ) , <nl> + Nothing < bool > ( ) ) ; <nl> + } <nl> MAYBE_RETURN ( <nl> ( CollectInterceptorKeysInternal ( <nl> receiver , object , <nl> Maybe < bool > KeyAccumulator : : CollectOwnJSProxyTargetKeys ( <nl> Handle < FixedArray > keys ; <nl> ASSIGN_RETURN_ON_EXCEPTION_VALUE ( <nl> isolate_ , keys , <nl> - KeyAccumulator : : GetKeys ( target , KeyCollectionMode : : kOwnOnly , <nl> - ALL_PROPERTIES , <nl> - GetKeysConversion : : kConvertToString , is_for_in_ ) , <nl> + KeyAccumulator : : GetKeys ( <nl> + target , KeyCollectionMode : : kOwnOnly , ALL_PROPERTIES , <nl> + GetKeysConversion : : kConvertToString , is_for_in_ , skip_indices_ ) , <nl> Nothing < bool > ( ) ) ; <nl> Maybe < bool > result = AddKeysFromJSProxy ( proxy , keys ) ; <nl> return result ; <nl> mmm a / src / keys . h <nl> ppp b / src / keys . h <nl> class KeyAccumulator final BASE_EMBEDDED { <nl> static MaybeHandle < FixedArray > GetKeys ( <nl> Handle < JSReceiver > object , KeyCollectionMode mode , PropertyFilter filter , <nl> GetKeysConversion keys_conversion = GetKeysConversion : : kKeepNumbers , <nl> - bool is_for_in = false ) ; <nl> + bool is_for_in = false , bool skip_indices = false ) ; <nl> <nl> Handle < FixedArray > GetKeys ( <nl> GetKeysConversion convert = GetKeysConversion : : kKeepNumbers ) ; <nl> class KeyAccumulator final BASE_EMBEDDED { <nl> class FastKeyAccumulator { <nl> public : <nl> FastKeyAccumulator ( Isolate * isolate , Handle < JSReceiver > receiver , <nl> - KeyCollectionMode mode , PropertyFilter filter ) <nl> - : isolate_ ( isolate ) , receiver_ ( receiver ) , mode_ ( mode ) , filter_ ( filter ) { <nl> + KeyCollectionMode mode , PropertyFilter filter , <nl> + bool is_for_in = false , bool skip_indices = false ) <nl> + : isolate_ ( isolate ) , <nl> + receiver_ ( receiver ) , <nl> + mode_ ( mode ) , <nl> + filter_ ( filter ) , <nl> + is_for_in_ ( is_for_in ) , <nl> + skip_indices_ ( skip_indices ) { <nl> Prepare ( ) ; <nl> } <nl> <nl> bool is_receiver_simple_enum ( ) { return is_receiver_simple_enum_ ; } <nl> bool has_empty_prototype ( ) { return has_empty_prototype_ ; } <nl> - void set_is_for_in ( bool value ) { is_for_in_ = value ; } <nl> <nl> MaybeHandle < FixedArray > GetKeys ( <nl> GetKeysConversion convert = GetKeysConversion : : kKeepNumbers ) ; <nl> class FastKeyAccumulator { <nl> KeyCollectionMode mode_ ; <nl> PropertyFilter filter_ ; <nl> bool is_for_in_ = false ; <nl> + bool skip_indices_ = false ; <nl> bool is_receiver_simple_enum_ = false ; <nl> bool has_empty_prototype_ = false ; <nl> <nl> mmm a / src / runtime / runtime - forin . cc <nl> ppp b / src / runtime / runtime - forin . cc <nl> MaybeHandle < HeapObject > Enumerate ( Isolate * isolate , <nl> JSObject : : MakePrototypesFast ( receiver , kStartAtReceiver , isolate ) ; <nl> FastKeyAccumulator accumulator ( isolate , receiver , <nl> KeyCollectionMode : : kIncludePrototypes , <nl> - ENUMERABLE_STRINGS ) ; <nl> - accumulator . set_is_for_in ( true ) ; <nl> + ENUMERABLE_STRINGS , true ) ; <nl> / / Test if we have an enum cache for { receiver } . <nl> if ( ! accumulator . is_receiver_simple_enum ( ) ) { <nl> Handle < FixedArray > keys ; <nl> mmm a / test / cctest / test - api . cc <nl> ppp b / test / cctest / test - api . cc <nl> THREADED_TEST ( PropertyEnumeration2 ) { <nl> } <nl> } <nl> <nl> - THREADED_TEST ( PropertyNames ) { <nl> + THREADED_TEST ( GetPropertyNames ) { <nl> LocalContext context ; <nl> v8 : : Isolate * isolate = context - > GetIsolate ( ) ; <nl> v8 : : HandleScope scope ( isolate ) ; <nl> v8 : : Local < v8 : : Value > result = CompileRun ( <nl> " var result = { 0 : 0 , 1 : 1 , a : 2 , b : 3 } ; " <nl> " result [ Symbol ( ' symbol ' ) ] = true ; " <nl> - " result . __proto__ = { 2 : 4 , 3 : 5 , c : 6 , d : 7 } ; " <nl> + " result . __proto__ = { __proto__ : null , 2 : 4 , 3 : 5 , c : 6 , d : 7 } ; " <nl> + " result ; " ) ; <nl> + v8 : : Local < v8 : : Object > object = result . As < v8 : : Object > ( ) ; <nl> + v8 : : PropertyFilter default_filter = <nl> + static_cast < v8 : : PropertyFilter > ( v8 : : ONLY_ENUMERABLE | v8 : : SKIP_SYMBOLS ) ; <nl> + v8 : : PropertyFilter include_symbols_filter = v8 : : ONLY_ENUMERABLE ; <nl> + <nl> + v8 : : Local < v8 : : Array > properties = <nl> + object - > GetPropertyNames ( context . local ( ) ) . ToLocalChecked ( ) ; <nl> + const char * expected_properties1 [ ] = { " 0 " , " 1 " , " a " , " b " , " 2 " , " 3 " , " c " , " d " } ; <nl> + CheckStringArray ( isolate , properties , 8 , expected_properties1 ) ; <nl> + <nl> + properties = <nl> + object <nl> + - > GetPropertyNames ( context . local ( ) , <nl> + v8 : : KeyCollectionMode : : kIncludePrototypes , <nl> + default_filter , v8 : : IndexFilter : : kIncludeIndices ) <nl> + . ToLocalChecked ( ) ; <nl> + CheckStringArray ( isolate , properties , 8 , expected_properties1 ) ; <nl> + <nl> + properties = object <nl> + - > GetPropertyNames ( context . local ( ) , <nl> + v8 : : KeyCollectionMode : : kIncludePrototypes , <nl> + include_symbols_filter , <nl> + v8 : : IndexFilter : : kIncludeIndices ) <nl> + . ToLocalChecked ( ) ; <nl> + const char * expected_properties1_1 [ ] = { " 0 " , " 1 " , " a " , " b " , nullptr , <nl> + " 2 " , " 3 " , " c " , " d " } ; <nl> + CheckStringArray ( isolate , properties , 9 , expected_properties1_1 ) ; <nl> + CheckIsSymbolAt ( isolate , properties , 4 , " symbol " ) ; <nl> + <nl> + properties = <nl> + object <nl> + - > GetPropertyNames ( context . local ( ) , <nl> + v8 : : KeyCollectionMode : : kIncludePrototypes , <nl> + default_filter , v8 : : IndexFilter : : kSkipIndices ) <nl> + . ToLocalChecked ( ) ; <nl> + const char * expected_properties2 [ ] = { " a " , " b " , " c " , " d " } ; <nl> + CheckStringArray ( isolate , properties , 4 , expected_properties2 ) ; <nl> + <nl> + properties = object <nl> + - > GetPropertyNames ( context . local ( ) , <nl> + v8 : : KeyCollectionMode : : kIncludePrototypes , <nl> + include_symbols_filter , <nl> + v8 : : IndexFilter : : kSkipIndices ) <nl> + . ToLocalChecked ( ) ; <nl> + const char * expected_properties2_1 [ ] = { " a " , " b " , nullptr , " c " , " d " } ; <nl> + CheckStringArray ( isolate , properties , 5 , expected_properties2_1 ) ; <nl> + CheckIsSymbolAt ( isolate , properties , 2 , " symbol " ) ; <nl> + <nl> + properties = <nl> + object <nl> + - > GetPropertyNames ( context . local ( ) , v8 : : KeyCollectionMode : : kOwnOnly , <nl> + default_filter , v8 : : IndexFilter : : kIncludeIndices ) <nl> + . ToLocalChecked ( ) ; <nl> + const char * expected_properties3 [ ] = { " 0 " , " 1 " , " a " , " b " } ; <nl> + CheckStringArray ( isolate , properties , 4 , expected_properties3 ) ; <nl> + <nl> + properties = object <nl> + - > GetPropertyNames ( <nl> + context . local ( ) , v8 : : KeyCollectionMode : : kOwnOnly , <nl> + include_symbols_filter , v8 : : IndexFilter : : kIncludeIndices ) <nl> + . ToLocalChecked ( ) ; <nl> + const char * expected_properties3_1 [ ] = { " 0 " , " 1 " , " a " , " b " , nullptr } ; <nl> + CheckStringArray ( isolate , properties , 5 , expected_properties3_1 ) ; <nl> + CheckIsSymbolAt ( isolate , properties , 4 , " symbol " ) ; <nl> + <nl> + properties = <nl> + object <nl> + - > GetPropertyNames ( context . local ( ) , v8 : : KeyCollectionMode : : kOwnOnly , <nl> + default_filter , v8 : : IndexFilter : : kSkipIndices ) <nl> + . ToLocalChecked ( ) ; <nl> + const char * expected_properties4 [ ] = { " a " , " b " } ; <nl> + CheckStringArray ( isolate , properties , 2 , expected_properties4 ) ; <nl> + <nl> + properties = object <nl> + - > GetPropertyNames ( <nl> + context . local ( ) , v8 : : KeyCollectionMode : : kOwnOnly , <nl> + include_symbols_filter , v8 : : IndexFilter : : kSkipIndices ) <nl> + . ToLocalChecked ( ) ; <nl> + const char * expected_properties4_1 [ ] = { " a " , " b " , nullptr } ; <nl> + CheckStringArray ( isolate , properties , 3 , expected_properties4_1 ) ; <nl> + CheckIsSymbolAt ( isolate , properties , 2 , " symbol " ) ; <nl> + } <nl> + <nl> + THREADED_TEST ( ProxyGetPropertyNames ) { <nl> + LocalContext context ; <nl> + v8 : : Isolate * isolate = context - > GetIsolate ( ) ; <nl> + v8 : : HandleScope scope ( isolate ) ; <nl> + v8 : : Local < v8 : : Value > result = CompileRun ( <nl> + " var target = { 0 : 0 , 1 : 1 , a : 2 , b : 3 } ; " <nl> + " target [ Symbol ( ' symbol ' ) ] = true ; " <nl> + " target . __proto__ = { __proto__ : null , 2 : 4 , 3 : 5 , c : 6 , d : 7 } ; " <nl> + " var result = new Proxy ( target , { } ) ; " <nl> " result ; " ) ; <nl> v8 : : Local < v8 : : Object > object = result . As < v8 : : Object > ( ) ; <nl> v8 : : PropertyFilter default_filter = <nl> | [ api ] [ keys ] Allow skipping indices for Proxies with GetPropertyNames | v8/v8 | c608122b85238397a43910246f5ff218eb43fb24 | 2018-07-31T16:16:08Z |
mmm a / src / compiler / ast - graph - builder . cc <nl> ppp b / src / compiler / ast - graph - builder . cc <nl> void AstGraphBuilder : : VisitClassLiteralContents ( ClassLiteral * expr ) { <nl> Node * constructor = environment ( ) - > Pop ( ) ; <nl> Node * extends = environment ( ) - > Pop ( ) ; <nl> Node * name = environment ( ) - > Pop ( ) ; <nl> - Node * script = jsgraph ( ) - > Constant ( info ( ) - > script ( ) ) ; <nl> Node * start = jsgraph ( ) - > Constant ( expr - > start_position ( ) ) ; <nl> Node * end = jsgraph ( ) - > Constant ( expr - > end_position ( ) ) ; <nl> const Operator * opc = javascript ( ) - > CallRuntime ( <nl> is_strong ( language_mode ( ) ) ? Runtime : : kDefineClassStrong <nl> : Runtime : : kDefineClass , <nl> - 6 ) ; <nl> - Node * literal = NewNode ( opc , name , extends , constructor , script , start , end ) ; <nl> + 5 ) ; <nl> + Node * literal = NewNode ( opc , name , extends , constructor , start , end ) ; <nl> PrepareFrameState ( literal , expr - > CreateLiteralId ( ) , <nl> OutputFrameStateCombine : : Push ( ) ) ; <nl> <nl> mmm a / src / full - codegen / full - codegen . cc <nl> ppp b / src / full - codegen / full - codegen . cc <nl> void FullCodeGenerator : : VisitClassLiteral ( ClassLiteral * lit ) { <nl> <nl> VisitForStackValue ( lit - > constructor ( ) ) ; <nl> <nl> - __ Push ( script ( ) ) ; <nl> __ Push ( Smi : : FromInt ( lit - > start_position ( ) ) ) ; <nl> __ Push ( Smi : : FromInt ( lit - > end_position ( ) ) ) ; <nl> <nl> __ CallRuntime ( is_strong ( language_mode ( ) ) ? Runtime : : kDefineClassStrong <nl> : Runtime : : kDefineClass , <nl> - 6 ) ; <nl> + 5 ) ; <nl> PrepareForBailoutForId ( lit - > CreateLiteralId ( ) , TOS_REG ) ; <nl> <nl> int store_slot_index = 0 ; <nl> mmm a / src / heap / heap . h <nl> ppp b / src / heap / heap . h <nl> namespace internal { <nl> V ( intl_impl_object_symbol ) \ <nl> V ( promise_debug_marker_symbol ) \ <nl> V ( promise_has_handler_symbol ) \ <nl> - V ( class_script_symbol ) \ <nl> V ( class_start_position_symbol ) \ <nl> V ( class_end_position_symbol ) \ <nl> V ( error_start_pos_symbol ) \ <nl> mmm a / src / runtime / runtime - classes . cc <nl> ppp b / src / runtime / runtime - classes . cc <nl> RUNTIME_FUNCTION ( Runtime_HomeObjectSymbol ) { <nl> static MaybeHandle < Object > DefineClass ( Isolate * isolate , Handle < Object > name , <nl> Handle < Object > super_class , <nl> Handle < JSFunction > constructor , <nl> - Handle < Script > script , <nl> int start_position , int end_position ) { <nl> Handle < Object > prototype_parent ; <nl> Handle < Object > constructor_parent ; <nl> static MaybeHandle < Object > DefineClass ( Isolate * isolate , Handle < Object > name , <nl> constructor , DONT_ENUM ) ; <nl> <nl> / / Install private properties that are used to construct the FunctionToString . <nl> - RETURN_ON_EXCEPTION ( <nl> - isolate , Object : : SetProperty ( constructor , <nl> - isolate - > factory ( ) - > class_script_symbol ( ) , <nl> - script , STRICT ) , <nl> - Object ) ; <nl> RETURN_ON_EXCEPTION ( <nl> isolate , <nl> Object : : SetProperty ( <nl> static MaybeHandle < Object > DefineClass ( Isolate * isolate , Handle < Object > name , <nl> <nl> RUNTIME_FUNCTION ( Runtime_DefineClass ) { <nl> HandleScope scope ( isolate ) ; <nl> - DCHECK ( args . length ( ) = = 6 ) ; <nl> + DCHECK ( args . length ( ) = = 5 ) ; <nl> CONVERT_ARG_HANDLE_CHECKED ( Object , name , 0 ) ; <nl> CONVERT_ARG_HANDLE_CHECKED ( Object , super_class , 1 ) ; <nl> CONVERT_ARG_HANDLE_CHECKED ( JSFunction , constructor , 2 ) ; <nl> - CONVERT_ARG_HANDLE_CHECKED ( Script , script , 3 ) ; <nl> - CONVERT_SMI_ARG_CHECKED ( start_position , 4 ) ; <nl> - CONVERT_SMI_ARG_CHECKED ( end_position , 5 ) ; <nl> + CONVERT_SMI_ARG_CHECKED ( start_position , 3 ) ; <nl> + CONVERT_SMI_ARG_CHECKED ( end_position , 4 ) ; <nl> <nl> Handle < Object > result ; <nl> ASSIGN_RETURN_FAILURE_ON_EXCEPTION ( <nl> isolate , result , DefineClass ( isolate , name , super_class , constructor , <nl> - script , start_position , end_position ) ) ; <nl> + start_position , end_position ) ) ; <nl> return * result ; <nl> } <nl> <nl> <nl> RUNTIME_FUNCTION ( Runtime_DefineClassStrong ) { <nl> HandleScope scope ( isolate ) ; <nl> - DCHECK ( args . length ( ) = = 6 ) ; <nl> + DCHECK ( args . length ( ) = = 5 ) ; <nl> CONVERT_ARG_HANDLE_CHECKED ( Object , name , 0 ) ; <nl> CONVERT_ARG_HANDLE_CHECKED ( Object , super_class , 1 ) ; <nl> CONVERT_ARG_HANDLE_CHECKED ( JSFunction , constructor , 2 ) ; <nl> - CONVERT_ARG_HANDLE_CHECKED ( Script , script , 3 ) ; <nl> - CONVERT_SMI_ARG_CHECKED ( start_position , 4 ) ; <nl> - CONVERT_SMI_ARG_CHECKED ( end_position , 5 ) ; <nl> + CONVERT_SMI_ARG_CHECKED ( start_position , 3 ) ; <nl> + CONVERT_SMI_ARG_CHECKED ( end_position , 4 ) ; <nl> <nl> if ( super_class - > IsNull ( ) ) { <nl> THROW_NEW_ERROR_RETURN_FAILURE ( <nl> RUNTIME_FUNCTION ( Runtime_DefineClassStrong ) { <nl> Handle < Object > result ; <nl> ASSIGN_RETURN_FAILURE_ON_EXCEPTION ( <nl> isolate , result , DefineClass ( isolate , name , super_class , constructor , <nl> - script , start_position , end_position ) ) ; <nl> + start_position , end_position ) ) ; <nl> return * result ; <nl> } <nl> <nl> RUNTIME_FUNCTION ( Runtime_ClassGetSourceCode ) { <nl> DCHECK ( args . length ( ) = = 1 ) ; <nl> CONVERT_ARG_HANDLE_CHECKED ( JSFunction , fun , 0 ) ; <nl> <nl> - Handle < Object > script ; <nl> - ASSIGN_RETURN_FAILURE_ON_EXCEPTION ( <nl> - isolate , script , <nl> - Object : : GetProperty ( fun , isolate - > factory ( ) - > class_script_symbol ( ) ) ) ; <nl> - if ( ! script - > IsScript ( ) ) { <nl> - return isolate - > heap ( ) - > undefined_value ( ) ; <nl> - } <nl> - <nl> Handle < Symbol > start_position_symbol ( <nl> isolate - > heap ( ) - > class_start_position_symbol ( ) ) ; <nl> - Handle < Object > start_position ; <nl> - ASSIGN_RETURN_FAILURE_ON_EXCEPTION ( <nl> - isolate , start_position , Object : : GetProperty ( fun , start_position_symbol ) ) ; <nl> + Handle < Object > start_position = <nl> + JSReceiver : : GetDataProperty ( fun , start_position_symbol ) ; <nl> + if ( ! start_position - > IsSmi ( ) ) return isolate - > heap ( ) - > undefined_value ( ) ; <nl> <nl> Handle < Symbol > end_position_symbol ( <nl> isolate - > heap ( ) - > class_end_position_symbol ( ) ) ; <nl> - Handle < Object > end_position ; <nl> - ASSIGN_RETURN_FAILURE_ON_EXCEPTION ( <nl> - isolate , end_position , Object : : GetProperty ( fun , end_position_symbol ) ) ; <nl> - <nl> - if ( ! start_position - > IsSmi ( ) | | ! end_position - > IsSmi ( ) | | <nl> - ! Handle < Script > : : cast ( script ) - > HasValidSource ( ) ) { <nl> - return isolate - > ThrowIllegalOperation ( ) ; <nl> - } <nl> + Handle < Object > end_position = <nl> + JSReceiver : : GetDataProperty ( fun , end_position_symbol ) ; <nl> + CHECK ( end_position - > IsSmi ( ) ) ; <nl> <nl> - Handle < String > source ( String : : cast ( Handle < Script > : : cast ( script ) - > source ( ) ) ) ; <nl> + Handle < String > source ( <nl> + String : : cast ( Script : : cast ( fun - > shared ( ) - > script ( ) ) - > source ( ) ) ) ; <nl> return * isolate - > factory ( ) - > NewSubString ( <nl> source , Handle < Smi > : : cast ( start_position ) - > value ( ) , <nl> Handle < Smi > : : cast ( end_position ) - > value ( ) ) ; <nl> mmm a / src / runtime / runtime . h <nl> ppp b / src / runtime / runtime . h <nl> namespace internal { <nl> F ( ThrowIfStaticPrototype , 1 , 1 ) \ <nl> F ( ToMethod , 2 , 1 ) \ <nl> F ( HomeObjectSymbol , 0 , 1 ) \ <nl> - F ( DefineClass , 6 , 1 ) \ <nl> - F ( DefineClassStrong , 6 , 1 ) \ <nl> + F ( DefineClass , 5 , 1 ) \ <nl> + F ( DefineClassStrong , 5 , 1 ) \ <nl> F ( FinalizeClassDefinition , 2 , 1 ) \ <nl> F ( DefineClassMethod , 3 , 1 ) \ <nl> F ( ClassGetSourceCode , 1 , 1 ) \ <nl> | Do not save script object on the class constructor . | v8/v8 | abc12df33c0dd188441acbf1646048111bdaf1be | 2015-08-12T13:06:20Z |
mmm a / CMakeLists . txt <nl> ppp b / CMakeLists . txt <nl> add_definitions ( - DPNG_NO_MMX_CODE ) # Do not use MMX optimizations in PNG code <nl> <nl> # libwebp <nl> if ( WITH_WEBP_SUPPORT ) <nl> - set ( WEBP_LIBRARIES webp webpdemux webpmux ) <nl> + set ( WEBP_LIBRARIES webp ) <nl> set ( WEBP_INCLUDE_DIR $ { LIBWEBP_DIR } / src ) <nl> include_directories ( $ { WEBP_INCLUDE_DIR } ) <nl> endif ( ) <nl> mmm a / third_party / CMakeLists . txt <nl> ppp b / third_party / CMakeLists . txt <nl> if ( NOT USE_SHARED_GIFLIB ) <nl> endif ( ) <nl> <nl> if ( WITH_WEBP_SUPPORT ) <nl> - # Enable img2webp so " webpmux " library is built <nl> - set ( WEBP_BUILD_IMG2WEBP ON CACHE BOOL " Build the img2webp animation tool . " ) <nl> + set ( WEBP_BUILD_ANIM_UTILS OFF CACHE BOOL " Build animation utilities . " ) <nl> + set ( WEBP_BUILD_CWEBP OFF CACHE BOOL " Build the cwebp command line tool . " ) <nl> + set ( WEBP_BUILD_DWEBP OFF CACHE BOOL " Build the dwebp command line tool . " ) <nl> + set ( WEBP_BUILD_GIF2WEBP OFF CACHE BOOL " Build the gif2webp conversion tool . " ) <nl> + set ( WEBP_BUILD_IMG2WEBP OFF CACHE BOOL " Build the img2webp animation tool . " ) <nl> + set ( WEBP_BUILD_VWEBP OFF CACHE BOOL " Build the vwebp viewer tool . " ) <nl> + set ( WEBP_BUILD_WEBPINFO OFF CACHE BOOL " Build the webpinfo command line tool . " ) <nl> + set ( WEBP_BUILD_WEBPMUX OFF CACHE BOOL " Build the webpmux command line tool . " ) <nl> + set ( WEBP_BUILD_WEBP_JS OFF CACHE BOOL " Emscripten build of webp . js . " ) <nl> add_subdirectory ( libwebp ) <nl> endif ( ) <nl> <nl> mmm a / third_party / libwebp <nl> ppp b / third_party / libwebp <nl> @ @ - 1 + 1 @ @ <nl> - Subproject commit b2db361ca681eef4f99c07dee0fb9bfeb99be6bf <nl> + Subproject commit c56a02d9712fd4dddfe43dad4778f4bcce38de15 <nl> | Update libwebp module | aseprite/aseprite | 850bf76bf5a92df9661021b83948df79f9932aef | 2018-06-09T16:04:56Z |
mmm a / dbms / src / Interpreters / AsteriskSemantic . h <nl> ppp b / dbms / src / Interpreters / AsteriskSemantic . h <nl> <nl> <nl> # include < Parsers / ASTAsterisk . h > <nl> # include < Parsers / ASTQualifiedAsterisk . h > <nl> - # include < Parsers / ASTColumnsClause . h > <nl> + # include < Parsers / ASTColumnsMatcher . h > <nl> <nl> namespace DB <nl> { <nl> struct AsteriskSemantic <nl> <nl> static void setAliases ( ASTAsterisk & node , const RevertedAliasesPtr & aliases ) { node . semantic = makeSemantic ( aliases ) ; } <nl> static void setAliases ( ASTQualifiedAsterisk & node , const RevertedAliasesPtr & aliases ) { node . semantic = makeSemantic ( aliases ) ; } <nl> - static void setAliases ( ASTColumnsClause & node , const RevertedAliasesPtr & aliases ) { node . semantic = makeSemantic ( aliases ) ; } <nl> + static void setAliases ( ASTColumnsMatcher & node , const RevertedAliasesPtr & aliases ) { node . semantic = makeSemantic ( aliases ) ; } <nl> <nl> static RevertedAliasesPtr getAliases ( const ASTAsterisk & node ) { return node . semantic ? node . semantic - > aliases : nullptr ; } <nl> static RevertedAliasesPtr getAliases ( const ASTQualifiedAsterisk & node ) { return node . semantic ? node . semantic - > aliases : nullptr ; } <nl> - static RevertedAliasesPtr getAliases ( const ASTColumnsClause & node ) { return node . semantic ? node . semantic - > aliases : nullptr ; } <nl> + static RevertedAliasesPtr getAliases ( const ASTColumnsMatcher & node ) { return node . semantic ? node . semantic - > aliases : nullptr ; } <nl> <nl> private : <nl> static std : : shared_ptr < AsteriskSemanticImpl > makeSemantic ( const RevertedAliasesPtr & aliases ) <nl> mmm a / dbms / src / Interpreters / PredicateExpressionsOptimizer . cpp <nl> ppp b / dbms / src / Interpreters / PredicateExpressionsOptimizer . cpp <nl> <nl> # include < Parsers / ASTTablesInSelectQuery . h > <nl> # include < Parsers / ASTAsterisk . h > <nl> # include < Parsers / ASTQualifiedAsterisk . h > <nl> - # include < Parsers / ASTColumnsClause . h > <nl> + # include < Parsers / ASTColumnsMatcher . h > <nl> # include < Parsers / queryToString . h > <nl> # include < Interpreters / Context . h > <nl> # include < Interpreters / ExpressionActions . h > <nl> ASTs PredicateExpressionsOptimizer : : getSelectQueryProjectionColumns ( ASTPtr & ast <nl> <nl> for ( const auto & projection_column : select_query - > select ( ) - > children ) <nl> { <nl> - if ( projection_column - > as < ASTAsterisk > ( ) | | projection_column - > as < ASTQualifiedAsterisk > ( ) | | projection_column - > as < ASTColumnsClause > ( ) ) <nl> + if ( projection_column - > as < ASTAsterisk > ( ) | | projection_column - > as < ASTQualifiedAsterisk > ( ) | | projection_column - > as < ASTColumnsMatcher > ( ) ) <nl> { <nl> ASTs evaluated_columns = evaluateAsterisk ( select_query , projection_column ) ; <nl> <nl> ASTs PredicateExpressionsOptimizer : : evaluateAsterisk ( ASTSelectQuery * select_que <nl> throw Exception ( " Logical error : unexpected table expression " , ErrorCodes : : LOGICAL_ERROR ) ; <nl> <nl> const auto block = storage - > getSampleBlock ( ) ; <nl> - if ( const auto * asterisk_pattern = asterisk - > as < ASTColumnsClause > ( ) ) <nl> + if ( const auto * asterisk_pattern = asterisk - > as < ASTColumnsMatcher > ( ) ) <nl> { <nl> for ( size_t idx = 0 ; idx < block . columns ( ) ; + + idx ) <nl> { <nl> mmm a / dbms / src / Interpreters / TranslateQualifiedNamesVisitor . cpp <nl> ppp b / dbms / src / Interpreters / TranslateQualifiedNamesVisitor . cpp <nl> <nl> # include < Parsers / ASTExpressionList . h > <nl> # include < Parsers / ASTLiteral . h > <nl> # include < Parsers / ASTFunction . h > <nl> - # include < Parsers / ASTColumnsClause . h > <nl> + # include < Parsers / ASTColumnsMatcher . h > <nl> <nl> <nl> namespace DB <nl> void TranslateQualifiedNamesMatcher : : visit ( ASTExpressionList & node , const ASTPt <nl> bool has_asterisk = false ; <nl> for ( const auto & child : node . children ) <nl> { <nl> - if ( child - > as < ASTAsterisk > ( ) | | child - > as < ASTColumnsClause > ( ) ) <nl> + if ( child - > as < ASTAsterisk > ( ) | | child - > as < ASTColumnsMatcher > ( ) ) <nl> { <nl> if ( tables_with_columns . empty ( ) ) <nl> throw Exception ( " An asterisk cannot be replaced with empty columns . " , ErrorCodes : : LOGICAL_ERROR ) ; <nl> void TranslateQualifiedNamesMatcher : : visit ( ASTExpressionList & node , const ASTPt <nl> first_table = false ; <nl> } <nl> } <nl> - else if ( const auto * asterisk_pattern = child - > as < ASTColumnsClause > ( ) ) <nl> + else if ( const auto * asterisk_pattern = child - > as < ASTColumnsMatcher > ( ) ) <nl> { <nl> bool first_table = true ; <nl> for ( const auto & [ table , table_columns ] : tables_with_columns ) <nl> similarity index 63 % <nl> rename from dbms / src / Parsers / ASTColumnsClause . cpp <nl> rename to dbms / src / Parsers / ASTColumnsMatcher . cpp <nl> mmm a / dbms / src / Parsers / ASTColumnsClause . cpp <nl> ppp b / dbms / src / Parsers / ASTColumnsMatcher . cpp <nl> <nl> - # include " ASTColumnsClause . h " <nl> + # include " ASTColumnsMatcher . h " <nl> <nl> # include < IO / WriteBuffer . h > <nl> # include < IO / WriteHelpers . h > <nl> <nl> namespace DB <nl> { <nl> <nl> - ASTPtr ASTColumnsClause : : clone ( ) const <nl> + ASTPtr ASTColumnsMatcher : : clone ( ) const <nl> { <nl> - auto clone = std : : make_shared < ASTColumnsClause > ( * this ) ; <nl> + auto clone = std : : make_shared < ASTColumnsMatcher > ( * this ) ; <nl> clone - > cloneChildren ( ) ; <nl> return clone ; <nl> } <nl> <nl> - void ASTColumnsClause : : appendColumnName ( WriteBuffer & ostr ) const { writeString ( original_pattern , ostr ) ; } <nl> + void ASTColumnsMatcher : : appendColumnName ( WriteBuffer & ostr ) const { writeString ( original_pattern , ostr ) ; } <nl> <nl> - void ASTColumnsClause : : formatImpl ( const FormatSettings & settings , FormatState & , FormatStateStacked ) const <nl> + void ASTColumnsMatcher : : formatImpl ( const FormatSettings & settings , FormatState & , FormatStateStacked ) const <nl> { <nl> WriteBufferFromOwnString pattern_quoted ; <nl> writeQuotedString ( original_pattern , pattern_quoted ) ; <nl> void ASTColumnsClause : : formatImpl ( const FormatSettings & settings , FormatState & <nl> settings . ostr < < ( settings . hilite ? hilite_keyword : " " ) < < " COLUMNS " < < ( settings . hilite ? hilite_none : " " ) < < " ( " < < pattern_quoted . str ( ) < < " ) " ; <nl> } <nl> <nl> - void ASTColumnsClause : : setPattern ( String pattern ) <nl> + void ASTColumnsMatcher : : setPattern ( String pattern ) <nl> { <nl> original_pattern = std : : move ( pattern ) ; <nl> column_matcher = std : : make_shared < RE2 > ( original_pattern , RE2 : : Quiet ) ; <nl> void ASTColumnsClause : : setPattern ( String pattern ) <nl> throw DB : : Exception ( " COLUMNS pattern " + original_pattern + " cannot be compiled : " + column_matcher - > error ( ) , DB : : ErrorCodes : : CANNOT_COMPILE_REGEXP ) ; <nl> } <nl> <nl> - bool ASTColumnsClause : : isColumnMatching ( const String & column_name ) const <nl> + bool ASTColumnsMatcher : : isColumnMatching ( const String & column_name ) const <nl> { <nl> return RE2 : : PartialMatch ( column_name , * column_matcher ) ; <nl> } <nl> similarity index 88 % <nl> rename from dbms / src / Parsers / ASTColumnsClause . h <nl> rename to dbms / src / Parsers / ASTColumnsMatcher . h <nl> mmm a / dbms / src / Parsers / ASTColumnsClause . h <nl> ppp b / dbms / src / Parsers / ASTColumnsMatcher . h <nl> struct AsteriskSemanticImpl ; <nl> <nl> / * * SELECT COLUMNS ( ' regexp ' ) is expanded to multiple columns like * ( asterisk ) . <nl> * / <nl> - class ASTColumnsClause : public IAST <nl> + class ASTColumnsMatcher : public IAST <nl> { <nl> public : <nl> - String getID ( char ) const override { return " ColumnsClause " ; } <nl> + String getID ( char ) const override { return " ColumnsMatcher " ; } <nl> ASTPtr clone ( ) const override ; <nl> <nl> void appendColumnName ( WriteBuffer & ostr ) const override ; <nl> mmm a / dbms / src / Parsers / ExpressionElementParsers . cpp <nl> ppp b / dbms / src / Parsers / ExpressionElementParsers . cpp <nl> <nl> <nl> # include < Parsers / queryToString . h > <nl> # include < boost / algorithm / string . hpp > <nl> - # include " ASTColumnsClause . h " <nl> + # include " ASTColumnsMatcher . h " <nl> <nl> <nl> namespace DB <nl> bool ParserAlias : : parseImpl ( Pos & pos , ASTPtr & node , Expected & expected ) <nl> } <nl> <nl> <nl> - bool ParserColumnsClause : : parseImpl ( Pos & pos , ASTPtr & node , Expected & expected ) <nl> + bool ParserColumnsMatcher : : parseImpl ( Pos & pos , ASTPtr & node , Expected & expected ) <nl> { <nl> ParserKeyword columns ( " COLUMNS " ) ; <nl> ParserStringLiteral regex ; <nl> bool ParserColumnsClause : : parseImpl ( Pos & pos , ASTPtr & node , Expected & expecte <nl> return false ; <nl> + + pos ; <nl> <nl> - auto res = std : : make_shared < ASTColumnsClause > ( ) ; <nl> + auto res = std : : make_shared < ASTColumnsMatcher > ( ) ; <nl> res - > setPattern ( regex_node - > as < ASTLiteral & > ( ) . value . get < String > ( ) ) ; <nl> res - > children . push_back ( regex_node ) ; <nl> node = std : : move ( res ) ; <nl> bool ParserExpressionElement : : parseImpl ( Pos & pos , ASTPtr & node , Expected & exp <nl> | | ParserLeftExpression ( ) . parse ( pos , node , expected ) <nl> | | ParserRightExpression ( ) . parse ( pos , node , expected ) <nl> | | ParserCase ( ) . parse ( pos , node , expected ) <nl> - | | ParserColumnsClause ( ) . parse ( pos , node , expected ) / / / before ParserFunction because it can be also parsed as a function . <nl> + | | ParserColumnsMatcher ( ) . parse ( pos , node , expected ) / / / before ParserFunction because it can be also parsed as a function . <nl> | | ParserFunction ( ) . parse ( pos , node , expected ) <nl> | | ParserQualifiedAsterisk ( ) . parse ( pos , node , expected ) <nl> | | ParserAsterisk ( ) . parse ( pos , node , expected ) <nl> mmm a / dbms / src / Parsers / ExpressionElementParsers . h <nl> ppp b / dbms / src / Parsers / ExpressionElementParsers . h <nl> class ParserQualifiedAsterisk : public IParserBase <nl> <nl> / * * COLUMNS ( ' < regular expression > ' ) <nl> * / <nl> - class ParserColumnsClause : public IParserBase <nl> + class ParserColumnsMatcher : public IParserBase <nl> { <nl> protected : <nl> const char * getName ( ) const { return " COLUMNS matcher " ; } <nl> | Rename files | ClickHouse/ClickHouse | fb0d09c5d359887c1e5687b83b024b01197c3466 | 2019-07-21T17:03:58Z |
mmm a / tensorflow / lite / delegates / gpu / gl / egl_context . cc <nl> ppp b / tensorflow / lite / delegates / gpu / gl / egl_context . cc <nl> limitations under the License . <nl> <nl> # include " tensorflow / lite / delegates / gpu / gl / egl_context . h " <nl> <nl> + # include < vector > <nl> + # include < cstring > <nl> + <nl> # include " tensorflow / lite / delegates / gpu / common / status . h " <nl> # include " tensorflow / lite / delegates / gpu / gl / gl_call . h " <nl> # include " tensorflow / lite / delegates / gpu / gl / gl_errors . h " <nl> mmm a / tensorflow / lite / delegates / gpu / gl / egl_context . h <nl> ppp b / tensorflow / lite / delegates / gpu / gl / egl_context . h <nl> limitations under the License . <nl> # ifndef TENSORFLOW_LITE_DELEGATES_GPU_GL_EGL_CONTEXT_H_ <nl> # define TENSORFLOW_LITE_DELEGATES_GPU_GL_EGL_CONTEXT_H_ <nl> <nl> - # include < vector > <nl> - # include < cstring > <nl> - <nl> # include " tensorflow / lite / delegates / gpu / common / status . h " <nl> # include " tensorflow / lite / delegates / gpu / gl / portable_egl . h " <nl> <nl> | Move include header to cc | tensorflow/tensorflow | 82477a6470f4d5dccd8074026bb84abc432e3b7c | 2019-04-04T11:11:49Z |
mmm a / PythonClient / build_api_docs . sh <nl> ppp b / PythonClient / build_api_docs . sh <nl> <nl> - cd docs ; <nl> - make html ; <nl> + # ! / bin / sh <nl> + <nl> + cd docs <nl> + make html <nl> | Update build_api_docs . sh script | microsoft/AirSim | 512d7082056a60d665aaece1d9de62b002284eac | 2020-12-17T11:13:56Z |
mmm a / cocos / scripting / lua - bindings / auto / api / ScrollView . lua <nl> ppp b / cocos / scripting / lua - bindings / auto / api / ScrollView . lua <nl> <nl> <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - - @ module ScrollView <nl> mmm @ extend Layout , ScrollViewProtocol <nl> + - - @ extend Layout <nl> <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - - @ function [ parent = # ScrollView ] scrollToTop <nl> mmm a / cocos / scripting / lua - bindings / auto / api / Widget . lua <nl> ppp b / cocos / scripting / lua - bindings / auto / api / Widget . lua <nl> <nl> - - @ module Widget <nl> - - @ extend ProtectedNode , LayoutParameterProtocol <nl> <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> mmm @ function [ parent = # Widget ] clone <nl> mmm @ param self <nl> mmm @ return Widget # Widget ret ( return value : ccui . Widget ) <nl> - <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - - @ function [ parent = # Widget ] setSizePercent <nl> - - @ param self <nl> <nl> - - @ return Node # Node ret ( return value : cc . Node ) <nl> <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> mmm @ function [ parent = # Widget ] getTouchEndPos <nl> + - - @ function [ parent = # Widget ] getSize <nl> - - @ param self <nl> mmm @ return vec2_table # vec2_table ret ( return value : vec2_table ) <nl> + - - @ return size_table # size_table ret ( return value : size_table ) <nl> <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - - @ function [ parent = # Widget ] setPositionPercent <nl> <nl> - - @ param self <nl> - - @ return LayoutParameter # LayoutParameter ret ( return value : ccui . LayoutParameter ) <nl> <nl> + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + - - @ function [ parent = # Widget ] findNextFocusedWidget <nl> + - - @ param self <nl> + - - @ param # ccui . Widget : : FocusDirection focusdirection <nl> + - - @ param # ccui . Widget widget <nl> + - - @ return Widget # Widget ret ( return value : ccui . Widget ) <nl> + <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - - @ function [ parent = # Widget ] getPositionType <nl> - - @ param self <nl> <nl> - - @ return bool # bool ret ( return value : bool ) <nl> <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> mmm @ function [ parent = # Widget ] findNextFocusedWidget <nl> + - - @ function [ parent = # Widget ] getTouchBeganPosition <nl> - - @ param self <nl> mmm @ param # ccui . Widget : : FocusDirection focusdirection <nl> mmm @ param # ccui . Widget widget <nl> mmm @ return Widget # Widget ret ( return value : ccui . Widget ) <nl> + - - @ return vec2_table # vec2_table ret ( return value : vec2_table ) <nl> <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - - @ function [ parent = # Widget ] isTouchEnabled <nl> <nl> - - @ param self <nl> - - @ param # bool bool <nl> <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> mmm @ function [ parent = # Widget ] getTouchMovePos <nl> mmm @ param self <nl> mmm @ return vec2_table # vec2_table ret ( return value : vec2_table ) <nl> - <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - - @ function [ parent = # Widget ] setEnabled <nl> - - @ param self <nl> <nl> - - @ param # ccui . LayoutParameter layoutparameter <nl> <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> mmm @ function [ parent = # Widget ] getSizePercent <nl> mmm @ param self <nl> mmm @ return vec2_table # vec2_table ret ( return value : vec2_table ) <nl> - <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> mmm @ function [ parent = # Widget ] getTouchStartPos <nl> + - - @ function [ parent = # Widget ] clone <nl> - - @ param self <nl> mmm @ return vec2_table # vec2_table ret ( return value : vec2_table ) <nl> + - - @ return Widget # Widget ret ( return value : ccui . Widget ) <nl> <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - - @ function [ parent = # Widget ] setFocusEnabled <nl> <nl> - - @ param self <nl> - - @ return bool # bool ret ( return value : bool ) <nl> <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm <nl> mmm @ function [ parent = # Widget ] clippingParentAreaContainPoint <nl> mmm @ param self <nl> mmm @ param # vec2_table vec2 <nl> mmm @ return bool # bool ret ( return value : bool ) <nl> - <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - - @ function [ parent = # Widget ] getCurrentFocusedWidget <nl> - - @ param self <nl> <nl> - - @ param # size_table size <nl> <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> mmm @ function [ parent = # Widget ] getSize <nl> + - - @ function [ parent = # Widget ] getSizePercent <nl> - - @ param self <nl> mmm @ return size_table # size_table ret ( return value : size_table ) <nl> + - - @ return vec2_table # vec2_table ret ( return value : vec2_table ) <nl> + <nl> + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + - - @ function [ parent = # Widget ] getTouchMovePosition <nl> + - - @ param self <nl> + - - @ return vec2_table # vec2_table ret ( return value : vec2_table ) <nl> <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - - @ function [ parent = # Widget ] getSizeType <nl> <nl> - - @ param # bool bool <nl> <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> mmm @ function [ parent = # Widget ] interceptTouchEvent <nl> + - - @ function [ parent = # Widget ] addTouchEventListener <nl> - - @ param self <nl> mmm @ param # ccui . Widget : : TouchEventType toucheventtype <nl> mmm @ param # ccui . Widget widget <nl> mmm @ param # vec2_table vec2 <nl> + - - @ param # function func <nl> <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> mmm @ function [ parent = # Widget ] addTouchEventListener <nl> + - - @ function [ parent = # Widget ] getTouchEndPosition <nl> - - @ param self <nl> mmm @ param # function func <nl> + - - @ return vec2_table # vec2_table ret ( return value : vec2_table ) <nl> <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - - @ function [ parent = # Widget ] getPositionPercent <nl> <nl> - - @ param self <nl> - - @ return bool # bool ret ( return value : bool ) <nl> <nl> + mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> + - - @ function [ parent = # Widget ] isClippingParentContainsPoint <nl> + - - @ param self <nl> + - - @ param # vec2_table vec2 <nl> + - - @ return bool # bool ret ( return value : bool ) <nl> + <nl> mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - <nl> - - @ function [ parent = # Widget ] setSizeType <nl> - - @ param self <nl> mmm a / cocos / scripting / lua - bindings / auto / lua_cocos2dx_ui_auto . cpp <nl> ppp b / cocos / scripting / lua - bindings / auto / lua_cocos2dx_ui_auto . cpp <nl> int lua_register_cocos2dx_ui_RelativeLayoutParameter ( lua_State * tolua_S ) <nl> return 1 ; <nl> } <nl> <nl> - int lua_cocos2dx_ui_Widget_clone ( lua_State * tolua_S ) <nl> - { <nl> - int argc = 0 ; <nl> - cocos2d : : ui : : Widget * cobj = nullptr ; <nl> - bool ok = true ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - tolua_Error tolua_err ; <nl> - # endif <nl> - <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - if ( ! tolua_isusertype ( tolua_S , 1 , " ccui . Widget " , 0 , & tolua_err ) ) goto tolua_lerror ; <nl> - # endif <nl> - <nl> - cobj = ( cocos2d : : ui : : Widget * ) tolua_tousertype ( tolua_S , 1 , 0 ) ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - if ( ! cobj ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_Widget_clone ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - # endif <nl> - <nl> - argc = lua_gettop ( tolua_S ) - 1 ; <nl> - if ( argc = = 0 ) <nl> - { <nl> - if ( ! ok ) <nl> - return 0 ; <nl> - cocos2d : : ui : : Widget * ret = cobj - > clone ( ) ; <nl> - object_to_luaval < cocos2d : : ui : : Widget > ( tolua_S , " ccui . Widget " , ( cocos2d : : ui : : Widget * ) ret ) ; <nl> - return 1 ; <nl> - } <nl> - CCLOG ( " % s has wrong number of arguments : % d , was expecting % d \ n " , " clone " , argc , 0 ) ; <nl> - return 0 ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - tolua_lerror : <nl> - tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_Widget_clone ' . " , & tolua_err ) ; <nl> - # endif <nl> - <nl> - return 0 ; <nl> - } <nl> int lua_cocos2dx_ui_Widget_setSizePercent ( lua_State * tolua_S ) <nl> { <nl> int argc = 0 ; <nl> int lua_cocos2dx_ui_Widget_getVirtualRenderer ( lua_State * tolua_S ) <nl> <nl> return 0 ; <nl> } <nl> - int lua_cocos2dx_ui_Widget_getTouchEndPos ( lua_State * tolua_S ) <nl> + int lua_cocos2dx_ui_Widget_getSize ( lua_State * tolua_S ) <nl> { <nl> int argc = 0 ; <nl> cocos2d : : ui : : Widget * cobj = nullptr ; <nl> int lua_cocos2dx_ui_Widget_getTouchEndPos ( lua_State * tolua_S ) <nl> # if COCOS2D_DEBUG > = 1 <nl> if ( ! cobj ) <nl> { <nl> - tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_Widget_getTouchEndPos ' " , nullptr ) ; <nl> + tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_Widget_getSize ' " , nullptr ) ; <nl> return 0 ; <nl> } <nl> # endif <nl> int lua_cocos2dx_ui_Widget_getTouchEndPos ( lua_State * tolua_S ) <nl> { <nl> if ( ! ok ) <nl> return 0 ; <nl> - const cocos2d : : Vec2 & ret = cobj - > getTouchEndPos ( ) ; <nl> - vec2_to_luaval ( tolua_S , ret ) ; <nl> + const cocos2d : : Size & ret = cobj - > getSize ( ) ; <nl> + size_to_luaval ( tolua_S , ret ) ; <nl> return 1 ; <nl> } <nl> - CCLOG ( " % s has wrong number of arguments : % d , was expecting % d \ n " , " getTouchEndPos " , argc , 0 ) ; <nl> + CCLOG ( " % s has wrong number of arguments : % d , was expecting % d \ n " , " getSize " , argc , 0 ) ; <nl> return 0 ; <nl> <nl> # if COCOS2D_DEBUG > = 1 <nl> tolua_lerror : <nl> - tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_Widget_getTouchEndPos ' . " , & tolua_err ) ; <nl> + tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_Widget_getSize ' . " , & tolua_err ) ; <nl> # endif <nl> <nl> return 0 ; <nl> int lua_cocos2dx_ui_Widget_getLayoutParameter ( lua_State * tolua_S ) <nl> <nl> return 0 ; <nl> } <nl> + int lua_cocos2dx_ui_Widget_findNextFocusedWidget ( lua_State * tolua_S ) <nl> + { <nl> + int argc = 0 ; <nl> + cocos2d : : ui : : Widget * cobj = nullptr ; <nl> + bool ok = true ; <nl> + <nl> + # if COCOS2D_DEBUG > = 1 <nl> + tolua_Error tolua_err ; <nl> + # endif <nl> + <nl> + <nl> + # if COCOS2D_DEBUG > = 1 <nl> + if ( ! tolua_isusertype ( tolua_S , 1 , " ccui . Widget " , 0 , & tolua_err ) ) goto tolua_lerror ; <nl> + # endif <nl> + <nl> + cobj = ( cocos2d : : ui : : Widget * ) tolua_tousertype ( tolua_S , 1 , 0 ) ; <nl> + <nl> + # if COCOS2D_DEBUG > = 1 <nl> + if ( ! cobj ) <nl> + { <nl> + tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_Widget_findNextFocusedWidget ' " , nullptr ) ; <nl> + return 0 ; <nl> + } <nl> + # endif <nl> + <nl> + argc = lua_gettop ( tolua_S ) - 1 ; <nl> + if ( argc = = 2 ) <nl> + { <nl> + cocos2d : : ui : : Widget : : FocusDirection arg0 ; <nl> + cocos2d : : ui : : Widget * arg1 ; <nl> + <nl> + ok & = luaval_to_int32 ( tolua_S , 2 , ( int * ) & arg0 ) ; <nl> + <nl> + ok & = luaval_to_object < cocos2d : : ui : : Widget > ( tolua_S , 3 , " ccui . Widget " , & arg1 ) ; <nl> + if ( ! ok ) <nl> + return 0 ; <nl> + cocos2d : : ui : : Widget * ret = cobj - > findNextFocusedWidget ( arg0 , arg1 ) ; <nl> + object_to_luaval < cocos2d : : ui : : Widget > ( tolua_S , " ccui . Widget " , ( cocos2d : : ui : : Widget * ) ret ) ; <nl> + return 1 ; <nl> + } <nl> + CCLOG ( " % s has wrong number of arguments : % d , was expecting % d \ n " , " findNextFocusedWidget " , argc , 2 ) ; <nl> + return 0 ; <nl> + <nl> + # if COCOS2D_DEBUG > = 1 <nl> + tolua_lerror : <nl> + tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_Widget_findNextFocusedWidget ' . " , & tolua_err ) ; <nl> + # endif <nl> + <nl> + return 0 ; <nl> + } <nl> int lua_cocos2dx_ui_Widget_getPositionType ( lua_State * tolua_S ) <nl> { <nl> int argc = 0 ; <nl> int lua_cocos2dx_ui_Widget_isFocused ( lua_State * tolua_S ) <nl> <nl> return 0 ; <nl> } <nl> - int lua_cocos2dx_ui_Widget_findNextFocusedWidget ( lua_State * tolua_S ) <nl> + int lua_cocos2dx_ui_Widget_getTouchBeganPosition ( lua_State * tolua_S ) <nl> { <nl> int argc = 0 ; <nl> cocos2d : : ui : : Widget * cobj = nullptr ; <nl> int lua_cocos2dx_ui_Widget_findNextFocusedWidget ( lua_State * tolua_S ) <nl> # if COCOS2D_DEBUG > = 1 <nl> if ( ! cobj ) <nl> { <nl> - tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_Widget_findNextFocusedWidget ' " , nullptr ) ; <nl> + tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_Widget_getTouchBeganPosition ' " , nullptr ) ; <nl> return 0 ; <nl> } <nl> # endif <nl> <nl> argc = lua_gettop ( tolua_S ) - 1 ; <nl> - if ( argc = = 2 ) <nl> + if ( argc = = 0 ) <nl> { <nl> - cocos2d : : ui : : Widget : : FocusDirection arg0 ; <nl> - cocos2d : : ui : : Widget * arg1 ; <nl> - <nl> - ok & = luaval_to_int32 ( tolua_S , 2 , ( int * ) & arg0 ) ; <nl> - <nl> - ok & = luaval_to_object < cocos2d : : ui : : Widget > ( tolua_S , 3 , " ccui . Widget " , & arg1 ) ; <nl> if ( ! ok ) <nl> return 0 ; <nl> - cocos2d : : ui : : Widget * ret = cobj - > findNextFocusedWidget ( arg0 , arg1 ) ; <nl> - object_to_luaval < cocos2d : : ui : : Widget > ( tolua_S , " ccui . Widget " , ( cocos2d : : ui : : Widget * ) ret ) ; <nl> + const cocos2d : : Vec2 & ret = cobj - > getTouchBeganPosition ( ) ; <nl> + vec2_to_luaval ( tolua_S , ret ) ; <nl> return 1 ; <nl> } <nl> - CCLOG ( " % s has wrong number of arguments : % d , was expecting % d \ n " , " findNextFocusedWidget " , argc , 2 ) ; <nl> + CCLOG ( " % s has wrong number of arguments : % d , was expecting % d \ n " , " getTouchBeganPosition " , argc , 0 ) ; <nl> return 0 ; <nl> <nl> # if COCOS2D_DEBUG > = 1 <nl> tolua_lerror : <nl> - tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_Widget_findNextFocusedWidget ' . " , & tolua_err ) ; <nl> + tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_Widget_getTouchBeganPosition ' . " , & tolua_err ) ; <nl> # endif <nl> <nl> return 0 ; <nl> int lua_cocos2dx_ui_Widget_setFlippedY ( lua_State * tolua_S ) <nl> <nl> return 0 ; <nl> } <nl> - int lua_cocos2dx_ui_Widget_getTouchMovePos ( lua_State * tolua_S ) <nl> - { <nl> - int argc = 0 ; <nl> - cocos2d : : ui : : Widget * cobj = nullptr ; <nl> - bool ok = true ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - tolua_Error tolua_err ; <nl> - # endif <nl> - <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - if ( ! tolua_isusertype ( tolua_S , 1 , " ccui . Widget " , 0 , & tolua_err ) ) goto tolua_lerror ; <nl> - # endif <nl> - <nl> - cobj = ( cocos2d : : ui : : Widget * ) tolua_tousertype ( tolua_S , 1 , 0 ) ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - if ( ! cobj ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_Widget_getTouchMovePos ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - # endif <nl> - <nl> - argc = lua_gettop ( tolua_S ) - 1 ; <nl> - if ( argc = = 0 ) <nl> - { <nl> - if ( ! ok ) <nl> - return 0 ; <nl> - const cocos2d : : Vec2 & ret = cobj - > getTouchMovePos ( ) ; <nl> - vec2_to_luaval ( tolua_S , ret ) ; <nl> - return 1 ; <nl> - } <nl> - CCLOG ( " % s has wrong number of arguments : % d , was expecting % d \ n " , " getTouchMovePos " , argc , 0 ) ; <nl> - return 0 ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - tolua_lerror : <nl> - tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_Widget_getTouchMovePos ' . " , & tolua_err ) ; <nl> - # endif <nl> - <nl> - return 0 ; <nl> - } <nl> int lua_cocos2dx_ui_Widget_setEnabled ( lua_State * tolua_S ) <nl> { <nl> int argc = 0 ; <nl> int lua_cocos2dx_ui_Widget_setLayoutParameter ( lua_State * tolua_S ) <nl> <nl> return 0 ; <nl> } <nl> - int lua_cocos2dx_ui_Widget_getSizePercent ( lua_State * tolua_S ) <nl> - { <nl> - int argc = 0 ; <nl> - cocos2d : : ui : : Widget * cobj = nullptr ; <nl> - bool ok = true ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - tolua_Error tolua_err ; <nl> - # endif <nl> - <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - if ( ! tolua_isusertype ( tolua_S , 1 , " ccui . Widget " , 0 , & tolua_err ) ) goto tolua_lerror ; <nl> - # endif <nl> - <nl> - cobj = ( cocos2d : : ui : : Widget * ) tolua_tousertype ( tolua_S , 1 , 0 ) ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - if ( ! cobj ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_Widget_getSizePercent ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - # endif <nl> - <nl> - argc = lua_gettop ( tolua_S ) - 1 ; <nl> - if ( argc = = 0 ) <nl> - { <nl> - if ( ! ok ) <nl> - return 0 ; <nl> - const cocos2d : : Vec2 & ret = cobj - > getSizePercent ( ) ; <nl> - vec2_to_luaval ( tolua_S , ret ) ; <nl> - return 1 ; <nl> - } <nl> - CCLOG ( " % s has wrong number of arguments : % d , was expecting % d \ n " , " getSizePercent " , argc , 0 ) ; <nl> - return 0 ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - tolua_lerror : <nl> - tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_Widget_getSizePercent ' . " , & tolua_err ) ; <nl> - # endif <nl> - <nl> - return 0 ; <nl> - } <nl> - int lua_cocos2dx_ui_Widget_getTouchStartPos ( lua_State * tolua_S ) <nl> + int lua_cocos2dx_ui_Widget_clone ( lua_State * tolua_S ) <nl> { <nl> int argc = 0 ; <nl> cocos2d : : ui : : Widget * cobj = nullptr ; <nl> int lua_cocos2dx_ui_Widget_getTouchStartPos ( lua_State * tolua_S ) <nl> # if COCOS2D_DEBUG > = 1 <nl> if ( ! cobj ) <nl> { <nl> - tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_Widget_getTouchStartPos ' " , nullptr ) ; <nl> + tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_Widget_clone ' " , nullptr ) ; <nl> return 0 ; <nl> } <nl> # endif <nl> int lua_cocos2dx_ui_Widget_getTouchStartPos ( lua_State * tolua_S ) <nl> { <nl> if ( ! ok ) <nl> return 0 ; <nl> - const cocos2d : : Vec2 & ret = cobj - > getTouchStartPos ( ) ; <nl> - vec2_to_luaval ( tolua_S , ret ) ; <nl> + cocos2d : : ui : : Widget * ret = cobj - > clone ( ) ; <nl> + object_to_luaval < cocos2d : : ui : : Widget > ( tolua_S , " ccui . Widget " , ( cocos2d : : ui : : Widget * ) ret ) ; <nl> return 1 ; <nl> } <nl> - CCLOG ( " % s has wrong number of arguments : % d , was expecting % d \ n " , " getTouchStartPos " , argc , 0 ) ; <nl> + CCLOG ( " % s has wrong number of arguments : % d , was expecting % d \ n " , " clone " , argc , 0 ) ; <nl> return 0 ; <nl> <nl> # if COCOS2D_DEBUG > = 1 <nl> tolua_lerror : <nl> - tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_Widget_getTouchStartPos ' . " , & tolua_err ) ; <nl> + tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_Widget_clone ' . " , & tolua_err ) ; <nl> # endif <nl> <nl> return 0 ; <nl> int lua_cocos2dx_ui_Widget_isBright ( lua_State * tolua_S ) <nl> <nl> return 0 ; <nl> } <nl> - int lua_cocos2dx_ui_Widget_clippingParentAreaContainPoint ( lua_State * tolua_S ) <nl> - { <nl> - int argc = 0 ; <nl> - cocos2d : : ui : : Widget * cobj = nullptr ; <nl> - bool ok = true ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - tolua_Error tolua_err ; <nl> - # endif <nl> - <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - if ( ! tolua_isusertype ( tolua_S , 1 , " ccui . Widget " , 0 , & tolua_err ) ) goto tolua_lerror ; <nl> - # endif <nl> - <nl> - cobj = ( cocos2d : : ui : : Widget * ) tolua_tousertype ( tolua_S , 1 , 0 ) ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - if ( ! cobj ) <nl> - { <nl> - tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_Widget_clippingParentAreaContainPoint ' " , nullptr ) ; <nl> - return 0 ; <nl> - } <nl> - # endif <nl> - <nl> - argc = lua_gettop ( tolua_S ) - 1 ; <nl> - if ( argc = = 1 ) <nl> - { <nl> - cocos2d : : Vec2 arg0 ; <nl> - <nl> - ok & = luaval_to_vec2 ( tolua_S , 2 , & arg0 ) ; <nl> - if ( ! ok ) <nl> - return 0 ; <nl> - bool ret = cobj - > clippingParentAreaContainPoint ( arg0 ) ; <nl> - tolua_pushboolean ( tolua_S , ( bool ) ret ) ; <nl> - return 1 ; <nl> - } <nl> - CCLOG ( " % s has wrong number of arguments : % d , was expecting % d \ n " , " clippingParentAreaContainPoint " , argc , 1 ) ; <nl> - return 0 ; <nl> - <nl> - # if COCOS2D_DEBUG > = 1 <nl> - tolua_lerror : <nl> - tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_Widget_clippingParentAreaContainPoint ' . " , & tolua_err ) ; <nl> - # endif <nl> - <nl> - return 0 ; <nl> - } <nl> int lua_cocos2dx_ui_Widget_getCurrentFocusedWidget ( lua_State * tolua_S ) <nl> { <nl> int argc = 0 ; <nl> int lua_cocos2dx_ui_Widget_updateSizeAndPosition ( lua_State * tolua_S ) <nl> <nl> return 0 ; <nl> } <nl> - int lua_cocos2dx_ui_Widget_getSize ( lua_State * tolua_S ) <nl> + int lua_cocos2dx_ui_Widget_getSizePercent ( lua_State * tolua_S ) <nl> { <nl> int argc = 0 ; <nl> cocos2d : : ui : : Widget * cobj = nullptr ; <nl> int lua_cocos2dx_ui_Widget_getSize ( lua_State * tolua_S ) <nl> # if COCOS2D_DEBUG > = 1 <nl> if ( ! cobj ) <nl> { <nl> - tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_Widget_getSize ' " , nullptr ) ; <nl> + tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_Widget_getSizePercent ' " , nullptr ) ; <nl> return 0 ; <nl> } <nl> # endif <nl> int lua_cocos2dx_ui_Widget_getSize ( lua_State * tolua_S ) <nl> { <nl> if ( ! ok ) <nl> return 0 ; <nl> - const cocos2d : : Size & ret = cobj - > getSize ( ) ; <nl> - size_to_luaval ( tolua_S , ret ) ; <nl> + const cocos2d : : Vec2 & ret = cobj - > getSizePercent ( ) ; <nl> + vec2_to_luaval ( tolua_S , ret ) ; <nl> return 1 ; <nl> } <nl> - CCLOG ( " % s has wrong number of arguments : % d , was expecting % d \ n " , " getSize " , argc , 0 ) ; <nl> + CCLOG ( " % s has wrong number of arguments : % d , was expecting % d \ n " , " getSizePercent " , argc , 0 ) ; <nl> return 0 ; <nl> <nl> # if COCOS2D_DEBUG > = 1 <nl> tolua_lerror : <nl> - tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_Widget_getSize ' . " , & tolua_err ) ; <nl> + tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_Widget_getSizePercent ' . " , & tolua_err ) ; <nl> + # endif <nl> + <nl> + return 0 ; <nl> + } <nl> + int lua_cocos2dx_ui_Widget_getTouchMovePosition ( lua_State * tolua_S ) <nl> + { <nl> + int argc = 0 ; <nl> + cocos2d : : ui : : Widget * cobj = nullptr ; <nl> + bool ok = true ; <nl> + <nl> + # if COCOS2D_DEBUG > = 1 <nl> + tolua_Error tolua_err ; <nl> + # endif <nl> + <nl> + <nl> + # if COCOS2D_DEBUG > = 1 <nl> + if ( ! tolua_isusertype ( tolua_S , 1 , " ccui . Widget " , 0 , & tolua_err ) ) goto tolua_lerror ; <nl> + # endif <nl> + <nl> + cobj = ( cocos2d : : ui : : Widget * ) tolua_tousertype ( tolua_S , 1 , 0 ) ; <nl> + <nl> + # if COCOS2D_DEBUG > = 1 <nl> + if ( ! cobj ) <nl> + { <nl> + tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_Widget_getTouchMovePosition ' " , nullptr ) ; <nl> + return 0 ; <nl> + } <nl> + # endif <nl> + <nl> + argc = lua_gettop ( tolua_S ) - 1 ; <nl> + if ( argc = = 0 ) <nl> + { <nl> + if ( ! ok ) <nl> + return 0 ; <nl> + const cocos2d : : Vec2 & ret = cobj - > getTouchMovePosition ( ) ; <nl> + vec2_to_luaval ( tolua_S , ret ) ; <nl> + return 1 ; <nl> + } <nl> + CCLOG ( " % s has wrong number of arguments : % d , was expecting % d \ n " , " getTouchMovePosition " , argc , 0 ) ; <nl> + return 0 ; <nl> + <nl> + # if COCOS2D_DEBUG > = 1 <nl> + tolua_lerror : <nl> + tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_Widget_getTouchMovePosition ' . " , & tolua_err ) ; <nl> # endif <nl> <nl> return 0 ; <nl> int lua_cocos2dx_ui_Widget_ignoreContentAdaptWithSize ( lua_State * tolua_S ) <nl> <nl> return 0 ; <nl> } <nl> - int lua_cocos2dx_ui_Widget_interceptTouchEvent ( lua_State * tolua_S ) <nl> + int lua_cocos2dx_ui_Widget_addTouchEventListener ( lua_State * tolua_S ) <nl> { <nl> int argc = 0 ; <nl> cocos2d : : ui : : Widget * cobj = nullptr ; <nl> int lua_cocos2dx_ui_Widget_interceptTouchEvent ( lua_State * tolua_S ) <nl> # if COCOS2D_DEBUG > = 1 <nl> if ( ! cobj ) <nl> { <nl> - tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_Widget_interceptTouchEvent ' " , nullptr ) ; <nl> + tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_Widget_addTouchEventListener ' " , nullptr ) ; <nl> return 0 ; <nl> } <nl> # endif <nl> <nl> argc = lua_gettop ( tolua_S ) - 1 ; <nl> - if ( argc = = 3 ) <nl> + if ( argc = = 1 ) <nl> { <nl> - cocos2d : : ui : : Widget : : TouchEventType arg0 ; <nl> - cocos2d : : ui : : Widget * arg1 ; <nl> - cocos2d : : Vec2 arg2 ; <nl> - <nl> - ok & = luaval_to_int32 ( tolua_S , 2 , ( int * ) & arg0 ) ; <nl> - <nl> - ok & = luaval_to_object < cocos2d : : ui : : Widget > ( tolua_S , 3 , " ccui . Widget " , & arg1 ) ; <nl> + std : : function < void ( cocos2d : : Ref * , cocos2d : : ui : : Widget : : TouchEventType ) > arg0 ; <nl> <nl> - ok & = luaval_to_vec2 ( tolua_S , 4 , & arg2 ) ; <nl> + do { <nl> + / / Lambda binding for lua is not supported . <nl> + assert ( false ) ; <nl> + } while ( 0 ) <nl> + ; <nl> if ( ! ok ) <nl> return 0 ; <nl> - cobj - > interceptTouchEvent ( arg0 , arg1 , arg2 ) ; <nl> + cobj - > addTouchEventListener ( arg0 ) ; <nl> return 0 ; <nl> } <nl> - CCLOG ( " % s has wrong number of arguments : % d , was expecting % d \ n " , " interceptTouchEvent " , argc , 3 ) ; <nl> + CCLOG ( " % s has wrong number of arguments : % d , was expecting % d \ n " , " addTouchEventListener " , argc , 1 ) ; <nl> return 0 ; <nl> <nl> # if COCOS2D_DEBUG > = 1 <nl> tolua_lerror : <nl> - tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_Widget_interceptTouchEvent ' . " , & tolua_err ) ; <nl> + tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_Widget_addTouchEventListener ' . " , & tolua_err ) ; <nl> # endif <nl> <nl> return 0 ; <nl> } <nl> - int lua_cocos2dx_ui_Widget_addTouchEventListener ( lua_State * tolua_S ) <nl> + int lua_cocos2dx_ui_Widget_getTouchEndPosition ( lua_State * tolua_S ) <nl> { <nl> int argc = 0 ; <nl> cocos2d : : ui : : Widget * cobj = nullptr ; <nl> int lua_cocos2dx_ui_Widget_addTouchEventListener ( lua_State * tolua_S ) <nl> # if COCOS2D_DEBUG > = 1 <nl> if ( ! cobj ) <nl> { <nl> - tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_Widget_addTouchEventListener ' " , nullptr ) ; <nl> + tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_Widget_getTouchEndPosition ' " , nullptr ) ; <nl> return 0 ; <nl> } <nl> # endif <nl> <nl> argc = lua_gettop ( tolua_S ) - 1 ; <nl> - if ( argc = = 1 ) <nl> + if ( argc = = 0 ) <nl> { <nl> - std : : function < void ( cocos2d : : Ref * , cocos2d : : ui : : Widget : : TouchEventType ) > arg0 ; <nl> - <nl> - do { <nl> - / / Lambda binding for lua is not supported . <nl> - assert ( false ) ; <nl> - } while ( 0 ) <nl> - ; <nl> if ( ! ok ) <nl> return 0 ; <nl> - cobj - > addTouchEventListener ( arg0 ) ; <nl> - return 0 ; <nl> + const cocos2d : : Vec2 & ret = cobj - > getTouchEndPosition ( ) ; <nl> + vec2_to_luaval ( tolua_S , ret ) ; <nl> + return 1 ; <nl> } <nl> - CCLOG ( " % s has wrong number of arguments : % d , was expecting % d \ n " , " addTouchEventListener " , argc , 1 ) ; <nl> + CCLOG ( " % s has wrong number of arguments : % d , was expecting % d \ n " , " getTouchEndPosition " , argc , 0 ) ; <nl> return 0 ; <nl> <nl> # if COCOS2D_DEBUG > = 1 <nl> tolua_lerror : <nl> - tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_Widget_addTouchEventListener ' . " , & tolua_err ) ; <nl> + tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_Widget_getTouchEndPosition ' . " , & tolua_err ) ; <nl> # endif <nl> <nl> return 0 ; <nl> int lua_cocos2dx_ui_Widget_isFlippedY ( lua_State * tolua_S ) <nl> <nl> return 0 ; <nl> } <nl> + int lua_cocos2dx_ui_Widget_isClippingParentContainsPoint ( lua_State * tolua_S ) <nl> + { <nl> + int argc = 0 ; <nl> + cocos2d : : ui : : Widget * cobj = nullptr ; <nl> + bool ok = true ; <nl> + <nl> + # if COCOS2D_DEBUG > = 1 <nl> + tolua_Error tolua_err ; <nl> + # endif <nl> + <nl> + <nl> + # if COCOS2D_DEBUG > = 1 <nl> + if ( ! tolua_isusertype ( tolua_S , 1 , " ccui . Widget " , 0 , & tolua_err ) ) goto tolua_lerror ; <nl> + # endif <nl> + <nl> + cobj = ( cocos2d : : ui : : Widget * ) tolua_tousertype ( tolua_S , 1 , 0 ) ; <nl> + <nl> + # if COCOS2D_DEBUG > = 1 <nl> + if ( ! cobj ) <nl> + { <nl> + tolua_error ( tolua_S , " invalid ' cobj ' in function ' lua_cocos2dx_ui_Widget_isClippingParentContainsPoint ' " , nullptr ) ; <nl> + return 0 ; <nl> + } <nl> + # endif <nl> + <nl> + argc = lua_gettop ( tolua_S ) - 1 ; <nl> + if ( argc = = 1 ) <nl> + { <nl> + cocos2d : : Vec2 arg0 ; <nl> + <nl> + ok & = luaval_to_vec2 ( tolua_S , 2 , & arg0 ) ; <nl> + if ( ! ok ) <nl> + return 0 ; <nl> + bool ret = cobj - > isClippingParentContainsPoint ( arg0 ) ; <nl> + tolua_pushboolean ( tolua_S , ( bool ) ret ) ; <nl> + return 1 ; <nl> + } <nl> + CCLOG ( " % s has wrong number of arguments : % d , was expecting % d \ n " , " isClippingParentContainsPoint " , argc , 1 ) ; <nl> + return 0 ; <nl> + <nl> + # if COCOS2D_DEBUG > = 1 <nl> + tolua_lerror : <nl> + tolua_error ( tolua_S , " # ferror in function ' lua_cocos2dx_ui_Widget_isClippingParentContainsPoint ' . " , & tolua_err ) ; <nl> + # endif <nl> + <nl> + return 0 ; <nl> + } <nl> int lua_cocos2dx_ui_Widget_setSizeType ( lua_State * tolua_S ) <nl> { <nl> int argc = 0 ; <nl> int lua_register_cocos2dx_ui_Widget ( lua_State * tolua_S ) <nl> <nl> tolua_beginmodule ( tolua_S , " Widget " ) ; <nl> tolua_function ( tolua_S , " new " , lua_cocos2dx_ui_Widget_constructor ) ; <nl> - tolua_function ( tolua_S , " clone " , lua_cocos2dx_ui_Widget_clone ) ; <nl> tolua_function ( tolua_S , " setSizePercent " , lua_cocos2dx_ui_Widget_setSizePercent ) ; <nl> tolua_function ( tolua_S , " getCustomSize " , lua_cocos2dx_ui_Widget_getCustomSize ) ; <nl> tolua_function ( tolua_S , " getLeftBoundary " , lua_cocos2dx_ui_Widget_getLeftBoundary ) ; <nl> tolua_function ( tolua_S , " setFlippedX " , lua_cocos2dx_ui_Widget_setFlippedX ) ; <nl> tolua_function ( tolua_S , " getVirtualRenderer " , lua_cocos2dx_ui_Widget_getVirtualRenderer ) ; <nl> - tolua_function ( tolua_S , " getTouchEndPos " , lua_cocos2dx_ui_Widget_getTouchEndPos ) ; <nl> + tolua_function ( tolua_S , " getSize " , lua_cocos2dx_ui_Widget_getSize ) ; <nl> tolua_function ( tolua_S , " setPositionPercent " , lua_cocos2dx_ui_Widget_setPositionPercent ) ; <nl> tolua_function ( tolua_S , " getLayoutSize " , lua_cocos2dx_ui_Widget_getLayoutSize ) ; <nl> tolua_function ( tolua_S , " setHighlighted " , lua_cocos2dx_ui_Widget_setHighlighted ) ; <nl> int lua_register_cocos2dx_ui_Widget ( lua_State * tolua_S ) <nl> tolua_function ( tolua_S , " getVirtualRendererSize " , lua_cocos2dx_ui_Widget_getVirtualRendererSize ) ; <nl> tolua_function ( tolua_S , " isHighlighted " , lua_cocos2dx_ui_Widget_isHighlighted ) ; <nl> tolua_function ( tolua_S , " getLayoutParameter " , lua_cocos2dx_ui_Widget_getLayoutParameter ) ; <nl> + tolua_function ( tolua_S , " findNextFocusedWidget " , lua_cocos2dx_ui_Widget_findNextFocusedWidget ) ; <nl> tolua_function ( tolua_S , " getPositionType " , lua_cocos2dx_ui_Widget_getPositionType ) ; <nl> tolua_function ( tolua_S , " getTopBoundary " , lua_cocos2dx_ui_Widget_getTopBoundary ) ; <nl> tolua_function ( tolua_S , " getChildByName " , lua_cocos2dx_ui_Widget_getChildByName ) ; <nl> tolua_function ( tolua_S , " isEnabled " , lua_cocos2dx_ui_Widget_isEnabled ) ; <nl> tolua_function ( tolua_S , " isFocused " , lua_cocos2dx_ui_Widget_isFocused ) ; <nl> - tolua_function ( tolua_S , " findNextFocusedWidget " , lua_cocos2dx_ui_Widget_findNextFocusedWidget ) ; <nl> + tolua_function ( tolua_S , " getTouchBeganPosition " , lua_cocos2dx_ui_Widget_getTouchBeganPosition ) ; <nl> tolua_function ( tolua_S , " isTouchEnabled " , lua_cocos2dx_ui_Widget_isTouchEnabled ) ; <nl> tolua_function ( tolua_S , " getActionTag " , lua_cocos2dx_ui_Widget_getActionTag ) ; <nl> tolua_function ( tolua_S , " getWorldPosition " , lua_cocos2dx_ui_Widget_getWorldPosition ) ; <nl> int lua_register_cocos2dx_ui_Widget ( lua_State * tolua_S ) <nl> tolua_function ( tolua_S , " setActionTag " , lua_cocos2dx_ui_Widget_setActionTag ) ; <nl> tolua_function ( tolua_S , " setTouchEnabled " , lua_cocos2dx_ui_Widget_setTouchEnabled ) ; <nl> tolua_function ( tolua_S , " setFlippedY " , lua_cocos2dx_ui_Widget_setFlippedY ) ; <nl> - tolua_function ( tolua_S , " getTouchMovePos " , lua_cocos2dx_ui_Widget_getTouchMovePos ) ; <nl> tolua_function ( tolua_S , " setEnabled " , lua_cocos2dx_ui_Widget_setEnabled ) ; <nl> tolua_function ( tolua_S , " getRightBoundary " , lua_cocos2dx_ui_Widget_getRightBoundary ) ; <nl> tolua_function ( tolua_S , " setBrightStyle " , lua_cocos2dx_ui_Widget_setBrightStyle ) ; <nl> tolua_function ( tolua_S , " setName " , lua_cocos2dx_ui_Widget_setName ) ; <nl> tolua_function ( tolua_S , " setLayoutParameter " , lua_cocos2dx_ui_Widget_setLayoutParameter ) ; <nl> - tolua_function ( tolua_S , " getSizePercent " , lua_cocos2dx_ui_Widget_getSizePercent ) ; <nl> - tolua_function ( tolua_S , " getTouchStartPos " , lua_cocos2dx_ui_Widget_getTouchStartPos ) ; <nl> + tolua_function ( tolua_S , " clone " , lua_cocos2dx_ui_Widget_clone ) ; <nl> tolua_function ( tolua_S , " setFocusEnabled " , lua_cocos2dx_ui_Widget_setFocusEnabled ) ; <nl> tolua_function ( tolua_S , " getBottomBoundary " , lua_cocos2dx_ui_Widget_getBottomBoundary ) ; <nl> tolua_function ( tolua_S , " isBright " , lua_cocos2dx_ui_Widget_isBright ) ; <nl> - tolua_function ( tolua_S , " clippingParentAreaContainPoint " , lua_cocos2dx_ui_Widget_clippingParentAreaContainPoint ) ; <nl> tolua_function ( tolua_S , " getCurrentFocusedWidget " , lua_cocos2dx_ui_Widget_getCurrentFocusedWidget ) ; <nl> tolua_function ( tolua_S , " requestFocus " , lua_cocos2dx_ui_Widget_requestFocus ) ; <nl> tolua_function ( tolua_S , " updateSizeAndPosition " , lua_cocos2dx_ui_Widget_updateSizeAndPosition ) ; <nl> - tolua_function ( tolua_S , " getSize " , lua_cocos2dx_ui_Widget_getSize ) ; <nl> + tolua_function ( tolua_S , " getSizePercent " , lua_cocos2dx_ui_Widget_getSizePercent ) ; <nl> + tolua_function ( tolua_S , " getTouchMovePosition " , lua_cocos2dx_ui_Widget_getTouchMovePosition ) ; <nl> tolua_function ( tolua_S , " getSizeType " , lua_cocos2dx_ui_Widget_getSizeType ) ; <nl> tolua_function ( tolua_S , " ignoreContentAdaptWithSize " , lua_cocos2dx_ui_Widget_ignoreContentAdaptWithSize ) ; <nl> - tolua_function ( tolua_S , " interceptTouchEvent " , lua_cocos2dx_ui_Widget_interceptTouchEvent ) ; <nl> tolua_function ( tolua_S , " addTouchEventListener " , lua_cocos2dx_ui_Widget_addTouchEventListener ) ; <nl> + tolua_function ( tolua_S , " getTouchEndPosition " , lua_cocos2dx_ui_Widget_getTouchEndPosition ) ; <nl> tolua_function ( tolua_S , " getPositionPercent " , lua_cocos2dx_ui_Widget_getPositionPercent ) ; <nl> tolua_function ( tolua_S , " hitTest " , lua_cocos2dx_ui_Widget_hitTest ) ; <nl> tolua_function ( tolua_S , " isFlippedX " , lua_cocos2dx_ui_Widget_isFlippedX ) ; <nl> tolua_function ( tolua_S , " isFlippedY " , lua_cocos2dx_ui_Widget_isFlippedY ) ; <nl> + tolua_function ( tolua_S , " isClippingParentContainsPoint " , lua_cocos2dx_ui_Widget_isClippingParentContainsPoint ) ; <nl> tolua_function ( tolua_S , " setSizeType " , lua_cocos2dx_ui_Widget_setSizeType ) ; <nl> tolua_function ( tolua_S , " setSize " , lua_cocos2dx_ui_Widget_setSize ) ; <nl> tolua_function ( tolua_S , " setBright " , lua_cocos2dx_ui_Widget_setBright ) ; <nl> mmm a / cocos / scripting / lua - bindings / auto / lua_cocos2dx_ui_auto . hpp <nl> ppp b / cocos / scripting / lua - bindings / auto / lua_cocos2dx_ui_auto . hpp <nl> int register_all_cocos2dx_ui ( lua_State * tolua_S ) ; <nl> <nl> <nl> <nl> - <nl> <nl> <nl> # endif / / __cocos2dx_ui_h__ <nl> | [ AUTO ] : updating luabinding automatically | cocos2d/cocos2d-x | 638f7f12c5a5a1588d98dee69f2b103a2a67bd89 | 2014-06-09T03:15:50Z |
mmm a / src / mongo / base / shim . h <nl> ppp b / src / mongo / base / shim . h <nl> const bool checkShimsViaTUHook = false ; <nl> } \ <nl> } <nl> <nl> + <nl> + / * * <nl> + * Evaluates to a string which represents the ` MONGO_INITIALIZER ` step name in which this specific <nl> + * shim is registered . This can be useful to make sure that some initializers depend upon a shim ' s <nl> + * execution and presence in a binary . <nl> + * / <nl> + # define MONGO_SHIM_DEPENDENCY ( . . . ) MONGO_SHIM_EVIL_STRINGIFY_ ( __VA_ARGS__ ) <nl> + # define MONGO_SHIM_EVIL_STRINGIFY_ ( args ) # args <nl> + <nl> / * * <nl> * Define a shimmable function with name ` SHIM_NAME ` , returning a value of type ` RETURN_TYPE ` , with <nl> * any arguments . This shim definition macro should go in the associated C + + file to the header <nl> const bool checkShimsViaTUHook = false ; <nl> namespace { \ <nl> namespace shim_namespace # # LN { \ <nl> using ShimType = decltype ( __VA_ARGS__ ) ; \ <nl> + : : mongo : : Status initializerGroupStartup ( : : mongo : : InitializerContext * ) { \ <nl> + return Status : : OK ( ) ; \ <nl> + } \ <nl> + : : mongo : : GlobalInitializerRegisterer _mongoInitializerRegisterer ( \ <nl> + std : : string ( MONGO_SHIM_DEPENDENCY ( __VA_ARGS__ ) ) , \ <nl> + { } , \ <nl> + { MONGO_SHIM_DEPENDENTS } , \ <nl> + mongo : : InitializerFunction ( initializerGroupStartup ) ) ; \ <nl> } / * namespace shim_namespace * / \ <nl> } / * namespace * / \ <nl> shim_namespace # # LN : : ShimType : : MongoShimImplGuts : : LibTUHookTypeBase : : LibTUHookTypeBase ( ) = \ <nl> default ; \ <nl> shim_namespace # # LN : : ShimType __VA_ARGS__ { } ; <nl> <nl> - # define MONGO_SHIM_EVIL_STRINGIFY_ ( args ) # args <nl> - <nl> - <nl> / * * <nl> * Define an implementation of a shimmable function with name ` SHIM_NAME ` . The compiler will check <nl> * supplied parameters for correctness . This shim registration macro should go in the associated <nl> * C + + implementation file to the header where a SHIM was defined . Such a file would be a mock <nl> - * implementation or a real implementation , for example <nl> + * implementation or a real implementation , for example . <nl> * / <nl> # define MONGO_REGISTER_SHIM ( / * SHIM_NAME * / . . . ) MONGO_REGISTER_SHIM_1 ( __LINE__ , __VA_ARGS__ ) <nl> # define MONGO_REGISTER_SHIM_1 ( LN , . . . ) MONGO_REGISTER_SHIM_2 ( LN , __VA_ARGS__ ) <nl> const bool checkShimsViaTUHook = false ; <nl> } \ <nl> \ <nl> const : : mongo : : GlobalInitializerRegisterer registrationHook { \ <nl> - std : : string ( MONGO_SHIM_EVIL_STRINGIFY_ ( __VA_ARGS__ ) ) , \ <nl> + std : : string ( MONGO_SHIM_DEPENDENCY ( __VA_ARGS__ ) " _registration " ) , \ <nl> { } , \ <nl> - { MONGO_SHIM_DEPENDENTS } , \ <nl> + { MONGO_SHIM_DEPENDENCY ( __VA_ARGS__ ) , MONGO_SHIM_DEPENDENTS } , \ <nl> mongo : : InitializerFunction ( createInitializerRegistration ) } ; \ <nl> } / * namespace shim_namespace * / \ <nl> } / * namespace * / \ <nl> const bool checkShimsViaTUHook = false ; <nl> and return value ( using arrow \ <nl> notation ) . Then they write the \ <nl> body . * / <nl> + <nl> + / * * <nl> + * Define an overriding implementation of a shimmable function with ` SHIM_NAME ` . The compiler will <nl> + * check the supplied parameters for correctness . This shim override macro should go in the <nl> + * associated C + + implementation file to the header where a SHIM was defined . Such a file <nl> + * specifying an override would be a C + + implementation used by a mongodb extension module . <nl> + * This creates a runtime dependency upon the original registration being linked in . <nl> + * / <nl> + # define MONGO_OVERRIDE_SHIM ( / * SHIM_NAME * / . . . ) MONGO_OVERRIDE_SHIM_1 ( __LINE__ , __VA_ARGS__ ) <nl> + # define MONGO_OVERRIDE_SHIM_1 ( LN , . . . ) MONGO_OVERRIDE_SHIM_2 ( LN , __VA_ARGS__ ) <nl> + # define MONGO_OVERRIDE_SHIM_2 ( LN , . . . ) \ <nl> + namespace { \ <nl> + namespace shim_namespace # # LN { \ <nl> + using ShimType = decltype ( __VA_ARGS__ ) ; \ <nl> + \ <nl> + class OverrideImplementation final : public ShimType : : MongoShimImplGuts { \ <nl> + / * Some compilers don ' t work well with the trailing ` override ` in this kind of \ <nl> + * function declaration . * / \ <nl> + ShimType : : MongoShimImplGuts : : function_type implementation ; / * override * / \ <nl> + } ; \ <nl> + \ <nl> + : : mongo : : Status createInitializerOverride ( : : mongo : : InitializerContext * const ) { \ <nl> + static OverrideImplementation overrideImpl ; \ <nl> + ShimType : : storage : : data = & overrideImpl ; \ <nl> + return Status : : OK ( ) ; \ <nl> + } \ <nl> + \ <nl> + const : : mongo : : GlobalInitializerRegisterer overrideHook { \ <nl> + std : : string ( MONGO_SHIM_DEPENDENCY ( __VA_ARGS__ ) " _override " ) , \ <nl> + { MONGO_SHIM_DEPENDENCY ( \ <nl> + __VA_ARGS__ ) " _registration " } , / * Override happens after first registration * / \ <nl> + { MONGO_SHIM_DEPENDENCY ( __VA_ARGS__ ) , / * Provides impl for this shim * / \ <nl> + MONGO_SHIM_DEPENDENTS } , / * Still a shim registration * / \ <nl> + mongo : : InitializerFunction ( createInitializerOverride ) } ; \ <nl> + } / * namespace shim_namespace * / \ <nl> + } / * namespace * / \ <nl> + \ <nl> + auto shim_namespace # # LN : : OverrideImplementation : : \ <nl> + implementation / * After this point someone just writes the signature ' s arguments and \ <nl> + return value ( using arrow notation ) . Then they write the body . * / <nl> mmm a / src / mongo / db / auth / authorization_manager_global . cpp <nl> ppp b / src / mongo / db / auth / authorization_manager_global . cpp <nl> MONGO_EXPORT_STARTUP_SERVER_PARAMETER ( startupAuthSchemaValidation , bool , true ) ; <nl> <nl> GlobalInitializerRegisterer authorizationManagerInitializer ( <nl> " CreateAuthorizationManager " , <nl> - { " OIDGeneration " , " EndStartupOptionStorage " , " ServiceContext " } , <nl> + { MONGO_SHIM_DEPENDENCY ( AuthorizationManager : : create ) , <nl> + " OIDGeneration " , <nl> + " EndStartupOptionStorage " , <nl> + " ServiceContext " } , <nl> [ ] ( InitializerContext * context ) { <nl> auto authzManager = AuthorizationManager : : create ( ) ; <nl> authzManager - > setAuthEnabled ( serverGlobalParams . authState = = <nl> mmm a / src / mongo / db / catalog / SConscript <nl> ppp b / src / mongo / db / catalog / SConscript <nl> env . Library ( <nl> " index_catalog . cpp " , <nl> ] , <nl> LIBDEPS = [ <nl> + ' $ BUILD_DIR / mongo / base ' , <nl> ] , <nl> ) <nl> <nl> env . Library ( <nl> " index_catalog_entry . cpp " , <nl> ] , <nl> LIBDEPS = [ <nl> + ' $ BUILD_DIR / mongo / base ' , <nl> ] , <nl> ) <nl> <nl> env . CppUnitTest ( <nl> env . Library ( <nl> target = ' database_holder ' , <nl> source = [ <nl> - " database_holder . cpp " , <nl> + ' database_holder . cpp ' , <nl> ] , <nl> LIBDEPS = [ <nl> + ' $ BUILD_DIR / mongo / base ' , <nl> ] , <nl> ) <nl> <nl> env . Library ( <nl> ' collection_info_cache . cpp ' , <nl> ] , <nl> LIBDEPS = [ <nl> + ' $ BUILD_DIR / mongo / base ' , <nl> ] , <nl> ) <nl> <nl> env . Library ( <nl> ' index_create . cpp ' , <nl> ] , <nl> LIBDEPS = [ <nl> + ' $ BUILD_DIR / mongo / base ' , <nl> ] , <nl> ) <nl> <nl> | SERVER - 34944 Create a shim - override mechanism . | mongodb/mongo | 1de64a4eb0a3655df083bc2160e5720d66f3c6fe | 2018-05-24T21:28:38Z |
mmm a / modules / planning / conf / scenario / side_pass_config . pb . txt <nl> ppp b / modules / planning / conf / scenario / side_pass_config . pb . txt <nl> side_pass_config : { <nl> } <nl> stage_config : { <nl> stage_type : SIDE_PASS_DEFAULT_STAGE <nl> - enabled : true <nl> + enabled : false <nl> task_type : DECIDER_RULE_BASED_STOP <nl> task_type : PATH_BOUNDS_DECIDER <nl> task_type : PIECEWISE_JERK_PATH_OPTIMIZER <nl> stage_config : { <nl> } <nl> stage_config : { <nl> stage_type : SIDE_PASS_APPROACH_OBSTACLE <nl> - enabled : false <nl> + enabled : true <nl> task_type : DECIDER_RULE_BASED_STOP <nl> task_type : DP_POLY_PATH_OPTIMIZER <nl> task_type : PATH_DECIDER <nl> stage_config : { <nl> } <nl> stage_config : { <nl> stage_type : SIDE_PASS_BACKUP <nl> - enabled : false <nl> + enabled : true <nl> task_type : DECIDER_RULE_BASED_STOP <nl> task_type : DP_POLY_PATH_OPTIMIZER <nl> task_type : PATH_DECIDER <nl> stage_config : { <nl> } <nl> stage_config : { <nl> stage_type : SIDE_PASS_GENERATE_PATH <nl> - enabled : false <nl> + enabled : true <nl> task_type : DECIDER_RULE_BASED_STOP <nl> task_type : SIDE_PASS_PATH_DECIDER <nl> task_type : SPEED_BOUNDS_PRIORI_DECIDER <nl> stage_config : { <nl> <nl> stage_config : { <nl> stage_type : SIDE_PASS_STOP_ON_WAITPOINT <nl> - enabled : false <nl> + enabled : true <nl> task_type : DECIDER_RULE_BASED_STOP <nl> task_type : DP_POLY_PATH_OPTIMIZER <nl> task_type : PATH_DECIDER <nl> stage_config : { <nl> } <nl> stage_config : { <nl> stage_type : SIDE_PASS_DETECT_SAFETY <nl> - enabled : false <nl> + enabled : true <nl> task_type : DECIDER_RULE_BASED_STOP <nl> task_type : SIDE_PASS_SAFETY <nl> task_type : SPEED_BOUNDS_PRIORI_DECIDER <nl> stage_config : { <nl> } <nl> stage_config : { <nl> stage_type : SIDE_PASS_PASS_OBSTACLE <nl> - enabled : false <nl> + enabled : true <nl> task_type : DECIDER_RULE_BASED_STOP <nl> task_type : SPEED_BOUNDS_PRIORI_DECIDER <nl> task_type : DP_ST_SPEED_OPTIMIZER <nl> mmm a / modules / planning / scenarios / side_pass / BUILD <nl> ppp b / modules / planning / scenarios / side_pass / BUILD <nl> cc_library ( <nl> name = " side_pass " , <nl> srcs = [ <nl> " side_pass_scenario . cc " , <nl> + " stage_approach_obstacle . cc " , <nl> + " stage_backup . cc " , <nl> + " stage_detect_safety . cc " , <nl> + " stage_generate_path . cc " , <nl> + " stage_pass_obstacle . cc " , <nl> " stage_side_pass . cc " , <nl> + " stage_stop_on_wait_point . cc " , <nl> ] , <nl> hdrs = [ <nl> " side_pass_scenario . h " , <nl> + " stage_approach_obstacle . h " , <nl> + " stage_backup . h " , <nl> + " stage_detect_safety . h " , <nl> + " stage_generate_path . h " , <nl> + " stage_pass_obstacle . h " , <nl> " stage_side_pass . h " , <nl> + " stage_stop_on_wait_point . h " , <nl> ] , <nl> copts = [ " - DMODULE_NAME = \ \ \ " planning \ \ \ " " ] , <nl> deps = [ <nl> mmm a / modules / planning / scenarios / side_pass / side_pass_scenario . cc <nl> ppp b / modules / planning / scenarios / side_pass / side_pass_scenario . cc <nl> <nl> # include " modules / planning / common / obstacle_blocking_analyzer . h " <nl> # include " modules / planning / common / planning_context . h " <nl> # include " modules / planning / common / planning_gflags . h " <nl> + # include " modules / planning / scenarios / side_pass / stage_approach_obstacle . h " <nl> + # include " modules / planning / scenarios / side_pass / stage_backup . h " <nl> + # include " modules / planning / scenarios / side_pass / stage_detect_safety . h " <nl> + # include " modules / planning / scenarios / side_pass / stage_generate_path . h " <nl> + # include " modules / planning / scenarios / side_pass / stage_pass_obstacle . h " <nl> # include " modules / planning / scenarios / side_pass / stage_side_pass . h " <nl> + # include " modules / planning / scenarios / side_pass / stage_stop_on_wait_point . h " <nl> <nl> namespace apollo { <nl> namespace planning { <nl> void SidePassScenario : : RegisterStages ( ) { <nl> [ ] ( const ScenarioConfig : : StageConfig & config ) - > Stage * { <nl> return new StageSidePass ( config ) ; <nl> } ) ; <nl> + s_stage_factory_ . Register ( <nl> + ScenarioConfig : : SIDE_PASS_APPROACH_OBSTACLE , <nl> + [ ] ( const ScenarioConfig : : StageConfig & config ) - > Stage * { <nl> + return new StageApproachObstacle ( config ) ; <nl> + } ) ; <nl> + s_stage_factory_ . Register ( <nl> + ScenarioConfig : : SIDE_PASS_DETECT_SAFETY , <nl> + [ ] ( const ScenarioConfig : : StageConfig & config ) - > Stage * { <nl> + return new StageDetectSafety ( config ) ; <nl> + } ) ; <nl> + s_stage_factory_ . Register ( <nl> + ScenarioConfig : : SIDE_PASS_GENERATE_PATH , <nl> + [ ] ( const ScenarioConfig : : StageConfig & config ) - > Stage * { <nl> + return new StageGeneratePath ( config ) ; <nl> + } ) ; <nl> + s_stage_factory_ . Register ( <nl> + ScenarioConfig : : SIDE_PASS_STOP_ON_WAITPOINT , <nl> + [ ] ( const ScenarioConfig : : StageConfig & config ) - > Stage * { <nl> + return new StageStopOnWaitPoint ( config ) ; <nl> + } ) ; <nl> + s_stage_factory_ . Register ( <nl> + ScenarioConfig : : SIDE_PASS_PASS_OBSTACLE , <nl> + [ ] ( const ScenarioConfig : : StageConfig & config ) - > Stage * { <nl> + return new StagePassObstacle ( config ) ; <nl> + } ) ; <nl> + s_stage_factory_ . Register ( <nl> + ScenarioConfig : : SIDE_PASS_BACKUP , <nl> + [ ] ( const ScenarioConfig : : StageConfig & config ) - > Stage * { <nl> + return new StageBackup ( config ) ; <nl> + } ) ; <nl> + <nl> } <nl> <nl> SidePassScenario : : SidePassScenario ( const ScenarioConfig & config , <nl> new file mode 100644 <nl> index 00000000000 . . 14db77edaa2 <nl> mmm / dev / null <nl> ppp b / modules / planning / scenarios / side_pass / stage_approach_obstacle . cc <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + * Copyright 2018 The Apollo Authors . All Rights Reserved . <nl> + * <nl> + * Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + * you may not use this file except in compliance with the License . <nl> + * You may obtain a copy of the License at <nl> + * <nl> + * http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + * <nl> + * Unless required by applicable law or agreed to in writing , software <nl> + * distributed under the License is distributed on an " AS IS " BASIS , <nl> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + * See the License for the specific language governing permissions and <nl> + * limitations under the License . <nl> + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + / * * <nl> + * @ file <nl> + * * / <nl> + <nl> + # include " modules / planning / scenarios / side_pass / stage_approach_obstacle . h " <nl> + <nl> + # include < string > <nl> + <nl> + # include " modules / common / proto / pnc_point . pb . h " <nl> + <nl> + # include " modules / common / configs / vehicle_config_helper . h " <nl> + # include " modules / planning / common / frame . h " <nl> + # include " modules / planning / common / obstacle_blocking_analyzer . h " <nl> + # include " modules / planning / common / planning_gflags . h " <nl> + # include " modules / planning / common / speed_profile_generator . h " <nl> + <nl> + namespace apollo { <nl> + namespace planning { <nl> + namespace scenario { <nl> + namespace side_pass { <nl> + <nl> + using apollo : : common : : TrajectoryPoint ; <nl> + <nl> + / * <nl> + * @ brief : STAGE ApproachObstacle in side_pass scenario <nl> + * / <nl> + Stage : : StageStatus StageApproachObstacle : : Process ( <nl> + const TrajectoryPoint & planning_start_point , Frame * frame ) { <nl> + ADEBUG < < " SIDEPASS : Approaching obstacle . " ; <nl> + std : : string blocking_obstacle_id = GetContext ( ) - > front_blocking_obstacle_id_ ; <nl> + const SLBoundary & adc_sl_boundary = <nl> + frame - > reference_line_info ( ) . front ( ) . AdcSlBoundary ( ) ; <nl> + const PathDecision & path_decision = <nl> + frame - > reference_line_info ( ) . front ( ) . path_decision ( ) ; <nl> + <nl> + / / Locate the front blocking obstacle . <nl> + / / If cannot find it , exit stage . <nl> + double obstacle_start_s = - 1 . 0 ; <nl> + for ( const auto * obstacle : path_decision . obstacles ( ) . Items ( ) ) { <nl> + if ( obstacle - > Id ( ) = = blocking_obstacle_id ) { <nl> + obstacle_start_s = obstacle - > PerceptionSLBoundary ( ) . start_s ( ) ; <nl> + break ; <nl> + } <nl> + } <nl> + if ( obstacle_start_s < 0 . 0 ) { <nl> + AWARN < < " Front blocking obstacle : " < < blocking_obstacle_id <nl> + < < " is not found . " ; <nl> + next_stage_ = ScenarioConfig : : NO_STAGE ; <nl> + return Stage : : FINISHED ; <nl> + } <nl> + if ( ( obstacle_start_s - adc_sl_boundary . end_s ( ) ) < <nl> + GetContext ( ) - > scenario_config_ . min_front_obstacle_distance ( ) ) { <nl> + AWARN < < " Front blocking obstacle : " < < blocking_obstacle_id <nl> + < < " moved to be too close or behind ADC . " ; <nl> + next_stage_ = ScenarioConfig : : NO_STAGE ; <nl> + return Stage : : FINISHED ; <nl> + } <nl> + <nl> + / / Create a virtual stop fence as the end - point of this obstacle <nl> + / / approaching stage . <nl> + double stop_fence_s = <nl> + obstacle_start_s - <nl> + GetContext ( ) - > scenario_config_ . stop_fence_distance_to_blocking_obstacle ( ) ; <nl> + std : : string virtual_obstacle_id = blocking_obstacle_id + " _virtual_stop " ; <nl> + for ( auto & reference_line_info : * frame - > mutable_reference_line_info ( ) ) { <nl> + auto * obstacle = frame - > CreateStopObstacle ( <nl> + & reference_line_info , virtual_obstacle_id , stop_fence_s ) ; <nl> + if ( ! obstacle ) { <nl> + AERROR < < " Failed to create virtual stop obstacle [ " <nl> + < < blocking_obstacle_id < < " ] " ; <nl> + next_stage_ = ScenarioConfig : : NO_STAGE ; <nl> + return Stage : : FINISHED ; <nl> + } <nl> + Obstacle * stop_wall = reference_line_info . AddObstacle ( obstacle ) ; <nl> + if ( ! stop_wall ) { <nl> + AERROR < < " Failed to create stop obstacle for : " < < blocking_obstacle_id ; <nl> + next_stage_ = ScenarioConfig : : NO_STAGE ; <nl> + return Stage : : FINISHED ; <nl> + } <nl> + <nl> + const double stop_distance = 0 . 2 ; <nl> + const double stop_s = stop_fence_s - stop_distance ; <nl> + const auto & reference_line = reference_line_info . reference_line ( ) ; <nl> + auto stop_point = reference_line . GetReferencePoint ( stop_s ) ; <nl> + double stop_heading = reference_line . GetReferencePoint ( stop_s ) . heading ( ) ; <nl> + <nl> + ObjectDecisionType stop ; <nl> + auto stop_decision = stop . mutable_stop ( ) ; <nl> + stop_decision - > set_reason_code ( StopReasonCode : : STOP_REASON_OBSTACLE ) ; <nl> + stop_decision - > set_distance_s ( - stop_distance ) ; <nl> + stop_decision - > set_stop_heading ( stop_heading ) ; <nl> + stop_decision - > mutable_stop_point ( ) - > set_x ( stop_point . x ( ) ) ; <nl> + stop_decision - > mutable_stop_point ( ) - > set_y ( stop_point . y ( ) ) ; <nl> + stop_decision - > mutable_stop_point ( ) - > set_z ( 0 . 0 ) ; <nl> + <nl> + auto * path_decision = reference_line_info . path_decision ( ) ; <nl> + path_decision - > AddLongitudinalDecision ( " SidePass " , stop_wall - > Id ( ) , stop ) ; <nl> + <nl> + break ; <nl> + } <nl> + <nl> + / / Do path planning to stop at a proper distance to the blocking obstacle . <nl> + bool plan_ok = ExecuteTaskOnReferenceLine ( planning_start_point , frame ) ; <nl> + if ( ! plan_ok ) { <nl> + AERROR < < " Stage " < < Name ( ) < < " error : " <nl> + < < " planning on reference line failed . " ; <nl> + return Stage : : ERROR ; <nl> + } <nl> + double adc_velocity = frame - > vehicle_state ( ) . linear_velocity ( ) ; <nl> + <nl> + / / Check if it still satisfies the SIDE_PASS criterion . <nl> + / / If so , update the distance to front blocking obstacle . <nl> + double distance_to_closest_blocking_obstacle = - 100 . 0 ; <nl> + bool exists_a_blocking_obstacle = false ; <nl> + for ( const auto * obstacle : path_decision . obstacles ( ) . Items ( ) ) { <nl> + if ( IsBlockingObstacleToSidePass ( <nl> + * frame , obstacle , <nl> + GetContext ( ) - > scenario_config_ . block_obstacle_min_speed ( ) , <nl> + GetContext ( ) - > scenario_config_ . min_front_obstacle_distance ( ) , <nl> + GetContext ( ) - > scenario_config_ . enable_obstacle_blocked_check ( ) ) ) { <nl> + exists_a_blocking_obstacle = true ; <nl> + double distance_between_adc_and_obstacle = <nl> + GetDistanceBetweenADCAndObstacle ( * frame , obstacle ) ; <nl> + if ( distance_to_closest_blocking_obstacle < 0 . 0 | | <nl> + distance_between_adc_and_obstacle < <nl> + distance_to_closest_blocking_obstacle ) { <nl> + distance_to_closest_blocking_obstacle = <nl> + distance_between_adc_and_obstacle ; <nl> + } <nl> + } <nl> + } <nl> + if ( ! exists_a_blocking_obstacle ) { <nl> + next_stage_ = ScenarioConfig : : NO_STAGE ; <nl> + ADEBUG < < " There is no blocking obstacle . " ; <nl> + return Stage : : FINISHED ; <nl> + } <nl> + if ( distance_to_closest_blocking_obstacle < 0 . 0 ) { <nl> + AERROR < < " Stage " < < Name ( ) < < " error : " <nl> + < < " front obstacle has wrong position . " ; <nl> + return Stage : : ERROR ; <nl> + } <nl> + <nl> + / / If ADC stopped at a proper distance from blocking obstacle , <nl> + / / switch to the SIDE_PASS_GENERATE_PATH ; <nl> + / / otherwise , give it more time to finish this stage . <nl> + double max_stop_velocity = <nl> + GetContext ( ) - > scenario_config_ . approach_obstacle_max_stop_speed ( ) ; <nl> + double min_stop_obstacle_distance = <nl> + GetContext ( ) - > scenario_config_ . approach_obstacle_min_stop_distance ( ) ; <nl> + ADEBUG < < " front_obstacle_distance = " <nl> + < < distance_to_closest_blocking_obstacle ; <nl> + ADEBUG < < " adc_velocity = " < < adc_velocity ; <nl> + if ( adc_velocity < max_stop_velocity & & <nl> + distance_to_closest_blocking_obstacle > min_stop_obstacle_distance ) { <nl> + next_stage_ = ScenarioConfig : : SIDE_PASS_GENERATE_PATH ; <nl> + return Stage : : FINISHED ; <nl> + } <nl> + return Stage : : RUNNING ; <nl> + } <nl> + <nl> + } / / namespace side_pass <nl> + } / / namespace scenario <nl> + } / / namespace planning <nl> + } / / namespace apollo <nl> new file mode 100644 <nl> index 00000000000 . . 4b70f915b74 <nl> mmm / dev / null <nl> ppp b / modules / planning / scenarios / side_pass / stage_approach_obstacle . h <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + * Copyright 2018 The Apollo Authors . All Rights Reserved . <nl> + * <nl> + * Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + * you may not use this file except in compliance with the License . <nl> + * You may obtain a copy of the License at <nl> + * <nl> + * http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + * <nl> + * Unless required by applicable law or agreed to in writing , software <nl> + * distributed under the License is distributed on an " AS IS " BASIS , <nl> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + * See the License for the specific language governing permissions and <nl> + * limitations under the License . <nl> + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + / * * <nl> + * @ file <nl> + * * / <nl> + <nl> + # pragma once <nl> + <nl> + # include " modules / planning / scenarios / side_pass / side_pass_scenario . h " <nl> + # include " modules / planning / scenarios / stage . h " <nl> + <nl> + namespace apollo { <nl> + namespace planning { <nl> + namespace scenario { <nl> + namespace side_pass { <nl> + <nl> + struct SidePassContext ; <nl> + <nl> + DECLARE_STAGE ( StageApproachObstacle , SidePassContext ) ; <nl> + <nl> + } / / namespace side_pass <nl> + } / / namespace scenario <nl> + } / / namespace planning <nl> + } / / namespace apollo <nl> new file mode 100644 <nl> index 00000000000 . . 9a3114085ca <nl> mmm / dev / null <nl> ppp b / modules / planning / scenarios / side_pass / stage_backup . cc <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + * Copyright 2018 The Apollo Authors . All Rights Reserved . <nl> + * <nl> + * Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + * you may not use this file except in compliance with the License . <nl> + * You may obtain a copy of the License at <nl> + * <nl> + * http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + * <nl> + * Unless required by applicable law or agreed to in writing , software <nl> + * distributed under the License is distributed on an " AS IS " BASIS , <nl> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + * See the License for the specific language governing permissions and <nl> + * limitations under the License . <nl> + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + / * * <nl> + * @ file <nl> + * * / <nl> + <nl> + # include " modules / planning / scenarios / side_pass / stage_backup . h " <nl> + <nl> + # include " modules / common / proto / pnc_point . pb . h " <nl> + <nl> + # include " modules / common / configs / vehicle_config_helper . h " <nl> + # include " modules / planning / common / frame . h " <nl> + # include " modules / planning / common / obstacle_blocking_analyzer . h " <nl> + # include " modules / planning / common / planning_gflags . h " <nl> + # include " modules / planning / common / speed_profile_generator . h " <nl> + <nl> + namespace apollo { <nl> + namespace planning { <nl> + namespace scenario { <nl> + namespace side_pass { <nl> + <nl> + using apollo : : common : : TrajectoryPoint ; <nl> + <nl> + / * <nl> + * @ brief : <nl> + * STAGE : StageBackup <nl> + * / <nl> + Stage : : StageStatus StageBackup : : Process ( <nl> + const TrajectoryPoint & planning_start_point , Frame * frame ) { <nl> + / / Check for front blocking obstacles . <nl> + const auto & reference_line_info = frame - > reference_line_info ( ) . front ( ) ; <nl> + const PathDecision & path_decision = reference_line_info . path_decision ( ) ; <nl> + bool exists_a_blocking_obstacle = false ; <nl> + for ( const auto * obstacle : path_decision . obstacles ( ) . Items ( ) ) { <nl> + if ( IsBlockingObstacleToSidePass ( <nl> + * frame , obstacle , <nl> + GetContext ( ) - > scenario_config_ . block_obstacle_min_speed ( ) , <nl> + GetContext ( ) - > scenario_config_ . min_front_obstacle_distance ( ) , <nl> + GetContext ( ) - > scenario_config_ . enable_obstacle_blocked_check ( ) ) ) { <nl> + exists_a_blocking_obstacle = true ; <nl> + break ; <nl> + } <nl> + } <nl> + <nl> + / / If there is no more blocking obstacle or if we are in this stage <nl> + / / for too long , then exit stage . <nl> + GetContext ( ) - > backup_stage_cycle_num_ + = 1 ; <nl> + if ( ! exists_a_blocking_obstacle | | <nl> + GetContext ( ) - > backup_stage_cycle_num_ > <nl> + GetContext ( ) - > scenario_config_ . max_backup_stage_cycle_num ( ) ) { <nl> + GetContext ( ) - > backup_stage_cycle_num_ = 0 ; <nl> + next_stage_ = ScenarioConfig : : NO_STAGE ; <nl> + return Stage : : FINISHED ; <nl> + } <nl> + <nl> + / / Otherwise , do path planning . <nl> + bool plan_ok = ExecuteTaskOnReferenceLine ( planning_start_point , frame ) ; <nl> + if ( ! plan_ok ) { <nl> + AERROR < < " Stage " < < Name ( ) < < " error : " <nl> + < < " planning on reference line failed . " ; <nl> + return Stage : : ERROR ; <nl> + } <nl> + return Stage : : RUNNING ; <nl> + } <nl> + <nl> + } / / namespace side_pass <nl> + } / / namespace scenario <nl> + } / / namespace planning <nl> + } / / namespace apollo <nl> new file mode 100644 <nl> index 00000000000 . . 263c3561e9e <nl> mmm / dev / null <nl> ppp b / modules / planning / scenarios / side_pass / stage_backup . h <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + * Copyright 2018 The Apollo Authors . All Rights Reserved . <nl> + * <nl> + * Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + * you may not use this file except in compliance with the License . <nl> + * You may obtain a copy of the License at <nl> + * <nl> + * http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + * <nl> + * Unless required by applicable law or agreed to in writing , software <nl> + * distributed under the License is distributed on an " AS IS " BASIS , <nl> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + * See the License for the specific language governing permissions and <nl> + * limitations under the License . <nl> + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + / * * <nl> + * @ file <nl> + * * / <nl> + <nl> + # pragma once <nl> + <nl> + # include " modules / planning / scenarios / side_pass / side_pass_scenario . h " <nl> + # include " modules / planning / scenarios / stage . h " <nl> + <nl> + namespace apollo { <nl> + namespace planning { <nl> + namespace scenario { <nl> + namespace side_pass { <nl> + <nl> + struct SidePassContext ; <nl> + <nl> + DECLARE_STAGE ( StageBackup , SidePassContext ) ; <nl> + <nl> + } / / namespace side_pass <nl> + } / / namespace scenario <nl> + } / / namespace planning <nl> + } / / namespace apollo <nl> new file mode 100644 <nl> index 00000000000 . . 8a8afbd1f64 <nl> mmm / dev / null <nl> ppp b / modules / planning / scenarios / side_pass / stage_detect_safety . cc <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + * Copyright 2018 The Apollo Authors . All Rights Reserved . <nl> + * <nl> + * Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + * you may not use this file except in compliance with the License . <nl> + * You may obtain a copy of the License at <nl> + * <nl> + * http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + * <nl> + * Unless required by applicable law or agreed to in writing , software <nl> + * distributed under the License is distributed on an " AS IS " BASIS , <nl> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + * See the License for the specific language governing permissions and <nl> + * limitations under the License . <nl> + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + / * * <nl> + * @ file <nl> + * * / <nl> + <nl> + # include " modules / planning / scenarios / side_pass / stage_detect_safety . h " <nl> + <nl> + # include " modules / common / proto / pnc_point . pb . h " <nl> + <nl> + # include " modules / planning / common / frame . h " <nl> + # include " modules / planning / common / planning_gflags . h " <nl> + # include " modules / planning / common / speed_profile_generator . h " <nl> + <nl> + namespace apollo { <nl> + namespace planning { <nl> + namespace scenario { <nl> + namespace side_pass { <nl> + <nl> + using apollo : : common : : TrajectoryPoint ; <nl> + <nl> + / * <nl> + * @ brief : <nl> + * STAGE : SidePassDetectSafety <nl> + * / <nl> + Stage : : StageStatus StageDetectSafety : : Process ( <nl> + const TrajectoryPoint & planning_start_point , Frame * frame ) { <nl> + ADEBUG < < " SIDEPASS : Detecting if it ' s safe to side - pass . " ; <nl> + const auto & reference_line_info = frame - > reference_line_info ( ) . front ( ) ; <nl> + bool update_success = GetContext ( ) - > path_data_ . UpdateFrenetFramePath ( <nl> + & reference_line_info . reference_line ( ) ) ; <nl> + if ( ! update_success ) { <nl> + AERROR < < " Fail to update path_data . " ; <nl> + return Stage : : ERROR ; <nl> + } <nl> + <nl> + const auto adc_frenet_frame_point_ = <nl> + reference_line_info . reference_line ( ) . GetFrenetPoint ( <nl> + frame - > PlanningStartPoint ( ) . path_point ( ) ) ; <nl> + <nl> + bool trim_success = <nl> + GetContext ( ) - > path_data_ . LeftTrimWithRefS ( adc_frenet_frame_point_ ) ; <nl> + if ( ! trim_success ) { <nl> + AERROR < < " Fail to trim path_data . adc_frenet_frame_point : " <nl> + < < adc_frenet_frame_point_ . ShortDebugString ( ) ; <nl> + return Stage : : ERROR ; <nl> + } <nl> + <nl> + auto & rfl_info = frame - > mutable_reference_line_info ( ) - > front ( ) ; <nl> + * ( rfl_info . mutable_path_data ( ) ) = GetContext ( ) - > path_data_ ; <nl> + <nl> + const auto & path_points = rfl_info . path_data ( ) . discretized_path ( ) ; <nl> + auto * debug_path = <nl> + rfl_info . mutable_debug ( ) - > mutable_planning_data ( ) - > add_path ( ) ; <nl> + <nl> + debug_path - > set_name ( " DpPolyPathOptimizer " ) ; <nl> + debug_path - > mutable_path_point ( ) - > CopyFrom ( <nl> + { path_points . begin ( ) , path_points . end ( ) } ) ; <nl> + <nl> + if ( ! ExecuteTaskOnReferenceLine ( planning_start_point , frame ) ) { <nl> + return Stage : : ERROR ; <nl> + } <nl> + bool is_safe = true ; <nl> + double adc_front_edge_s = reference_line_info . AdcSlBoundary ( ) . end_s ( ) ; <nl> + <nl> + const PathDecision & path_decision = <nl> + frame - > reference_line_info ( ) . front ( ) . path_decision ( ) ; <nl> + for ( const auto * obstacle : path_decision . obstacles ( ) . Items ( ) ) { <nl> + / / TODO ( All ) : check according to neighbor lane . <nl> + if ( obstacle - > IsVirtual ( ) & & obstacle - > Id ( ) . substr ( 0 , 3 ) = = " SP_ " & & <nl> + obstacle - > PerceptionSLBoundary ( ) . start_s ( ) > = adc_front_edge_s ) { <nl> + is_safe = false ; <nl> + break ; <nl> + } <nl> + } <nl> + if ( is_safe ) { <nl> + GetContext ( ) - > pass_obstacle_stuck_cycle_num_ = 0 ; <nl> + next_stage_ = ScenarioConfig : : SIDE_PASS_PASS_OBSTACLE ; <nl> + return Stage : : FINISHED ; <nl> + } <nl> + return Stage : : RUNNING ; <nl> + } <nl> + <nl> + } / / namespace side_pass <nl> + } / / namespace scenario <nl> + } / / namespace planning <nl> + } / / namespace apollo <nl> new file mode 100644 <nl> index 00000000000 . . df8881c0bf9 <nl> mmm / dev / null <nl> ppp b / modules / planning / scenarios / side_pass / stage_detect_safety . h <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + * Copyright 2018 The Apollo Authors . All Rights Reserved . <nl> + * <nl> + * Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + * you may not use this file except in compliance with the License . <nl> + * You may obtain a copy of the License at <nl> + * <nl> + * http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + * <nl> + * Unless required by applicable law or agreed to in writing , software <nl> + * distributed under the License is distributed on an " AS IS " BASIS , <nl> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + * See the License for the specific language governing permissions and <nl> + * limitations under the License . <nl> + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + / * * <nl> + * @ file <nl> + * * / <nl> + <nl> + # pragma once <nl> + <nl> + # include " modules / planning / scenarios / side_pass / side_pass_scenario . h " <nl> + # include " modules / planning / scenarios / stage . h " <nl> + <nl> + namespace apollo { <nl> + namespace planning { <nl> + namespace scenario { <nl> + namespace side_pass { <nl> + <nl> + struct SidePassContext ; <nl> + <nl> + DECLARE_STAGE ( StageDetectSafety , SidePassContext ) ; <nl> + <nl> + } / / namespace side_pass <nl> + } / / namespace scenario <nl> + } / / namespace planning <nl> + } / / namespace apollo <nl> new file mode 100644 <nl> index 00000000000 . . d7ba4683e73 <nl> mmm / dev / null <nl> ppp b / modules / planning / scenarios / side_pass / stage_generate_path . cc <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + * Copyright 2018 The Apollo Authors . All Rights Reserved . <nl> + * <nl> + * Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + * you may not use this file except in compliance with the License . <nl> + * You may obtain a copy of the License at <nl> + * <nl> + * http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + * <nl> + * Unless required by applicable law or agreed to in writing , software <nl> + * distributed under the License is distributed on an " AS IS " BASIS , <nl> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + * See the License for the specific language governing permissions and <nl> + * limitations under the License . <nl> + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + / * * <nl> + * @ file <nl> + * * / <nl> + <nl> + # include " modules / planning / scenarios / side_pass / stage_generate_path . h " <nl> + <nl> + # include " modules / common / proto / pnc_point . pb . h " <nl> + # include " modules / planning / common / frame . h " <nl> + # include " modules / planning / common / planning_gflags . h " <nl> + # include " modules / planning / common / speed_profile_generator . h " <nl> + <nl> + namespace apollo { <nl> + namespace planning { <nl> + namespace scenario { <nl> + namespace side_pass { <nl> + <nl> + using apollo : : common : : TrajectoryPoint ; <nl> + <nl> + / * <nl> + * @ brief : <nl> + * STAGE : SidePassGeneratePath <nl> + * / <nl> + Stage : : StageStatus StageGeneratePath : : Process ( <nl> + const TrajectoryPoint & planning_start_point , Frame * frame ) { <nl> + ADEBUG < < " SIDEPASS : Generating path . " ; <nl> + if ( ! ExecuteTaskOnReferenceLine ( planning_start_point , frame ) ) { <nl> + AERROR < < " Fail to plan on reference_line . " ; <nl> + GetContext ( ) - > backup_stage_cycle_num_ = 0 ; <nl> + next_stage_ = ScenarioConfig : : SIDE_PASS_BACKUP ; <nl> + return Stage : : FINISHED ; <nl> + } <nl> + GetContext ( ) - > path_data_ = frame - > reference_line_info ( ) . front ( ) . path_data ( ) ; <nl> + if ( frame - > reference_line_info ( ) . front ( ) . trajectory ( ) . NumOfPoints ( ) > 0 ) { <nl> + next_stage_ = ScenarioConfig : : SIDE_PASS_STOP_ON_WAITPOINT ; <nl> + return Stage : : FINISHED ; <nl> + } <nl> + return Stage : : RUNNING ; <nl> + } <nl> + <nl> + } / / namespace side_pass <nl> + } / / namespace scenario <nl> + } / / namespace planning <nl> + } / / namespace apollo <nl> new file mode 100644 <nl> index 00000000000 . . 9214069f2d6 <nl> mmm / dev / null <nl> ppp b / modules / planning / scenarios / side_pass / stage_generate_path . h <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + * Copyright 2018 The Apollo Authors . All Rights Reserved . <nl> + * <nl> + * Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + * you may not use this file except in compliance with the License . <nl> + * You may obtain a copy of the License at <nl> + * <nl> + * http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + * <nl> + * Unless required by applicable law or agreed to in writing , software <nl> + * distributed under the License is distributed on an " AS IS " BASIS , <nl> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + * See the License for the specific language governing permissions and <nl> + * limitations under the License . <nl> + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + / * * <nl> + * @ file <nl> + * * / <nl> + <nl> + # pragma once <nl> + <nl> + # include " modules / planning / scenarios / side_pass / side_pass_scenario . h " <nl> + # include " modules / planning / scenarios / stage . h " <nl> + <nl> + namespace apollo { <nl> + namespace planning { <nl> + namespace scenario { <nl> + namespace side_pass { <nl> + <nl> + struct SidePassContext ; <nl> + <nl> + DECLARE_STAGE ( StageGeneratePath , SidePassContext ) ; <nl> + <nl> + } / / namespace side_pass <nl> + } / / namespace scenario <nl> + } / / namespace planning <nl> + } / / namespace apollo <nl> new file mode 100644 <nl> index 00000000000 . . 4b2d9e2dff9 <nl> mmm / dev / null <nl> ppp b / modules / planning / scenarios / side_pass / stage_pass_obstacle . cc <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + * Copyright 2018 The Apollo Authors . All Rights Reserved . <nl> + * <nl> + * Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + * you may not use this file except in compliance with the License . <nl> + * You may obtain a copy of the License at <nl> + * <nl> + * http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + * <nl> + * Unless required by applicable law or agreed to in writing , software <nl> + * distributed under the License is distributed on an " AS IS " BASIS , <nl> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + * See the License for the specific language governing permissions and <nl> + * limitations under the License . <nl> + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + / * * <nl> + * @ file <nl> + * * / <nl> + <nl> + # include " modules / planning / scenarios / side_pass / stage_pass_obstacle . h " <nl> + <nl> + # include " modules / common / proto / pnc_point . pb . h " <nl> + <nl> + # include " modules / common / configs / vehicle_config_helper . h " <nl> + # include " modules / planning / common / frame . h " <nl> + # include " modules / planning / common / planning_gflags . h " <nl> + # include " modules / planning / common / speed_profile_generator . h " <nl> + <nl> + namespace apollo { <nl> + namespace planning { <nl> + namespace scenario { <nl> + namespace side_pass { <nl> + <nl> + using apollo : : common : : TrajectoryPoint ; <nl> + using apollo : : common : : math : : Vec2d ; <nl> + <nl> + / * <nl> + * @ brief : <nl> + * STAGE : StagePassObstacle <nl> + * / <nl> + Stage : : StageStatus StagePassObstacle : : Process ( <nl> + const TrajectoryPoint & planning_start_point , Frame * frame ) { <nl> + ADEBUG < < " SIDEPASS : Side - passing ! " ; <nl> + const auto & reference_line_info = frame - > reference_line_info ( ) . front ( ) ; <nl> + bool update_success = GetContext ( ) - > path_data_ . UpdateFrenetFramePath ( <nl> + & reference_line_info . reference_line ( ) ) ; <nl> + if ( ! update_success ) { <nl> + AERROR < < " Fail to update path_data . " ; <nl> + return Stage : : ERROR ; <nl> + } <nl> + ADEBUG < < " Processing StagePassObstacle . " ; <nl> + const auto adc_frenet_frame_point_ = <nl> + reference_line_info . reference_line ( ) . GetFrenetPoint ( <nl> + frame - > PlanningStartPoint ( ) . path_point ( ) ) ; <nl> + <nl> + bool trim_success = <nl> + GetContext ( ) - > path_data_ . LeftTrimWithRefS ( adc_frenet_frame_point_ ) ; <nl> + if ( ! trim_success ) { <nl> + AERROR < < " Fail to trim path_data . adc_frenet_frame_point : " <nl> + < < adc_frenet_frame_point_ . ShortDebugString ( ) ; <nl> + return Stage : : ERROR ; <nl> + } <nl> + <nl> + auto & rfl_info = frame - > mutable_reference_line_info ( ) - > front ( ) ; <nl> + * ( rfl_info . mutable_path_data ( ) ) = GetContext ( ) - > path_data_ ; <nl> + <nl> + const auto & path_points = rfl_info . path_data ( ) . discretized_path ( ) ; <nl> + auto * debug_path = <nl> + rfl_info . mutable_debug ( ) - > mutable_planning_data ( ) - > add_path ( ) ; <nl> + <nl> + / / TODO ( All ) : <nl> + / / Have to use DpPolyPathOptimizer to show in dreamview . Need change to <nl> + / / correct name . <nl> + debug_path - > set_name ( " DpPolyPathOptimizer " ) ; <nl> + debug_path - > mutable_path_point ( ) - > CopyFrom ( <nl> + { path_points . begin ( ) , path_points . end ( ) } ) ; <nl> + <nl> + bool plan_ok = ExecuteTaskOnReferenceLine ( planning_start_point , frame ) ; <nl> + if ( ! plan_ok ) { <nl> + AERROR < < " Fail to plan on reference line . " ; <nl> + return Stage : : ERROR ; <nl> + } <nl> + <nl> + const SLBoundary & adc_sl_boundary = reference_line_info . AdcSlBoundary ( ) ; <nl> + const auto & end_point = <nl> + reference_line_info . path_data ( ) . discretized_path ( ) . back ( ) ; <nl> + Vec2d last_xy_point ( end_point . x ( ) , end_point . y ( ) ) ; <nl> + / / get s of last point on path <nl> + common : : SLPoint sl_point ; <nl> + if ( ! reference_line_info . reference_line ( ) . XYToSL ( last_xy_point , & sl_point ) ) { <nl> + AERROR < < " Fail to transfer cartesian point to frenet point . " ; <nl> + return Stage : : ERROR ; <nl> + } <nl> + <nl> + double distance_to_path_end = <nl> + sl_point . s ( ) - GetContext ( ) - > scenario_config_ . side_pass_exit_distance ( ) ; <nl> + <nl> + double adc_velocity = frame - > vehicle_state ( ) . linear_velocity ( ) ; <nl> + double max_velocity_for_stop = <nl> + GetContext ( ) - > scenario_config_ . approach_obstacle_max_stop_speed ( ) ; <nl> + if ( adc_velocity < max_velocity_for_stop ) { <nl> + GetContext ( ) - > pass_obstacle_stuck_cycle_num_ + = 1 ; <nl> + } else { <nl> + GetContext ( ) - > pass_obstacle_stuck_cycle_num_ = 0 ; <nl> + } <nl> + if ( adc_sl_boundary . end_s ( ) > distance_to_path_end | | <nl> + GetContext ( ) - > pass_obstacle_stuck_cycle_num_ > 60 ) { <nl> + next_stage_ = ScenarioConfig : : NO_STAGE ; <nl> + return Stage : : FINISHED ; <nl> + } <nl> + return Stage : : RUNNING ; <nl> + } <nl> + <nl> + } / / namespace side_pass <nl> + } / / namespace scenario <nl> + } / / namespace planning <nl> + } / / namespace apollo <nl> new file mode 100644 <nl> index 00000000000 . . 95ecc664ddd <nl> mmm / dev / null <nl> ppp b / modules / planning / scenarios / side_pass / stage_pass_obstacle . h <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + * Copyright 2018 The Apollo Authors . All Rights Reserved . <nl> + * <nl> + * Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + * you may not use this file except in compliance with the License . <nl> + * You may obtain a copy of the License at <nl> + * <nl> + * http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + * <nl> + * Unless required by applicable law or agreed to in writing , software <nl> + * distributed under the License is distributed on an " AS IS " BASIS , <nl> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + * See the License for the specific language governing permissions and <nl> + * limitations under the License . <nl> + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + / * * <nl> + * @ file <nl> + * * / <nl> + <nl> + # pragma once <nl> + <nl> + # include " modules / planning / scenarios / side_pass / side_pass_scenario . h " <nl> + # include " modules / planning / scenarios / stage . h " <nl> + <nl> + namespace apollo { <nl> + namespace planning { <nl> + namespace scenario { <nl> + namespace side_pass { <nl> + <nl> + struct SidePassContext ; <nl> + <nl> + DECLARE_STAGE ( StagePassObstacle , SidePassContext ) ; <nl> + <nl> + } / / namespace side_pass <nl> + } / / namespace scenario <nl> + } / / namespace planning <nl> + } / / namespace apollo <nl> new file mode 100644 <nl> index 00000000000 . . e470df5eb16 <nl> mmm / dev / null <nl> ppp b / modules / planning / scenarios / side_pass / stage_stop_on_wait_point . cc <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + * Copyright 2018 The Apollo Authors . All Rights Reserved . <nl> + * <nl> + * Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + * you may not use this file except in compliance with the License . <nl> + * You may obtain a copy of the License at <nl> + * <nl> + * http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + * <nl> + * Unless required by applicable law or agreed to in writing , software <nl> + * distributed under the License is distributed on an " AS IS " BASIS , <nl> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + * See the License for the specific language governing permissions and <nl> + * limitations under the License . <nl> + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + / * * <nl> + * @ file <nl> + * * / <nl> + <nl> + # include " modules / planning / scenarios / side_pass / stage_stop_on_wait_point . h " <nl> + <nl> + # include < algorithm > <nl> + # include < vector > <nl> + <nl> + # include " modules / common / configs / vehicle_config_helper . h " <nl> + # include " modules / common / proto / pnc_point . pb . h " <nl> + # include " modules / planning / common / frame . h " <nl> + # include " modules / planning / common / obstacle_blocking_analyzer . h " <nl> + # include " modules / planning / common / planning_gflags . h " <nl> + # include " modules / planning / common / speed_profile_generator . h " <nl> + <nl> + namespace apollo { <nl> + namespace planning { <nl> + namespace scenario { <nl> + namespace side_pass { <nl> + <nl> + using apollo : : common : : PathPoint ; <nl> + using apollo : : common : : TrajectoryPoint ; <nl> + using apollo : : common : : math : : Vec2d ; <nl> + <nl> + constexpr double kSExtraMarginforStopOnWaitPointStage = 3 . 0 ; <nl> + constexpr double kLExtraMarginforStopOnWaitPointStage = 0 . 4 ; <nl> + <nl> + Stage : : StageStatus StageStopOnWaitPoint : : Process ( <nl> + const TrajectoryPoint & planning_start_point , Frame * frame ) { <nl> + ADEBUG < < " SIDEPASS : Stopping on wait point . " ; <nl> + <nl> + / / Sanity checks . <nl> + const ReferenceLineInfo & reference_line_info = <nl> + frame - > reference_line_info ( ) . front ( ) ; <nl> + const ReferenceLine & reference_line = reference_line_info . reference_line ( ) ; <nl> + const PathDecision & path_decision = reference_line_info . path_decision ( ) ; <nl> + if ( GetContext ( ) - > path_data_ . discretized_path ( ) . empty ( ) ) { <nl> + AERROR < < " path data is empty . " ; <nl> + return Stage : : ERROR ; <nl> + } <nl> + if ( ! GetContext ( ) - > path_data_ . UpdateFrenetFramePath ( & reference_line ) ) { <nl> + return Stage : : ERROR ; <nl> + } <nl> + const auto adc_frenet_frame_point_ = <nl> + reference_line . GetFrenetPoint ( frame - > PlanningStartPoint ( ) . path_point ( ) ) ; <nl> + if ( ! GetContext ( ) - > path_data_ . LeftTrimWithRefS ( adc_frenet_frame_point_ ) ) { <nl> + return Stage : : ERROR ; <nl> + } <nl> + if ( GetContext ( ) - > path_data_ . discretized_path ( ) . empty ( ) ) { <nl> + AERROR < < " path data is empty after trim . " ; <nl> + return Stage : : ERROR ; <nl> + } <nl> + for ( const auto & p : GetContext ( ) - > path_data_ . discretized_path ( ) ) { <nl> + ADEBUG < < p . ShortDebugString ( ) ; <nl> + } <nl> + <nl> + / / Get the nearest obstacle . <nl> + / / If the nearest obstacle , provided it exists , is moving , <nl> + / / then quit the side_pass stage . <nl> + const Obstacle * nearest_obstacle = nullptr ; <nl> + if ( ! GetTheNearestObstacle ( * frame , path_decision . obstacles ( ) , <nl> + & nearest_obstacle ) ) { <nl> + AERROR < < " Failed while running the function to get nearest obstacle . " ; <nl> + next_stage_ = ScenarioConfig : : SIDE_PASS_BACKUP ; <nl> + return Stage : : FINISHED ; <nl> + } <nl> + if ( nearest_obstacle ) { <nl> + if ( nearest_obstacle - > speed ( ) > <nl> + GetContext ( ) - > scenario_config_ . block_obstacle_min_speed ( ) ) { <nl> + ADEBUG < < " The nearest obstacle to side - pass is moving . " ; <nl> + next_stage_ = ScenarioConfig : : NO_STAGE ; <nl> + return Stage : : FINISHED ; <nl> + } <nl> + } <nl> + ADEBUG < < " Got the nearest obstacle if there is one . " ; <nl> + <nl> + / / Get the " wait point " . <nl> + PathPoint first_path_point = <nl> + GetContext ( ) - > path_data_ . discretized_path ( ) . front ( ) ; <nl> + PathPoint last_path_point ; <nl> + bool should_not_move_at_all = false ; <nl> + if ( ! GetMoveForwardLastPathPoint ( reference_line , nearest_obstacle , <nl> + & last_path_point , & should_not_move_at_all ) ) { <nl> + ADEBUG < < " Fail to get move forward last path point . " ; <nl> + return Stage : : ERROR ; <nl> + } <nl> + if ( should_not_move_at_all ) { <nl> + ADEBUG < < " The ADC is already at a stop point . " ; <nl> + next_stage_ = ScenarioConfig : : SIDE_PASS_DETECT_SAFETY ; <nl> + return Stage : : FINISHED ; / / return FINISHED if it ' s already at " wait point " . <nl> + } <nl> + ADEBUG < < " first_path_point : " < < first_path_point . ShortDebugString ( ) ; <nl> + ADEBUG < < " last_path_point : " < < last_path_point . ShortDebugString ( ) ; <nl> + double move_forward_distance = last_path_point . s ( ) - first_path_point . s ( ) ; <nl> + ADEBUG < < " move_forward_distance : " < < move_forward_distance ; <nl> + <nl> + / / Wait until everything is clear . <nl> + if ( ! IsFarAwayFromObstacles ( reference_line , path_decision . obstacles ( ) , <nl> + first_path_point , last_path_point ) ) { <nl> + / / Wait here , do nothing this cycle . <nl> + auto & rfl_info = frame - > mutable_reference_line_info ( ) - > front ( ) ; <nl> + * ( rfl_info . mutable_path_data ( ) ) = GetContext ( ) - > path_data_ ; <nl> + * ( rfl_info . mutable_speed_data ( ) ) = <nl> + SpeedProfileGenerator : : GenerateFallbackSpeedProfile ( ) ; <nl> + <nl> + rfl_info . set_trajectory_type ( ADCTrajectory : : NORMAL ) ; <nl> + DiscretizedTrajectory trajectory ; <nl> + if ( ! rfl_info . CombinePathAndSpeedProfile ( <nl> + frame - > PlanningStartPoint ( ) . relative_time ( ) , <nl> + frame - > PlanningStartPoint ( ) . path_point ( ) . s ( ) , & trajectory ) ) { <nl> + AERROR < < " Fail to aggregate planning trajectory . " ; <nl> + return Stage : : RUNNING ; <nl> + } <nl> + rfl_info . SetTrajectory ( trajectory ) ; <nl> + rfl_info . SetDrivable ( true ) ; <nl> + <nl> + ADEBUG < < " Waiting until obstacles are far away . " ; <nl> + return Stage : : RUNNING ; <nl> + } <nl> + <nl> + / / Proceed to the proper wait point , and stop there . <nl> + / / 1 . call proceed with cautious <nl> + constexpr double kSidePassCreepSpeed = 2 . 33 ; / / m / s <nl> + auto & rfl_info = frame - > mutable_reference_line_info ( ) - > front ( ) ; <nl> + * ( rfl_info . mutable_speed_data ( ) ) = <nl> + SpeedProfileGenerator : : GenerateFixedDistanceCreepProfile ( <nl> + move_forward_distance , kSidePassCreepSpeed ) ; <nl> + <nl> + for ( const auto & sd : * rfl_info . mutable_speed_data ( ) ) { <nl> + ADEBUG < < sd . ShortDebugString ( ) ; <nl> + } <nl> + / / 2 . Combine path and speed . <nl> + * ( rfl_info . mutable_path_data ( ) ) = GetContext ( ) - > path_data_ ; <nl> + rfl_info . set_trajectory_type ( ADCTrajectory : : NORMAL ) ; <nl> + DiscretizedTrajectory trajectory ; <nl> + if ( ! rfl_info . CombinePathAndSpeedProfile ( <nl> + frame - > PlanningStartPoint ( ) . relative_time ( ) , <nl> + frame - > PlanningStartPoint ( ) . path_point ( ) . s ( ) , & trajectory ) ) { <nl> + AERROR < < " Fail to aggregate planning trajectory . " ; <nl> + return Stage : : RUNNING ; <nl> + } <nl> + rfl_info . SetTrajectory ( trajectory ) ; <nl> + rfl_info . SetDrivable ( true ) ; <nl> + <nl> + / / If it arrives at the wait point , switch to SIDE_PASS_DETECT_SAFETY . <nl> + constexpr double kBuffer = 0 . 3 ; <nl> + if ( move_forward_distance < kBuffer ) { <nl> + next_stage_ = ScenarioConfig : : SIDE_PASS_DETECT_SAFETY ; <nl> + } <nl> + return Stage : : FINISHED ; <nl> + } <nl> + <nl> + bool StageStopOnWaitPoint : : IsFarAwayFromObstacles ( <nl> + const ReferenceLine & reference_line , <nl> + const IndexedList < std : : string , Obstacle > & indexed_obstacle_list , <nl> + const PathPoint & first_path_point , const PathPoint & last_path_point ) { <nl> + common : : SLPoint first_sl_point ; <nl> + <nl> + if ( ! reference_line . XYToSL ( Vec2d ( first_path_point . x ( ) , first_path_point . y ( ) ) , <nl> + & first_sl_point ) ) { <nl> + AERROR < < " Failed to get the projection from TrajectoryPoint onto " <nl> + " reference_line " ; <nl> + return false ; <nl> + } <nl> + <nl> + common : : SLPoint last_sl_point ; <nl> + if ( ! reference_line . XYToSL ( Vec2d ( last_path_point . x ( ) , last_path_point . y ( ) ) , <nl> + & last_sl_point ) ) { <nl> + AERROR < < " Failed to get the projection from TrajectoryPoint onto " <nl> + " reference_line " ; <nl> + return false ; <nl> + } <nl> + <nl> + / / Go through every obstacle , check if there is any in the no_obs_zone ; <nl> + / / the no_obs_zone must be clear for successful proceed_with_caution . <nl> + for ( const auto * obstacle : indexed_obstacle_list . Items ( ) ) { <nl> + if ( obstacle - > IsVirtual ( ) ) { <nl> + continue ; <nl> + } <nl> + / / Check the s - direction . <nl> + double obs_start_s = obstacle - > PerceptionSLBoundary ( ) . start_s ( ) ; <nl> + double obs_end_s = obstacle - > PerceptionSLBoundary ( ) . end_s ( ) ; <nl> + if ( obs_end_s < first_sl_point . s ( ) | | <nl> + obs_start_s > <nl> + last_sl_point . s ( ) + kSExtraMarginforStopOnWaitPointStage ) { <nl> + continue ; <nl> + } <nl> + / / Check the l - direction . <nl> + double lane_left_width_at_start_s = 0 . 0 ; <nl> + double lane_left_width_at_end_s = 0 . 0 ; <nl> + double lane_right_width_at_start_s = 0 . 0 ; <nl> + double lane_right_width_at_end_s = 0 . 0 ; <nl> + reference_line . GetLaneWidth ( obs_start_s , & lane_left_width_at_start_s , <nl> + & lane_right_width_at_start_s ) ; <nl> + reference_line . GetLaneWidth ( obs_end_s , & lane_left_width_at_end_s , <nl> + & lane_right_width_at_end_s ) ; <nl> + double lane_left_width = std : : min ( std : : abs ( lane_left_width_at_start_s ) , <nl> + std : : abs ( lane_left_width_at_end_s ) ) ; <nl> + double lane_right_width = std : : min ( std : : abs ( lane_right_width_at_start_s ) , <nl> + std : : abs ( lane_right_width_at_end_s ) ) ; <nl> + double obs_start_l = obstacle - > PerceptionSLBoundary ( ) . start_l ( ) ; <nl> + double obs_end_l = obstacle - > PerceptionSLBoundary ( ) . end_l ( ) ; <nl> + if ( obs_start_l < lane_left_width & & - obs_end_l < lane_right_width ) { <nl> + return false ; <nl> + } <nl> + } <nl> + return true ; <nl> + } <nl> + <nl> + bool StageStopOnWaitPoint : : GetTheNearestObstacle ( <nl> + const Frame & frame , <nl> + const IndexedList < std : : string , Obstacle > & indexed_obstacle_list , <nl> + const Obstacle * * nearest_obstacle ) { <nl> + / / Sanity checks . <nl> + if ( frame . reference_line_info ( ) . size ( ) > 1 ) { <nl> + return false ; <nl> + } <nl> + * nearest_obstacle = nullptr ; <nl> + <nl> + / / Get the closest front blocking obstacle . <nl> + double distance_to_closest_blocking_obstacle = - 100 . 0 ; <nl> + bool exists_a_blocking_obstacle = false ; <nl> + for ( const auto * obstacle : indexed_obstacle_list . Items ( ) ) { <nl> + if ( IsBlockingObstacleToSidePass ( <nl> + frame , obstacle , <nl> + GetContext ( ) - > scenario_config_ . block_obstacle_min_speed ( ) , <nl> + GetContext ( ) - > scenario_config_ . min_front_obstacle_distance ( ) , <nl> + GetContext ( ) - > scenario_config_ . enable_obstacle_blocked_check ( ) ) ) { <nl> + exists_a_blocking_obstacle = true ; <nl> + double distance_between_adc_and_obstacle = <nl> + GetDistanceBetweenADCAndObstacle ( frame , obstacle ) ; <nl> + if ( distance_to_closest_blocking_obstacle < 0 . 0 | | <nl> + distance_between_adc_and_obstacle < <nl> + distance_to_closest_blocking_obstacle ) { <nl> + distance_to_closest_blocking_obstacle = <nl> + distance_between_adc_and_obstacle ; <nl> + * nearest_obstacle = obstacle ; <nl> + } <nl> + } <nl> + } <nl> + return exists_a_blocking_obstacle ; <nl> + } <nl> + <nl> + bool StageStopOnWaitPoint : : GetMoveForwardLastPathPoint ( <nl> + const ReferenceLine & reference_line , const Obstacle * nearest_obstacle , <nl> + PathPoint * const last_path_point , bool * should_not_move_at_all ) { <nl> + * should_not_move_at_all = false ; <nl> + int count = 0 ; <nl> + <nl> + bool exist_nearest_obs = ( nearest_obstacle ! = nullptr ) ; <nl> + double s_max = 0 . 0 ; <nl> + if ( exist_nearest_obs ) { <nl> + ADEBUG < < " There exists a nearest obstacle . " ; <nl> + s_max = nearest_obstacle - > PerceptionSLBoundary ( ) . start_s ( ) ; <nl> + } <nl> + <nl> + for ( const auto & path_point : GetContext ( ) - > path_data_ . discretized_path ( ) ) { <nl> + / / Get the four corner points ABCD of ADC at every path point , <nl> + / / and keep checking until it gets out of the current lane or <nl> + / / reaches the nearest obstacle ( in the same lane ) ahead . <nl> + const auto & vehicle_box = <nl> + common : : VehicleConfigHelper : : Instance ( ) - > GetBoundingBox ( path_point ) ; <nl> + std : : vector < Vec2d > ABCDpoints = vehicle_box . GetAllCorners ( ) ; <nl> + bool is_out_of_curr_lane = false ; <nl> + for ( size_t i = 0 ; i < ABCDpoints . size ( ) ; i + + ) { <nl> + / / For each corner point , project it onto reference_line <nl> + common : : SLPoint curr_point_sl ; <nl> + if ( ! reference_line . XYToSL ( ABCDpoints [ i ] , & curr_point_sl ) ) { <nl> + AERROR < < " Failed to get the projection from point onto " <nl> + " reference_line " ; <nl> + return false ; <nl> + } <nl> + / / Get the lane width at the current s indicated by path_point <nl> + double curr_point_left_width = 0 . 0 ; <nl> + double curr_point_right_width = 0 . 0 ; <nl> + reference_line . GetLaneWidth ( curr_point_sl . s ( ) , & curr_point_left_width , <nl> + & curr_point_right_width ) ; <nl> + / / Check if this corner point is within the lane : <nl> + if ( curr_point_sl . l ( ) > std : : abs ( curr_point_left_width ) - <nl> + kLExtraMarginforStopOnWaitPointStage | | <nl> + curr_point_sl . l ( ) < - std : : abs ( curr_point_right_width ) + <nl> + kLExtraMarginforStopOnWaitPointStage ) { <nl> + is_out_of_curr_lane = true ; <nl> + break ; <nl> + } <nl> + / / Check if this corner point is before the nearest obstacle : <nl> + if ( exist_nearest_obs & & curr_point_sl . s ( ) > s_max ) { <nl> + is_out_of_curr_lane = true ; <nl> + break ; <nl> + } <nl> + } <nl> + <nl> + if ( is_out_of_curr_lane ) { <nl> + if ( count = = 0 ) { <nl> + / / The current ADC , without moving at all , is already at least <nl> + / / partially out of the current lane . <nl> + * should_not_move_at_all = true ; <nl> + return true ; <nl> + } <nl> + break ; <nl> + } else { <nl> + * last_path_point = path_point ; <nl> + } <nl> + <nl> + CHECK_GE ( path_point . s ( ) , 0 . 0 ) ; <nl> + + + count ; <nl> + } <nl> + return true ; <nl> + } <nl> + <nl> + } / / namespace side_pass <nl> + } / / namespace scenario <nl> + } / / namespace planning <nl> + } / / namespace apollo <nl> new file mode 100644 <nl> index 00000000000 . . 5414f0ed35a <nl> mmm / dev / null <nl> ppp b / modules / planning / scenarios / side_pass / stage_stop_on_wait_point . h <nl> <nl> + / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> + * Copyright 2018 The Apollo Authors . All Rights Reserved . <nl> + * <nl> + * Licensed under the Apache License , Version 2 . 0 ( the " License " ) ; <nl> + * you may not use this file except in compliance with the License . <nl> + * You may obtain a copy of the License at <nl> + * <nl> + * http : / / www . apache . org / licenses / LICENSE - 2 . 0 <nl> + * <nl> + * Unless required by applicable law or agreed to in writing , software <nl> + * distributed under the License is distributed on an " AS IS " BASIS , <nl> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied . <nl> + * See the License for the specific language governing permissions and <nl> + * limitations under the License . <nl> + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / <nl> + <nl> + / * * <nl> + * @ file <nl> + * * / <nl> + <nl> + # pragma once <nl> + <nl> + # include < string > <nl> + <nl> + # include " modules / planning / scenarios / side_pass / side_pass_scenario . h " <nl> + # include " modules / planning / scenarios / stage . h " <nl> + <nl> + namespace apollo { <nl> + namespace planning { <nl> + namespace scenario { <nl> + namespace side_pass { <nl> + <nl> + struct SidePassContext ; <nl> + <nl> + / * * <nl> + * @ brief : <nl> + * STAGE : SidePassStopOnWaitPoint <nl> + * Notations : <nl> + * <nl> + * front of car <nl> + * A + mmmmmmmmm - + B <nl> + * | | <nl> + * / / <nl> + * | | <nl> + * | | <nl> + * | | <nl> + * | X | O <nl> + * | < - - > . < mmm - | mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - - > * ( turn center ) <nl> + * | | VehicleParam . min_turn_radius ( ) <nl> + * | | <nl> + * D + mmmmmmmmm - + C <nl> + * back of car <nl> + * <nl> + * / <nl> + class StageStopOnWaitPoint : public Stage { <nl> + public : <nl> + explicit StageStopOnWaitPoint ( const ScenarioConfig : : StageConfig & config ) <nl> + : Stage ( config ) { } <nl> + Stage : : StageStatus Process ( const common : : TrajectoryPoint & planning_init_point , <nl> + Frame * frame ) override ; <nl> + SidePassContext * GetContext ( ) { return GetContextAs < SidePassContext > ( ) ; } <nl> + <nl> + private : <nl> + bool IsFarAwayFromObstacles ( <nl> + const ReferenceLine & reference_line , <nl> + const IndexedList < std : : string , Obstacle > & indexed_obstacle_list , <nl> + const common : : PathPoint & first_path_point , <nl> + const common : : PathPoint & last_path_point ) ; <nl> + bool GetTheNearestObstacle ( <nl> + const Frame & frame , <nl> + const IndexedList < std : : string , Obstacle > & indexed_obstacle_list , <nl> + const Obstacle * * nearest_obstacle ) ; <nl> + bool GetMoveForwardLastPathPoint ( const ReferenceLine & reference_line , <nl> + const Obstacle * nearest_obstacle , <nl> + common : : PathPoint * const last_path_point , <nl> + bool * should_not_move_at_all ) ; <nl> + } ; <nl> + <nl> + } / / namespace side_pass <nl> + } / / namespace scenario <nl> + } / / namespace planning <nl> + } / / namespace apollo <nl> | planning : add back master side pass code | ApolloAuto/apollo | 106756fe2917cfaa499a30a562b282658e3d8ea8 | 2019-04-09T17:36:33Z |
mmm a / tensorflow / core / kernels / sdca_ops . cc <nl> ppp b / tensorflow / core / kernels / sdca_ops . cc <nl> See the License for the specific language governing permissions and <nl> limitations under the License . <nl> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = * / <nl> <nl> - / / See docs in . / ops / sdca_ops . cc . <nl> + / / See docs in . . / ops / sdca_ops . cc . <nl> <nl> # define EIGEN_USE_THREADS <nl> <nl> using UnalignedInt64Vector = TTypes < const int64 > : : UnalignedConstVec ; <nl> <nl> / / Statistics computed with input ( ModelWeights , Example ) . <nl> struct ExampleStatistics { <nl> - / / feature_weights dot feature_values for the example . <nl> - double wx = 0 ; <nl> - / / dot product using the previous weights <nl> - double prev_wx = 0 ; <nl> - / / sum of squared feature values occurring in the example divided by <nl> + / / Logits for each class . <nl> + / / For binary case , this should be a vector of length 1 ; while for multiclass <nl> + / / case , this vector has the same length as the number of classes , where each <nl> + / / value corresponds to one class . <nl> + / / Using InlinedVector is to avoid heap allocation for small number of <nl> + / / classes , and 3 is chosen to minimize memory usage for the multiclass case . <nl> + gtl : : InlinedVector < double , 3 > wx ; <nl> + <nl> + / / Multiplication using the previous weights . <nl> + gtl : : InlinedVector < double , 3 > prev_wx ; <nl> + <nl> + / / Sum of squared feature values occurring in the example divided by <nl> / / L2 * sum ( example_weights ) . <nl> double normalized_squared_norm = 0 ; <nl> + <nl> + / / Num_weight_vectors equals to the number of classification classes in the <nl> + / / multiclass case ; while for binary case , it is 1 . <nl> + ExampleStatistics ( const int num_weight_vectors ) <nl> + : wx ( num_weight_vectors , 0 . 0 ) , prev_wx ( num_weight_vectors , 0 . 0 ) { } <nl> } ; <nl> <nl> class Regularizations { <nl> class Regularizations { <nl> } <nl> <nl> / / Vectorized float variant of the above . <nl> - Eigen : : Tensor < float , 1 , Eigen : : RowMajor > EigenShrink ( <nl> + Eigen : : Tensor < float , 1 , Eigen : : RowMajor > EigenShrinkVector ( <nl> const Eigen : : Tensor < float , 1 , Eigen : : RowMajor > weights ) const { <nl> / / Proximal step on the weights which is sign ( w ) * | w - shrinkage | + . <nl> return weights . sign ( ) * ( ( weights . abs ( ) - weights . constant ( shrinkage_ ) ) <nl> . cwiseMax ( weights . constant ( 0 . 0 ) ) ) ; <nl> } <nl> <nl> + / / Matrix float variant of the above . <nl> + Eigen : : Tensor < float , 2 , Eigen : : RowMajor > EigenShrinkMatrix ( <nl> + const Eigen : : Tensor < float , 2 , Eigen : : RowMajor > weights ) const { <nl> + / / Proximal step on the weights which is sign ( w ) * | w - shrinkage | + . <nl> + return weights . sign ( ) * ( ( weights . abs ( ) - weights . constant ( shrinkage_ ) ) <nl> + . cwiseMax ( weights . constant ( 0 . 0 ) ) ) ; <nl> + } <nl> + <nl> float symmetric_l2 ( ) const { return symmetric_l2_ ; } <nl> <nl> private : <nl> class ModelWeights ; <nl> / / Struct describing a single example . <nl> class Example { <nl> public : <nl> - / / Compute dot product between weights , and example feature values . This <nl> - / / method also computes the normalized example norm used in SDCA update . <nl> + / / Compute matrix vector product between weights ( a matrix ) and features <nl> + / / ( a vector ) . This method also computes the normalized example norm used <nl> + / / in SDCA update . <nl> + / / For multiclass case , num_weight_vectors equals to the number of classes ; <nl> + / / while for binary case , it is 1 . <nl> const ExampleStatistics ComputeWxAndWeightedExampleNorm ( <nl> const int num_loss_partitions , const ModelWeights & model_weights , <nl> - const Regularizations & regularization ) const ; <nl> + const Regularizations & regularization , <nl> + const int num_weight_vectors ) const ; <nl> <nl> float example_label ( ) const { return example_label_ ; } <nl> <nl> class Example { <nl> / / Returns a row slice from the matrix . <nl> Eigen : : TensorMap < Eigen : : Tensor < const float , 1 , Eigen : : RowMajor > > row ( ) <nl> const { <nl> - / / TensorMap to a row slice of the matrix . <nl> return Eigen : : TensorMap < Eigen : : Tensor < const float , 1 , Eigen : : RowMajor > > ( <nl> data_matrix . data ( ) + row_index * data_matrix . dimension ( 1 ) , <nl> data_matrix . dimension ( 1 ) ) ; <nl> } <nl> <nl> + / / Returns a row slice as a 1 * F matrix , where F is the number of features . <nl> + Eigen : : TensorMap < Eigen : : Tensor < const float , 2 , Eigen : : RowMajor > > <nl> + row_as_matrix ( ) const { <nl> + return Eigen : : TensorMap < Eigen : : Tensor < const float , 2 , Eigen : : RowMajor > > ( <nl> + data_matrix . data ( ) + row_index * data_matrix . dimension ( 1 ) , 1 , <nl> + data_matrix . dimension ( 1 ) ) ; <nl> + } <nl> + <nl> const TTypes < float > : : ConstMatrix data_matrix ; <nl> const int64 row_index ; <nl> } ; <nl> class Example { <nl> / / delta weight which the optimizer learns in each call to the optimizer . <nl> class FeatureWeightsDenseStorage { <nl> public : <nl> - FeatureWeightsDenseStorage ( const TTypes < const float > : : Vec nominals , <nl> - TTypes < float > : : Vec deltas ) <nl> + FeatureWeightsDenseStorage ( const TTypes < const float > : : Matrix nominals , <nl> + TTypes < float > : : Matrix deltas ) <nl> : nominals_ ( nominals ) , deltas_ ( deltas ) { } <nl> <nl> / / Check if a feature index is with - in the bounds . <nl> bool IndexValid ( const int64 index ) const { <nl> - return index > = 0 & & index < deltas_ . size ( ) ; <nl> + return index > = 0 & & index < deltas_ . dimension ( 1 ) ; <nl> } <nl> <nl> - / / Nominals here are the original weight vector . <nl> - TTypes < const float > : : Vec nominals ( ) const { return nominals_ ; } <nl> + / / Nominals here are the original weight matrix . <nl> + TTypes < const float > : : Matrix nominals ( ) const { return nominals_ ; } <nl> <nl> / / Delta weights durining mini - batch updates . <nl> - TTypes < float > : : Vec deltas ( ) const { return deltas_ ; } <nl> - <nl> - / / Nominal value at a particular feature index . <nl> - float nominals ( const int64 index ) const { return nominals_ ( index ) ; } <nl> - <nl> - / / Delta value at a particular feature index . <nl> - float deltas ( const int64 index ) const { return deltas_ ( index ) ; } <nl> + TTypes < float > : : Matrix deltas ( ) const { return deltas_ ; } <nl> <nl> / / Updates delta weights based on active dense features in the example and <nl> / / the corresponding dual residual . <nl> - void UpdateDenseDeltaWeights ( const Eigen : : ThreadPoolDevice & device , <nl> - const Example : : DenseVector & dense_vector , <nl> - const double normalized_bounded_dual_delta ) { <nl> + void UpdateDenseDeltaWeights ( <nl> + const Eigen : : ThreadPoolDevice & device , <nl> + const Example : : DenseVector & dense_vector , <nl> + const std : : vector < double > & normalized_bounded_dual_delta ) { <nl> + / / Transform the dual vector into a column matrix . <nl> + const Eigen : : TensorMap < Eigen : : Tensor < const double , 2 , Eigen : : RowMajor > > <nl> + dual_matrix ( normalized_bounded_dual_delta . data ( ) , <nl> + normalized_bounded_dual_delta . size ( ) , 1 ) ; <nl> + const Eigen : : array < Eigen : : IndexPair < int > , 1 > product_dims = { <nl> + Eigen : : IndexPair < int > ( 1 , 0 ) } ; <nl> + / / This essentially computes delta_w + = delta_vector / \ lamdba * N . <nl> deltas_ . device ( device ) = <nl> - deltas_ + <nl> - dense_vector . row ( ) * deltas_ . constant ( normalized_bounded_dual_delta ) ; <nl> + ( deltas_ . cast < double > ( ) + <nl> + dual_matrix . contract ( dense_vector . row_as_matrix ( ) . cast < double > ( ) , <nl> + product_dims ) ) <nl> + . cast < float > ( ) ; <nl> } <nl> <nl> private : <nl> / / The nominal value of the weight for a feature ( indexed by its id ) . <nl> - const TTypes < const float > : : Vec nominals_ ; <nl> + const TTypes < const float > : : Matrix nominals_ ; <nl> / / The accumulated delta weight for a feature ( indexed by its id ) . <nl> - TTypes < float > : : Vec deltas_ ; <nl> + TTypes < float > : : Matrix deltas_ ; <nl> } ; <nl> <nl> / / Similar to FeatureWeightsDenseStorage , but the underlying weights are stored <nl> - / / a hash map . <nl> + / / in an unordered map . <nl> class FeatureWeightsSparseStorage { <nl> public : <nl> FeatureWeightsSparseStorage ( const TTypes < const int64 > : : Vec indices , <nl> - const TTypes < const float > : : Vec nominals , <nl> - TTypes < float > : : Vec deltas ) <nl> + const TTypes < const float > : : Matrix nominals , <nl> + TTypes < float > : : Matrix deltas ) <nl> : nominals_ ( nominals ) , deltas_ ( deltas ) { <nl> / / Create a map from sparse index to the dense index of the underlying <nl> / / storage . <nl> - for ( int j = 0 ; j < indices . size ( ) ; + + j ) { <nl> + for ( int64 j = 0 ; j < indices . size ( ) ; + + j ) { <nl> indices_to_id_ [ indices ( j ) ] = j ; <nl> } <nl> } <nl> class FeatureWeightsSparseStorage { <nl> return indices_to_id_ . find ( index ) ! = indices_to_id_ . end ( ) ; <nl> } <nl> <nl> - / / Nominal value at a particular feature index . <nl> - float nominals ( const int64 index ) const { <nl> + / / Nominal value at a particular feature index and class label . <nl> + float nominals ( const int class_id , const int64 index ) const { <nl> auto it = indices_to_id_ . find ( index ) ; <nl> - return nominals_ ( it - > second ) ; <nl> + return nominals_ ( class_id , it - > second ) ; <nl> } <nl> <nl> / / Delta weights durining mini - batch updates . <nl> - float deltas ( const int64 index ) const { <nl> + float deltas ( const int class_id , const int64 index ) const { <nl> auto it = indices_to_id_ . find ( index ) ; <nl> - return deltas_ ( it - > second ) ; <nl> + return deltas_ ( class_id , it - > second ) ; <nl> } <nl> <nl> / / Updates delta weights based on active sparse features in the example and <nl> / / the corresponding dual residual . <nl> - void UpdateSparseDeltaWeights ( const Eigen : : ThreadPoolDevice & device , <nl> - const Example : : SparseFeatures & sparse_features , <nl> - const double normalized_bounded_dual_delta ) { <nl> + void UpdateSparseDeltaWeights ( <nl> + const Eigen : : ThreadPoolDevice & device , <nl> + const Example : : SparseFeatures & sparse_features , <nl> + const std : : vector < double > & normalized_bounded_dual_delta ) { <nl> for ( int64 k = 0 ; k < sparse_features . indices - > size ( ) ; + + k ) { <nl> const double feature_value = sparse_features . values = = nullptr <nl> ? 1 . 0 <nl> : ( * sparse_features . values ) ( k ) ; <nl> auto it = indices_to_id_ . find ( ( * sparse_features . indices ) ( k ) ) ; <nl> - deltas_ ( it - > second ) + = feature_value * normalized_bounded_dual_delta ; <nl> + for ( size_t l = 0 ; l < normalized_bounded_dual_delta . size ( ) ; + + l ) { <nl> + deltas_ ( l , it - > second ) + = <nl> + feature_value * normalized_bounded_dual_delta [ l ] ; <nl> + } <nl> } <nl> } <nl> <nl> private : <nl> / / The nominal value of the weight for a feature ( indexed by its id ) . <nl> - const TTypes < const float > : : Vec nominals_ ; <nl> + const TTypes < const float > : : Matrix nominals_ ; <nl> / / The accumulated delta weight for a feature ( indexed by its id ) . <nl> - TTypes < float > : : Vec deltas_ ; <nl> + TTypes < float > : : Matrix deltas_ ; <nl> / / Map from feature index to an index to the dense vector . <nl> std : : unordered_map < int64 , int64 > indices_to_id_ ; <nl> } ; <nl> class ModelWeights { <nl> <nl> / / Go through all the features present in the example , and update the <nl> / / weights based on the dual delta . <nl> - void UpdateDeltaWeights ( const Eigen : : ThreadPoolDevice & device , <nl> - const Example & example , <nl> - const double normalized_bounded_dual_delta ) { <nl> + void UpdateDeltaWeights ( <nl> + const Eigen : : ThreadPoolDevice & device , const Example & example , <nl> + const std : : vector < double > & normalized_bounded_dual_delta ) { <nl> / / Sparse weights . <nl> for ( size_t j = 0 ; j < sparse_weights_ . size ( ) ; + + j ) { <nl> sparse_weights_ [ j ] . UpdateSparseDeltaWeights ( <nl> class ModelWeights { <nl> Tensor * delta_t ; <nl> sparse_weights_outputs . allocate ( i , sparse_weights_inputs [ i ] . shape ( ) , <nl> & delta_t ) ; <nl> - auto deltas = delta_t - > flat < float > ( ) ; <nl> + / / Convert the input vector to a row matrix in internal representation . <nl> + auto deltas = delta_t - > shaped < float , 2 > ( { 1 , delta_t - > NumElements ( ) } ) ; <nl> deltas . setZero ( ) ; <nl> sparse_weights_ . emplace_back ( FeatureWeightsSparseStorage { <nl> sparse_indices_inputs [ i ] . flat < int64 > ( ) , <nl> - sparse_weights_inputs [ i ] . flat < float > ( ) , deltas } ) ; <nl> + sparse_weights_inputs [ i ] . shaped < float , 2 > ( <nl> + { 1 , sparse_weights_inputs [ i ] . NumElements ( ) } ) , <nl> + deltas } ) ; <nl> } <nl> <nl> / / Reads in the weights , and allocates and initializes the delta weights . <nl> class ModelWeights { <nl> for ( int i = 0 ; i < weight_inputs . size ( ) ; + + i ) { <nl> Tensor * delta_t ; <nl> weight_outputs - > allocate ( i , weight_inputs [ i ] . shape ( ) , & delta_t ) ; <nl> - auto deltas = delta_t - > flat < float > ( ) ; <nl> + / / Convert the input vector to a row matrix in internal representation . <nl> + auto deltas = delta_t - > shaped < float , 2 > ( { 1 , delta_t - > NumElements ( ) } ) ; <nl> deltas . setZero ( ) ; <nl> feature_weights - > emplace_back ( <nl> - FeatureWeightsDenseStorage { weight_inputs [ i ] . flat < float > ( ) , deltas } ) ; <nl> + FeatureWeightsDenseStorage { weight_inputs [ i ] . shaped < float , 2 > ( <nl> + { 1 , weight_inputs [ i ] . NumElements ( ) } ) , <nl> + deltas } ) ; <nl> } <nl> } ; <nl> <nl> class ModelWeights { <nl> / / as we need definition of ModelWeights and Regularizations . <nl> const ExampleStatistics Example : : ComputeWxAndWeightedExampleNorm ( <nl> const int num_loss_partitions , const ModelWeights & model_weights , <nl> - const Regularizations & regularization ) const { <nl> - ExampleStatistics result ; <nl> + const Regularizations & regularization , const int num_weight_vectors ) const { <nl> + ExampleStatistics result ( num_weight_vectors ) ; <nl> <nl> result . normalized_squared_norm = <nl> squared_norm_ / regularization . symmetric_l2 ( ) ; <nl> <nl> - / / Compute the w \ dot x and prev_w \ dot x . <nl> - <nl> - / / Sparse features contribution . <nl> + / / Compute w \ dot x and prev_w \ dot x . <nl> + / / This is for sparse features contribution to the logit . <nl> for ( size_t j = 0 ; j < sparse_features_ . size ( ) ; + + j ) { <nl> const Example : : SparseFeatures & sparse_features = sparse_features_ [ j ] ; <nl> const FeatureWeightsSparseStorage & sparse_weights = <nl> const ExampleStatistics Example : : ComputeWxAndWeightedExampleNorm ( <nl> const double feature_value = sparse_features . values = = nullptr <nl> ? 1 . 0 <nl> : ( * sparse_features . values ) ( k ) ; <nl> - const double feature_weight = <nl> - sparse_weights . nominals ( feature_index ) + <nl> - sparse_weights . deltas ( feature_index ) * num_loss_partitions ; <nl> - result . prev_wx + = <nl> - feature_value * <nl> - regularization . Shrink ( sparse_weights . nominals ( feature_index ) ) ; <nl> - result . wx + = feature_value * regularization . Shrink ( feature_weight ) ; <nl> + for ( int l = 0 ; l < num_weight_vectors ; + + l ) { <nl> + const float sparse_weight = sparse_weights . nominals ( l , feature_index ) ; <nl> + const double feature_weight = <nl> + sparse_weight + <nl> + sparse_weights . deltas ( l , feature_index ) * num_loss_partitions ; <nl> + result . prev_wx [ l ] + = <nl> + feature_value * regularization . Shrink ( sparse_weight ) ; <nl> + result . wx [ l ] + = feature_value * regularization . Shrink ( feature_weight ) ; <nl> + } <nl> } <nl> } <nl> <nl> - / / Dense features contribution . <nl> + / / Compute w \ dot x and prev_w \ dot x . <nl> + / / This is for dense features contribution to the logit . <nl> for ( size_t j = 0 ; j < dense_vectors_ . size ( ) ; + + j ) { <nl> const Example : : DenseVector & dense_vector = * dense_vectors_ [ j ] ; <nl> const FeatureWeightsDenseStorage & dense_weights = <nl> model_weights . dense_weights ( ) [ j ] ; <nl> <nl> - const Eigen : : Tensor < float , 1 , Eigen : : RowMajor > feature_weights = <nl> + const Eigen : : Tensor < float , 2 , Eigen : : RowMajor > feature_weights = <nl> dense_weights . nominals ( ) + <nl> dense_weights . deltas ( ) * <nl> dense_weights . deltas ( ) . constant ( num_loss_partitions ) ; <nl> - const Eigen : : Tensor < float , 0 , Eigen : : RowMajor > prev_prediction = <nl> - ( dense_vector . row ( ) * <nl> - regularization . EigenShrink ( dense_weights . nominals ( ) ) ) <nl> - . sum ( ) ; <nl> - const Eigen : : Tensor < float , 0 , Eigen : : RowMajor > prediction = <nl> - ( dense_vector . row ( ) * regularization . EigenShrink ( feature_weights ) ) <nl> - . sum ( ) ; <nl> - result . prev_wx + = prev_prediction ( ) ; <nl> - result . wx + = prediction ( ) ; <nl> + const Eigen : : array < Eigen : : IndexPair < int > , 1 > product_dims = { <nl> + Eigen : : IndexPair < int > ( 1 , 1 ) } ; <nl> + const Eigen : : Tensor < float , 2 , Eigen : : RowMajor > prev_prediction = <nl> + regularization . EigenShrinkMatrix ( dense_weights . nominals ( ) ) <nl> + . contract ( dense_vector . row_as_matrix ( ) , product_dims ) ; <nl> + const Eigen : : Tensor < float , 2 , Eigen : : RowMajor > prediction = <nl> + regularization . EigenShrinkMatrix ( feature_weights ) <nl> + . contract ( dense_vector . row_as_matrix ( ) , product_dims ) ; <nl> + / / The result of " tensor contraction " ( multiplication ) in the code <nl> + / / above is of dimension num_weight_vectors * 1 . <nl> + for ( int l = 0 ; l < num_weight_vectors ; + + l ) { <nl> + result . prev_wx [ l ] + = prev_prediction ( l , 0 ) ; <nl> + result . wx [ l ] + = prediction ( l , 0 ) ; <nl> + } <nl> } <nl> <nl> return result ; <nl> class Examples { <nl> return id ; <nl> } <nl> <nl> - void SampleAdaptativeProbabilities ( <nl> + / / Adaptive SDCA in the current implementation only works for <nl> + / / binary classification , where the input argument for num_weight_vectors <nl> + / / is 1 . <nl> + Status SampleAdaptativeProbabilities ( <nl> const int num_loss_partitions , const Regularizations & regularization , <nl> const ModelWeights & model_weights , <nl> const TTypes < float > : : Matrix example_state_data , <nl> - const std : : unique_ptr < DualLossUpdater > & loss_updater ) { <nl> + const std : : unique_ptr < DualLossUpdater > & loss_updater , <nl> + const int num_weight_vectors = 1 ) { <nl> + if ( num_weight_vectors ! = 1 ) { <nl> + return errors : : InvalidArgument ( <nl> + " Adaptive SDCA only works with binary SDCA , " <nl> + " where num_weight_vectors should be 1 . " ) ; <nl> + } <nl> / / Compute the probabilities <nl> for ( int example_id = 0 ; example_id < num_examples ( ) ; + + example_id ) { <nl> const Example & example = examples_ [ example_id ] ; <nl> class Examples { <nl> float label = example . example_label ( ) ; <nl> const Status conversion_status = loss_updater - > ConvertLabel ( & label ) ; <nl> const ExampleStatistics example_statistics = <nl> - example . ComputeWxAndWeightedExampleNorm ( <nl> - num_loss_partitions , model_weights , regularization ) ; <nl> + example . ComputeWxAndWeightedExampleNorm ( num_loss_partitions , <nl> + model_weights , regularization , <nl> + num_weight_vectors ) ; <nl> const double kappa = example_state_data ( example_id , 0 ) + <nl> loss_updater - > PrimalLossDerivative ( <nl> - example_statistics . wx , label , example_weight ) ; <nl> + example_statistics . wx [ 0 ] , label , example_weight ) ; <nl> probabilities_ [ example_id ] = <nl> example_weight * sqrt ( examples_ [ example_id ] . squared_norm_ + <nl> regularization . symmetric_l2 ( ) * <nl> class Examples { <nl> for ( int i = id ; i < num_examples ( ) ; + + i ) { <nl> sampled_count_ [ i ] = examples_not_seen [ i - id ] . first ; <nl> } <nl> + return Status : : OK ( ) ; <nl> } <nl> <nl> int num_examples ( ) const { return examples_ . size ( ) ; } <nl> Status Examples : : Initialize ( OpKernelContext * const context , <nl> <nl> if ( example_weights . size ( ) > = std : : numeric_limits < int > : : max ( ) ) { <nl> return errors : : InvalidArgument ( strings : : Printf ( <nl> - " Too many examples in a mini - batch : % ld > % d " , example_weights . size ( ) , <nl> + " Too many examples in a mini - batch : % zu > % d " , example_weights . size ( ) , <nl> std : : numeric_limits < int > : : max ( ) ) ) ; <nl> } <nl> <nl> struct ComputeOptions { <nl> Regularizations regularizations ; <nl> } ; <nl> <nl> + / / TODO ( shengx ) : The helper classes / methods are changed to support multiclass <nl> + / / SDCA , which lead to changes within this function . Need to revisit the <nl> + / / convergence once the multiclass SDCA is in . <nl> void DoCompute ( const ComputeOptions & options , OpKernelContext * const context ) { <nl> ModelWeights model_weights ; <nl> OP_REQUIRES_OK ( context , model_weights . Initialize ( context ) ) ; <nl> void DoCompute ( const ComputeOptions & options , OpKernelContext * const context ) { <nl> context - > set_output ( " out_example_state_data " , mutable_example_state_data_t ) ; <nl> <nl> if ( options . adaptative ) { <nl> - examples . SampleAdaptativeProbabilities ( <nl> - options . num_loss_partitions , options . regularizations , model_weights , <nl> - example_state_data , options . loss_updater ) ; <nl> + OP_REQUIRES_OK ( <nl> + context , examples . SampleAdaptativeProbabilities ( <nl> + options . num_loss_partitions , options . regularizations , <nl> + model_weights , example_state_data , options . loss_updater ) ) ; <nl> } <nl> <nl> mutex mu ; <nl> void DoCompute ( const ComputeOptions & options , OpKernelContext * const context ) { <nl> <nl> / / Compute wx , example norm weighted by regularization , dual loss , <nl> / / primal loss . <nl> + / / For binary SDCA , num_weight_vectors should be one . <nl> const ExampleStatistics example_statistics = <nl> - example . ComputeWxAndWeightedExampleNorm ( options . num_loss_partitions , <nl> - model_weights , <nl> - options . regularizations ) ; <nl> + example . ComputeWxAndWeightedExampleNorm ( <nl> + options . num_loss_partitions , model_weights , <nl> + options . regularizations , 1 / * num_weight_vectors * / ) ; <nl> <nl> const double new_dual = options . loss_updater - > ComputeUpdatedDual ( <nl> options . num_loss_partitions , example_label , example_weight , dual , <nl> - example_statistics . wx , example_statistics . normalized_squared_norm ) ; <nl> + example_statistics . wx [ 0 ] , example_statistics . normalized_squared_norm ) ; <nl> <nl> / / Compute new weights . <nl> const double normalized_bounded_dual_delta = <nl> ( new_dual - dual ) * example_weight / <nl> options . regularizations . symmetric_l2 ( ) ; <nl> - model_weights . UpdateDeltaWeights ( context - > eigen_cpu_device ( ) , example , <nl> - normalized_bounded_dual_delta ) ; <nl> + model_weights . UpdateDeltaWeights ( <nl> + context - > eigen_cpu_device ( ) , example , <nl> + std : : vector < double > { normalized_bounded_dual_delta } ) ; <nl> <nl> / / Update example data . <nl> example_state_data ( example_index , 0 ) = new_dual ; <nl> example_state_data ( example_index , 1 ) = <nl> options . loss_updater - > ComputePrimalLoss ( <nl> - example_statistics . prev_wx , example_label , example_weight ) ; <nl> + example_statistics . prev_wx [ 0 ] , example_label , example_weight ) ; <nl> example_state_data ( example_index , 2 ) = <nl> options . loss_updater - > ComputeDualLoss ( dual , example_label , <nl> example_weight ) ; <nl> class SdcaShrinkL1 : public OpKernel { <nl> for ( int i = begin ; i < end ; + + i ) { <nl> auto prox_w = weights_inputs . at ( i , / * lock_held = * / true ) . flat < float > ( ) ; <nl> prox_w . device ( context - > eigen_cpu_device ( ) ) = <nl> - regularizations_ . EigenShrink ( prox_w ) ; <nl> + regularizations_ . EigenShrinkVector ( prox_w ) ; <nl> } <nl> } ; <nl> <nl> | Change the interface of helper classes / methods in sdca_ops . cc to support multiclass SDCA . | tensorflow/tensorflow | 5e48873977dc8827848eeae6cf0db2ef549cce10 | 2016-10-20T21:21:45Z |
mmm a / contracts / eosiolib / rpc . dox <nl> ppp b / contracts / eosiolib / rpc . dox <nl> Create a new wallet with the given name <nl> <nl> @ subsubsection examplewalletcreate Example wallet_create Usage <nl> ` ` ` <nl> - $ curl http : / / localhost : 8889 / v1 / wallet / create - X POST - d ' " default " ' <nl> + $ curl http : / / localhost : 8888 / v1 / wallet / create - X POST - d ' " default " ' <nl> ` ` ` <nl> <nl> @ subsubsection examplewalletcreateresult Example wallet_create Result <nl> Open an existing wallet of the given name <nl> <nl> @ subsubsection examplewalletopen Example wallet_open Usage <nl> ` ` ` <nl> - $ curl http : / / localhost : 8889 / v1 / wallet / open - X POST - d ' " default " ' <nl> + $ curl http : / / localhost : 8888 / v1 / wallet / open - X POST - d ' " default " ' <nl> ` ` ` <nl> <nl> @ subsubsection examplewalletopenresult Example wallet_open Result <nl> Lock a wallet of the given name <nl> <nl> @ subsubsection examplewalletlock Example wallet_lock Usage <nl> ` ` ` <nl> - $ curl http : / / localhost : 8889 / v1 / wallet / lock - X POST - d ' " default " ' <nl> + $ curl http : / / localhost : 8888 / v1 / wallet / lock - X POST - d ' " default " ' <nl> ` ` ` <nl> <nl> @ subsubsection examplewalletlockresult Example wallet_lock Result <nl> Lock all wallets <nl> <nl> @ subsubsection examplewalletlockall Example wallet_lock_all Usage <nl> ` ` ` <nl> - $ curl http : / / localhost : 8889 / v1 / wallet / lock_all <nl> + $ curl http : / / localhost : 8888 / v1 / wallet / lock_all <nl> ` ` ` <nl> <nl> @ subsubsection examplewalletlockallresult Example wallet_lock_all Result <nl> Unlock a wallet with the given name and password <nl> <nl> @ subsubsection examplewalletunlock Example wallet_unlock Usage <nl> ` ` ` <nl> - $ curl http : / / localhost : 8889 / v1 / wallet / unlock - X POST - d ' [ " default " , " PW5KFWYKqvt63d4iNvedfDEPVZL227D3RQ1zpVFzuUwhMAJmRAYyX " ] ' <nl> + $ curl http : / / localhost : 8888 / v1 / wallet / unlock - X POST - d ' [ " default " , " PW5KFWYKqvt63d4iNvedfDEPVZL227D3RQ1zpVFzuUwhMAJmRAYyX " ] ' <nl> ` ` ` <nl> <nl> @ subsubsection examplewalletunlockresult Example wallet_unlock Result <nl> Import a private key to the wallet of the given name <nl> <nl> @ subsubsection examplewalletimport Example wallet_import_key Usage <nl> ` ` ` <nl> - $ curl http : / / localhost : 8889 / v1 / wallet / import_key - X POST - d ' [ " default " , " 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3 " ] ' <nl> + $ curl http : / / localhost : 8888 / v1 / wallet / import_key - X POST - d ' [ " default " , " 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3 " ] ' <nl> ` ` ` <nl> <nl> @ subsubsection examplewalletimportresult Example wallet_import_key Result <nl> List all wallets <nl> <nl> @ subsubsection examplewalletlist Example wallet_list Usage <nl> ` ` ` <nl> - $ curl http : / / localhost : 8889 / v1 / wallet / list_wallets <nl> + $ curl http : / / localhost : 8888 / v1 / wallet / list_wallets <nl> ` ` ` <nl> <nl> @ subsubsection examplewalletlistresult Example wallet_list Result <nl> List all key pairs across all wallets <nl> <nl> @ subsubsection examplewalletlistkeys Example wallet_list_keys Usage <nl> ` ` ` <nl> - $ curl http : / / localhost : 8889 / v1 / wallet / list_keys <nl> + $ curl http : / / localhost : 8888 / v1 / wallet / list_keys <nl> ` ` ` <nl> <nl> @ subsubsection examplewalletlistkeysresult Example wallet_list_keys Result <nl> List all public keys across all wallets <nl> <nl> @ subsubsection examplewalletgetpublickeys Example wallet_get_public_keys Usage <nl> ` ` ` <nl> - $ curl http : / / localhost : 8889 / v1 / wallet / get_public_keys <nl> + $ curl http : / / localhost : 8888 / v1 / wallet / get_public_keys <nl> ` ` ` <nl> <nl> @ subsubsection examplewallegetpublickeysresult Example wallet_get_public_keys Result <nl> Set wallet auto lock timeout ( in seconds ) <nl> <nl> @ subsubsection examplewalletsettimeout Example wallet_set_timeout Usage <nl> ` ` ` <nl> - $ curl http : / / localhost : 8889 / v1 / wallet / set_timeout - X POST - d ' 10 ' <nl> + $ curl http : / / localhost : 8888 / v1 / wallet / set_timeout - X POST - d ' 10 ' <nl> ` ` ` <nl> <nl> @ subsubsection examplewalletsettimeoutresult Example wallet_set_timeout Result <nl> Sign transaction given an array of transaction , require public keys , and chain i <nl> <nl> @ subsubsection examplewalletsigntrx Example wallet_sign_trx Usage <nl> ` ` ` <nl> - $ curl http : / / localhost : 8889 / v1 / wallet / sign_transaction - X POST - d ' [ { " ref_block_num " : 21453 , " ref_block_prefix " : 3165644999 , " expiration " : " 2017 - 12 - 08T10 : 28 : 49 " , " scope " : [ " initb " , " initc " ] , " read_scope " : [ ] , " messages " : [ { " code " : " currency " , " type " : " transfer " , " authorization " : [ { " account " : " initb " , " permission " : " active " } ] , " data " : " 000000008093dd74000000000094dd74e803000000000000 " } ] , " signatures " : [ ] } , [ " EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV " ] , " " ] ' <nl> + $ curl http : / / localhost : 8888 / v1 / wallet / sign_transaction - X POST - d ' [ { " ref_block_num " : 21453 , " ref_block_prefix " : 3165644999 , " expiration " : " 2017 - 12 - 08T10 : 28 : 49 " , " scope " : [ " initb " , " initc " ] , " read_scope " : [ ] , " messages " : [ { " code " : " currency " , " type " : " transfer " , " authorization " : [ { " account " : " initb " , " permission " : " active " } ] , " data " : " 000000008093dd74000000000094dd74e803000000000000 " } ] , " signatures " : [ ] } , [ " EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV " ] , " " ] ' <nl> ` ` ` <nl> <nl> @ subsubsection examplewalletsigntrxresult Example wallet_sign_trx Result <nl> mmm a / docs / group__eosiorpc . html <nl> ppp b / docs / group__eosiorpc . html <nl> < h2 > < a class = " anchor " id = " v1walletcreate " > < / a > <nl> < p > Create a new wallet with the given name < / p > <nl> < h3 > < a class = " anchor " id = " examplewalletcreate " > < / a > <nl> Example wallet_create Usage < / h3 > <nl> - < div class = " fragment " > < div class = " line " > $ curl http : < span class = " comment " > / / localhost : 8889 / v1 / wallet / create - X POST - d & # 39 ; & quot ; default & quot ; & # 39 ; < / span > < / div > < / div > < ! - - fragment - - > < h3 > < a class = " anchor " id = " examplewalletcreateresult " > < / a > <nl> + < div class = " fragment " > < div class = " line " > $ curl http : < span class = " comment " > / / localhost : 8888 / v1 / wallet / create - X POST - d & # 39 ; & quot ; default & quot ; & # 39 ; < / span > < / div > < / div > < ! - - fragment - - > < h3 > < a class = " anchor " id = " examplewalletcreateresult " > < / a > <nl> Example wallet_create Result < / h3 > <nl> < p > This command will return the password that can be used to unlock the wallet in the future < / p > < div class = " fragment " > < div class = " line " > PW5KFWYKqvt63d4iNvedfDEPVZL227D3RQ1zpVFzuUwhMAJmRAYyX < / div > < / div > < ! - - fragment - - > < h2 > < a class = " anchor " id = " v1walletopen " > < / a > <nl> wallet_open < / h2 > <nl> < p > Open an existing wallet of the given name < / p > <nl> < h3 > < a class = " anchor " id = " examplewalletopen " > < / a > <nl> Example wallet_open Usage < / h3 > <nl> - < div class = " fragment " > < div class = " line " > $ curl http : < span class = " comment " > / / localhost : 8889 / v1 / wallet / open - X POST - d & # 39 ; & quot ; default & quot ; & # 39 ; < / span > < / div > < / div > < ! - - fragment - - > < h3 > < a class = " anchor " id = " examplewalletopenresult " > < / a > <nl> + < div class = " fragment " > < div class = " line " > $ curl http : < span class = " comment " > / / localhost : 8888 / v1 / wallet / open - X POST - d & # 39 ; & quot ; default & quot ; & # 39 ; < / span > < / div > < / div > < ! - - fragment - - > < h3 > < a class = " anchor " id = " examplewalletopenresult " > < / a > <nl> Example wallet_open Result < / h3 > <nl> < div class = " fragment " > < div class = " line " > { } < / div > < / div > < ! - - fragment - - > < h2 > < a class = " anchor " id = " v1walletlock " > < / a > <nl> wallet_lock < / h2 > <nl> < p > Lock a wallet of the given name < / p > <nl> < h3 > < a class = " anchor " id = " examplewalletlock " > < / a > <nl> Example wallet_lock Usage < / h3 > <nl> - < div class = " fragment " > < div class = " line " > $ curl http : < span class = " comment " > / / localhost : 8889 / v1 / wallet / lock - X POST - d & # 39 ; & quot ; default & quot ; & # 39 ; < / span > < / div > < / div > < ! - - fragment - - > < h3 > < a class = " anchor " id = " examplewalletlockresult " > < / a > <nl> + < div class = " fragment " > < div class = " line " > $ curl http : < span class = " comment " > / / localhost : 8888 / v1 / wallet / lock - X POST - d & # 39 ; & quot ; default & quot ; & # 39 ; < / span > < / div > < / div > < ! - - fragment - - > < h3 > < a class = " anchor " id = " examplewalletlockresult " > < / a > <nl> Example wallet_lock Result < / h3 > <nl> < div class = " fragment " > < div class = " line " > { } < / div > < / div > < ! - - fragment - - > < h2 > < a class = " anchor " id = " v1walletlockall " > < / a > <nl> wallet_lock_all < / h2 > <nl> < p > Lock all wallets < / p > <nl> < h3 > < a class = " anchor " id = " examplewalletlockall " > < / a > <nl> Example wallet_lock_all Usage < / h3 > <nl> - < div class = " fragment " > < div class = " line " > $ curl http : < span class = " comment " > / / localhost : 8889 / v1 / wallet / lock_all < / span > < / div > < / div > < ! - - fragment - - > < h3 > < a class = " anchor " id = " examplewalletlockallresult " > < / a > <nl> + < div class = " fragment " > < div class = " line " > $ curl http : < span class = " comment " > / / localhost : 8888 / v1 / wallet / lock_all < / span > < / div > < / div > < ! - - fragment - - > < h3 > < a class = " anchor " id = " examplewalletlockallresult " > < / a > <nl> Example wallet_lock_all Result < / h3 > <nl> < div class = " fragment " > < div class = " line " > { } < / div > < / div > < ! - - fragment - - > < h2 > < a class = " anchor " id = " v1walletunlock " > < / a > <nl> wallet_unlock < / h2 > <nl> < p > Unlock a wallet with the given name and password < / p > <nl> < h3 > < a class = " anchor " id = " examplewalletunlock " > < / a > <nl> Example wallet_unlock Usage < / h3 > <nl> - < div class = " fragment " > < div class = " line " > $ curl http : < span class = " comment " > / / localhost : 8889 / v1 / wallet / unlock - X POST - d & # 39 ; [ & quot ; default & quot ; , & quot ; PW5KFWYKqvt63d4iNvedfDEPVZL227D3RQ1zpVFzuUwhMAJmRAYyX & quot ; ] & # 39 ; < / span > < / div > < / div > < ! - - fragment - - > < h3 > < a class = " anchor " id = " examplewalletunlockresult " > < / a > <nl> + < div class = " fragment " > < div class = " line " > $ curl http : < span class = " comment " > / / localhost : 8888 / v1 / wallet / unlock - X POST - d & # 39 ; [ & quot ; default & quot ; , & quot ; PW5KFWYKqvt63d4iNvedfDEPVZL227D3RQ1zpVFzuUwhMAJmRAYyX & quot ; ] & # 39 ; < / span > < / div > < / div > < ! - - fragment - - > < h3 > < a class = " anchor " id = " examplewalletunlockresult " > < / a > <nl> Example wallet_unlock Result < / h3 > <nl> < div class = " fragment " > < div class = " line " > { } < / div > < / div > < ! - - fragment - - > < h2 > < a class = " anchor " id = " v1walletimport " > < / a > <nl> wallet_import_key < / h2 > <nl> < p > Import a private key to the wallet of the given name < / p > <nl> < h3 > < a class = " anchor " id = " examplewalletimport " > < / a > <nl> Example wallet_import_key Usage < / h3 > <nl> - < div class = " fragment " > < div class = " line " > $ curl http : < span class = " comment " > / / localhost : 8889 / v1 / wallet / import_key - X POST - d & # 39 ; [ & quot ; default & quot ; , & quot ; 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3 & quot ; ] & # 39 ; < / span > < / div > < / div > < ! - - fragment - - > < h3 > < a class = " anchor " id = " examplewalletimportresult " > < / a > <nl> + < div class = " fragment " > < div class = " line " > $ curl http : < span class = " comment " > / / localhost : 8888 / v1 / wallet / import_key - X POST - d & # 39 ; [ & quot ; default & quot ; , & quot ; 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3 & quot ; ] & # 39 ; < / span > < / div > < / div > < ! - - fragment - - > < h3 > < a class = " anchor " id = " examplewalletimportresult " > < / a > <nl> Example wallet_import_key Result < / h3 > <nl> < div class = " fragment " > < div class = " line " > { } < / div > < / div > < ! - - fragment - - > < h2 > < a class = " anchor " id = " v1walletlist " > < / a > <nl> wallet_list < / h2 > <nl> < p > List all wallets < / p > <nl> < h3 > < a class = " anchor " id = " examplewalletlist " > < / a > <nl> Example wallet_list Usage < / h3 > <nl> - < div class = " fragment " > < div class = " line " > $ curl http : < span class = " comment " > / / localhost : 8889 / v1 / wallet / list_wallets < / span > < / div > < / div > < ! - - fragment - - > < h3 > < a class = " anchor " id = " examplewalletlistresult " > < / a > <nl> + < div class = " fragment " > < div class = " line " > $ curl http : < span class = " comment " > / / localhost : 8888 / v1 / wallet / list_wallets < / span > < / div > < / div > < ! - - fragment - - > < h3 > < a class = " anchor " id = " examplewalletlistresult " > < / a > <nl> Example wallet_list Result < / h3 > <nl> < div class = " fragment " > < div class = " line " > [ < span class = " stringliteral " > & quot ; default * & quot ; < / span > ] < / div > < / div > < ! - - fragment - - > < h2 > < a class = " anchor " id = " v1walletlistkeys " > < / a > <nl> wallet_list_keys < / h2 > <nl> < p > List all key pairs across all wallets < / p > <nl> < h3 > < a class = " anchor " id = " examplewalletlistkeys " > < / a > <nl> Example wallet_list_keys Usage < / h3 > <nl> - < div class = " fragment " > < div class = " line " > $ curl http : < span class = " comment " > / / localhost : 8889 / v1 / wallet / list_keys < / span > < / div > < / div > < ! - - fragment - - > < h3 > < a class = " anchor " id = " examplewalletlistkeysresult " > < / a > <nl> + < div class = " fragment " > < div class = " line " > $ curl http : < span class = " comment " > / / localhost : 8888 / v1 / wallet / list_keys < / span > < / div > < / div > < ! - - fragment - - > < h3 > < a class = " anchor " id = " examplewalletlistkeysresult " > < / a > <nl> Example wallet_list_keys Result < / h3 > <nl> < div class = " fragment " > < div class = " line " > [ [ < span class = " stringliteral " > & quot ; EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV & quot ; < / span > , < span class = " stringliteral " > & quot ; 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3 & quot ; < / span > ] ] < / div > < / div > < ! - - fragment - - > < h2 > < a class = " anchor " id = " v1walletgetpublickeys " > < / a > <nl> wallet_get_public_keys < / h2 > <nl> < p > List all public keys across all wallets < / p > <nl> < h3 > < a class = " anchor " id = " examplewalletgetpublickeys " > < / a > <nl> Example wallet_get_public_keys Usage < / h3 > <nl> - < div class = " fragment " > < div class = " line " > $ curl http : < span class = " comment " > / / localhost : 8889 / v1 / wallet / get_public_keys < / span > < / div > < / div > < ! - - fragment - - > < h3 > < a class = " anchor " id = " examplewallegetpublickeysresult " > < / a > <nl> + < div class = " fragment " > < div class = " line " > $ curl http : < span class = " comment " > / / localhost : 8888 / v1 / wallet / get_public_keys < / span > < / div > < / div > < ! - - fragment - - > < h3 > < a class = " anchor " id = " examplewallegetpublickeysresult " > < / a > <nl> Example wallet_get_public_keys Result < / h3 > <nl> < div class = " fragment " > < div class = " line " > [ < span class = " stringliteral " > & quot ; EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV & quot ; < / span > ] < / div > < / div > < ! - - fragment - - > < h2 > < a class = " anchor " id = " v1walletsettimeout " > < / a > <nl> wallet_set_timeout < / h2 > <nl> < p > Set wallet auto lock timeout ( in seconds ) < / p > <nl> < h3 > < a class = " anchor " id = " examplewalletsettimeout " > < / a > <nl> Example wallet_set_timeout Usage < / h3 > <nl> - < div class = " fragment " > < div class = " line " > $ curl http : < span class = " comment " > / / localhost : 8889 / v1 / wallet / set_timeout - X POST - d & # 39 ; 10 & # 39 ; < / span > < / div > < / div > < ! - - fragment - - > < h3 > < a class = " anchor " id = " examplewalletsettimeoutresult " > < / a > <nl> + < div class = " fragment " > < div class = " line " > $ curl http : < span class = " comment " > / / localhost : 8888 / v1 / wallet / set_timeout - X POST - d & # 39 ; 10 & # 39 ; < / span > < / div > < / div > < ! - - fragment - - > < h3 > < a class = " anchor " id = " examplewalletsettimeoutresult " > < / a > <nl> Example wallet_set_timeout Result < / h3 > <nl> < div class = " fragment " > < div class = " line " > { } < / div > < / div > < ! - - fragment - - > < h2 > < a class = " anchor " id = " v1walletsigntrx " > < / a > <nl> wallet_sign_trx < / h2 > <nl> < p > Sign transaction given an array of transaction , require public keys , and chain id < / p > <nl> < h3 > < a class = " anchor " id = " examplewalletsigntrx " > < / a > <nl> Example wallet_sign_trx Usage < / h3 > <nl> - < div class = " fragment " > < div class = " line " > $ curl http : < span class = " comment " > / / localhost : 8889 / v1 / wallet / sign_transaction - X POST - d & # 39 ; [ { & quot ; ref_block_num & quot ; : 21453 , & quot ; ref_block_prefix & quot ; : 3165644999 , & quot ; expiration & quot ; : & quot ; 2017 - 12 - 08T10 : 28 : 49 & quot ; , & quot ; scope & quot ; : [ & quot ; initb & quot ; , & quot ; initc & quot ; ] , & quot ; read_scope & quot ; : [ ] , & quot ; messages & quot ; : [ { & quot ; code & quot ; : & quot ; currency & quot ; , & quot ; type & quot ; : & quot ; transfer & quot ; , & quot ; authorization & quot ; : [ { & quot ; account & quot ; : & quot ; initb & quot ; , & quot ; permission & quot ; : & quot ; active & quot ; } ] , & quot ; data & quot ; : & quot ; 000000008093dd74000000000094dd74e803000000000000 & quot ; } ] , & quot ; signatures & quot ; : [ ] } , [ & quot ; EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV & quot ; ] , & quot ; & quot ; ] & # 39 ; < / span > < / div > < / div > < ! - - fragment - - > < h3 > < a class = " anchor " id = " examplewalletsigntrxresult " > < / a > <nl> + < div class = " fragment " > < div class = " line " > $ curl http : < span class = " comment " > / / localhost : 8888 / v1 / wallet / sign_transaction - X POST - d & # 39 ; [ { & quot ; ref_block_num & quot ; : 21453 , & quot ; ref_block_prefix & quot ; : 3165644999 , & quot ; expiration & quot ; : & quot ; 2017 - 12 - 08T10 : 28 : 49 & quot ; , & quot ; scope & quot ; : [ & quot ; initb & quot ; , & quot ; initc & quot ; ] , & quot ; read_scope & quot ; : [ ] , & quot ; messages & quot ; : [ { & quot ; code & quot ; : & quot ; currency & quot ; , & quot ; type & quot ; : & quot ; transfer & quot ; , & quot ; authorization & quot ; : [ { & quot ; account & quot ; : & quot ; initb & quot ; , & quot ; permission & quot ; : & quot ; active & quot ; } ] , & quot ; data & quot ; : & quot ; 000000008093dd74000000000094dd74e803000000000000 & quot ; } ] , & quot ; signatures & quot ; : [ ] } , [ & quot ; EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV & quot ; ] , & quot ; & quot ; ] & # 39 ; < / span > < / div > < / div > < ! - - fragment - - > < h3 > < a class = " anchor " id = " examplewalletsigntrxresult " > < / a > <nl> Example wallet_sign_trx Result < / h3 > <nl> < div class = " fragment " > < div class = " line " > { < / div > < div class = " line " > < span class = " stringliteral " > & quot ; ref_block_num & quot ; < / span > : 21453 , < / div > < div class = " line " > < span class = " stringliteral " > & quot ; ref_block_prefix & quot ; < / span > : 3165644999 , < / div > < div class = " line " > < span class = " stringliteral " > & quot ; expiration & quot ; < / span > : < span class = " stringliteral " > & quot ; 2017 - 12 - 08T10 : 28 : 49 & quot ; < / span > , < / div > < div class = " line " > < span class = " stringliteral " > & quot ; scope & quot ; < / span > : [ < / div > < div class = " line " > < span class = " stringliteral " > & quot ; initb & quot ; < / span > , < / div > < div class = " line " > < span class = " stringliteral " > & quot ; initc & quot ; < / span > < / div > < div class = " line " > ] , < / div > < div class = " line " > < span class = " stringliteral " > & quot ; read_scope & quot ; < / span > : [ ] , < / div > < div class = " line " > < span class = " stringliteral " > & quot ; messages & quot ; < / span > : [ < / div > < div class = " line " > { < / div > < div class = " line " > < span class = " stringliteral " > & quot ; code & quot ; < / span > : < span class = " stringliteral " > & quot ; currency & quot ; < / span > , < / div > < div class = " line " > < span class = " stringliteral " > & quot ; type & quot ; < / span > : < span class = " stringliteral " > & quot ; transfer & quot ; < / span > , < / div > < div class = " line " > < span class = " stringliteral " > & quot ; authorization & quot ; < / span > : [ < / div > < div class = " line " > { < / div > < div class = " line " > < span class = " stringliteral " > & quot ; account & quot ; < / span > : < span class = " stringliteral " > & quot ; initb & quot ; < / span > , < / div > < div class = " line " > < span class = " stringliteral " > & quot ; permission & quot ; < / span > : < span class = " stringliteral " > & quot ; active & quot ; < / span > < / div > < div class = " line " > } < / div > < div class = " line " > ] , < / div > < div class = " line " > < span class = " stringliteral " > & quot ; data & quot ; < / span > : < span class = " stringliteral " > & quot ; 000000008093dd74000000000094dd74e803000000000000 & quot ; < / span > < / div > < div class = " line " > } < / div > < div class = " line " > ] , < / div > < div class = " line " > < span class = " stringliteral " > & quot ; signatures & quot ; < / span > : [ < / div > < div class = " line " > < span class = " stringliteral " > & quot ; 1f393cc5ce6a6951fb53b11812345bcf14ffd978b07be386fd639eaf440bca7dca16b14833ec661ca0703d15e55a2a599a36d55ce78c4539433f6ce8bcee0158c3 & quot ; < / span > < / div > < div class = " line " > ] < / div > < div class = " line " > } < / div > < / div > < ! - - fragment - - > < / div > < ! - - contents - - > <nl> < ! - - start footer part - - > <nl> | Fix - Change the port number of the wallet interface document | EOSIO/eos | ab0379a8c6b8d5dd1ae200bbf696d46d7bbe88d6 | 2018-05-18T04:12:41Z |
mmm a / src / buffer_cache / alt / page . cc <nl> ppp b / src / buffer_cache / alt / page . cc <nl> current_page_t * page_cache_t : : page_for_block_id ( block_id_t block_id ) { <nl> <nl> if ( current_pages_ [ block_id ] = = NULL ) { <nl> current_pages_ [ block_id ] = new current_page_t ( block_id , this ) ; <nl> - } <nl> + } <nl> <nl> return current_pages_ [ block_id ] ; <nl> } <nl> current_page_t * page_cache_t : : page_for_new_block_id ( block_id_t * block_id_out ) { <nl> block_id_t block_id = free_list_ . acquire_block_id ( ) ; <nl> / / RSI : Have a user - specifiable block size . <nl> current_page_t * ret = new current_page_t ( serializer_ - > get_block_size ( ) , <nl> - serializer_ - > malloc ( ) ) ; <nl> + serializer_ - > malloc ( ) , <nl> + this ) ; <nl> * block_id_out = block_id ; <nl> return ret ; <nl> } <nl> current_page_acq_t : : ~ current_page_acq_t ( ) { <nl> current_page_ - > remove_acquirer ( this ) ; <nl> } <nl> if ( snapshotted_page_ ! = NULL ) { <nl> - snapshotted_page_ - > remove_snapshotter ( this ) ; <nl> + snapshotted_page_ - > remove_snapshotter ( ) ; <nl> } <nl> } <nl> <nl> current_page_t : : current_page_t ( block_id_t block_id , page_cache_t * page_cache ) <nl> } <nl> <nl> current_page_t : : current_page_t ( block_size_t block_size , <nl> - scoped_malloc_t < ser_buffer_t > buf ) <nl> + scoped_malloc_t < ser_buffer_t > buf , <nl> + page_cache_t * page_cache ) <nl> : block_id_ ( NULL_BLOCK_ID ) , <nl> - page_cache_ ( NULL ) , <nl> + page_cache_ ( page_cache ) , <nl> page_ ( new page_t ( block_size , std : : move ( buf ) ) ) { <nl> } <nl> <nl> void current_page_t : : pulse_pulsables ( current_page_acq_t * const acq ) { <nl> / / write - acquirers . <nl> cur - > snapshotted_page_ = the_page_for_read ( ) ; <nl> cur - > current_page_ = NULL ; <nl> - cur - > snapshotted_page_ - > add_snapshotter ( cur ) ; <nl> + cur - > snapshotted_page_ - > add_snapshotter ( ) ; <nl> acquirers_ . remove ( cur ) ; <nl> } <nl> cur = next ; <nl> void current_page_t : : pulse_pulsables ( current_page_acq_t * const acq ) { <nl> void current_page_t : : convert_from_serializer_if_necessary ( ) { <nl> if ( page_ = = NULL ) { <nl> page_ = new page_t ( block_id_ , page_cache_ ) ; <nl> - page_cache_ = NULL ; <nl> block_id_ = NULL_BLOCK_ID ; <nl> } <nl> } <nl> page_t * current_page_t : : the_page_for_read ( ) { <nl> page_t * current_page_t : : the_page_for_write ( ) { <nl> convert_from_serializer_if_necessary ( ) ; <nl> if ( page_ - > has_snapshot_references ( ) ) { <nl> - page_ = page_ - > make_copy ( ) ; <nl> + page_ = page_ - > make_copy ( page_cache_ ) ; <nl> } <nl> return page_ ; <nl> } <nl> page_t : : page_t ( block_size_t block_size , scoped_malloc_t < ser_buffer_t > buf ) <nl> rassert ( buf_ . has ( ) ) ; <nl> } <nl> <nl> + page_t : : page_t ( page_t * copyee , page_cache_t * page_cache ) <nl> + : destroy_ptr_ ( NULL ) , <nl> + buf_size_ ( block_size_t : : undefined ( ) ) , <nl> + snapshot_refcount_ ( 0 ) { <nl> + coro_t : : spawn_now_dangerously ( std : : bind ( & page_t : : load_from_copyee , <nl> + this , <nl> + copyee , <nl> + page_cache ) ) ; <nl> + } <nl> + <nl> + page_t : : ~ page_t ( ) { <nl> + if ( destroy_ptr_ ! = NULL ) { <nl> + * destroy_ptr_ = true ; <nl> + } <nl> + } <nl> + <nl> + void page_t : : load_from_copyee ( page_t * page , page_t * copyee , <nl> + page_cache_t * page_cache ) { <nl> + / / This is called using spawn_now_dangerously . We need to atomically set <nl> + / / destroy_ptr_ ( and add a snapshotter , why not ) . <nl> + copyee - > add_snapshotter ( ) ; <nl> + bool page_destroyed = false ; <nl> + rassert ( page - > destroy_ptr_ = = NULL ) ; <nl> + page - > destroy_ptr_ = & page_destroyed ; <nl> + <nl> + / / Okay , it ' s safe to block . <nl> + auto_drainer_t : : lock_t lock ( page_cache - > drainer_ . get ( ) ) ; <nl> + <nl> + { <nl> + page_acq_t acq ; <nl> + acq . init ( copyee ) ; <nl> + acq . buf_ready_signal ( ) - > wait ( ) ; <nl> + <nl> + ASSERT_FINITE_CORO_WAITING ; <nl> + if ( ! page_destroyed ) { <nl> + / / RSP : If somehow there are no snapshotters of copyee now ( besides ourself ) , <nl> + / / maybe we could avoid copying this memory . We need to carefully track <nl> + / / snapshotters anyway , once we ' re comfortable with that , we could do it . <nl> + <nl> + block_size_t buf_size = copyee - > buf_size_ ; <nl> + rassert ( copyee - > buf_ . has ( ) ) ; <nl> + / / RSI : Support mallocking the specific buf size . <nl> + scoped_malloc_t < ser_buffer_t > buf = page_cache - > serializer_ - > malloc ( ) ; <nl> + <nl> + / / RSI : Are we sure we want to copy the whole ser buffer , and not the cache ' s <nl> + / / part ? Is it _necessary_ ? If unnecessary , let ' s not do it . <nl> + memcpy ( buf . get ( ) , copyee - > buf_ . get ( ) , buf_size . ser_value ( ) ) ; <nl> + <nl> + page - > buf_size_ = buf_size ; <nl> + page - > buf_ = std : : move ( buf ) ; <nl> + page - > destroy_ptr_ = NULL ; <nl> + <nl> + page - > pulse_waiters ( ) ; <nl> + } <nl> + } <nl> + <nl> + / / RSI : Shouldn ' t there be some better way to acquire and release a snapshot <nl> + / / reference ? Maybe not . <nl> + copyee - > remove_snapshotter ( ) ; <nl> + } <nl> + <nl> <nl> void page_t : : load_with_block_id ( page_t * page , block_id_t block_id , <nl> page_cache_t * page_cache ) { <nl> void page_t : : load_with_block_id ( page_t * page , block_id_t block_id , <nl> page - > buf_size_ = block_token - > block_size ( ) ; <nl> page - > buf_ = std : : move ( buf ) ; <nl> page - > block_token_ = std : : move ( block_token ) ; <nl> + <nl> + page - > pulse_waiters ( ) ; <nl> } <nl> <nl> - void page_t : : add_snapshotter ( current_page_acq_t * acq ) { <nl> - ( void ) acq ; / / RSI : remove param . <nl> + void page_t : : add_snapshotter ( ) { <nl> + / / This may not block , because it ' s called at the beginning of <nl> + / / page_t : : load_from_copyee . <nl> + ASSERT_NO_CORO_WAITING ; <nl> + + snapshot_refcount_ ; <nl> } <nl> <nl> - void page_t : : remove_snapshotter ( current_page_acq_t * acq ) { <nl> - ( void ) acq ; / / RSI : remove param . <nl> + void page_t : : remove_snapshotter ( ) { <nl> rassert ( snapshot_refcount_ > 0 ) ; <nl> - - snapshot_refcount_ ; <nl> + / / RSI : We might need to delete the page here . <nl> } <nl> <nl> bool page_t : : has_snapshot_references ( ) { <nl> return snapshot_refcount_ > 0 ; <nl> } <nl> <nl> + page_t * page_t : : make_copy ( page_cache_t * page_cache ) { <nl> + return new page_t ( this , page_cache ) ; <nl> + } <nl> + <nl> + void page_t : : pulse_waiters ( ) { <nl> + for ( page_acq_t * p = waiters_ . head ( ) ; p ! = NULL ; p = waiters_ . next ( p ) ) { <nl> + / / The waiter ' s not already going to have been pulsed . <nl> + p - > buf_ready_signal_ . pulse ( ) ; <nl> + } <nl> + } <nl> + <nl> + void page_t : : add_waiter ( page_acq_t * acq ) { <nl> + waiters_ . push_back ( acq ) ; <nl> + if ( buf_ . has ( ) ) { <nl> + acq - > buf_ready_signal_ . pulse ( ) ; <nl> + } <nl> + } <nl> + <nl> + void * page_t : : get_buf ( ) { <nl> + / / RSI : definitely make private , used through page_acq_t . <nl> + rassert ( buf_ . has ( ) ) ; <nl> + return buf_ - > cache_data ; <nl> + } <nl> + <nl> + uint32_t page_t : : get_buf_size ( ) { <nl> + / / RSI : definitely make private , used through page_acq_t . <nl> + rassert ( buf_ . has ( ) ) ; <nl> + return buf_size_ . value ( ) ; <nl> + } <nl> <nl> + void page_t : : remove_waiter ( page_acq_t * acq ) { <nl> + waiters_ . remove ( acq ) ; <nl> + if ( waiters_ . empty ( ) ) { <nl> + / / RSI : We might need to delete the page here . <nl> + } <nl> + } <nl> + <nl> + page_acq_t : : page_acq_t ( ) : page_ ( NULL ) { <nl> + } <nl> + <nl> + void page_acq_t : : init ( page_t * page ) { <nl> + rassert ( page_ = = NULL ) ; <nl> + rassert ( ! buf_ready_signal_ . is_pulsed ( ) ) ; <nl> + page_ = page ; <nl> + page_ - > add_waiter ( this ) ; <nl> + } <nl> + <nl> + bool page_acq_t : : has ( ) const { <nl> + return page_ ! = NULL ; <nl> + } <nl> + <nl> + signal_t * page_acq_t : : buf_ready_signal ( ) { <nl> + return & buf_ready_signal_ ; <nl> + } <nl> + <nl> + page_acq_t : : ~ page_acq_t ( ) { <nl> + if ( page_ ! = NULL ) { <nl> + page_ - > remove_waiter ( this ) ; <nl> + } <nl> + } <nl> + <nl> + free_list_t : : free_list_t ( serializer_t * serializer ) { <nl> + / / RSI : Maybe this should be specifically constructed when we visit the <nl> + / / serializer ' s home thread ( and setting the file accounts ) . <nl> + on_thread_t th ( serializer - > home_thread ( ) ) ; <nl> + <nl> + next_new_block_id_ = serializer - > max_block_id ( ) ; <nl> + for ( block_id_t i = 0 ; i < next_new_block_id_ ; + + i ) { <nl> + if ( serializer - > get_delete_bit ( i ) ) { <nl> + free_ids_ . push_back ( i ) ; <nl> + } <nl> + } <nl> + } <nl> + <nl> + free_list_t : : ~ free_list_t ( ) { } <nl> + <nl> + block_id_t free_list_t : : acquire_block_id ( ) { <nl> + if ( free_ids_ . empty ( ) ) { <nl> + block_id_t ret = next_new_block_id_ ; <nl> + + + next_new_block_id_ ; <nl> + return ret ; <nl> + } else { <nl> + block_id_t ret = free_ids_ . back ( ) ; <nl> + free_ids_ . pop_back ( ) ; <nl> + return ret ; <nl> + } <nl> + } <nl> + <nl> + void free_list_t : : release_block_id ( block_id_t block_id ) { <nl> + free_ids_ . push_back ( block_id ) ; <nl> + } <nl> <nl> <nl> } / / namespace alt <nl> mmm a / src / buffer_cache / alt / page . hpp <nl> ppp b / src / buffer_cache / alt / page . hpp <nl> class page_t { <nl> public : <nl> page_t ( block_size_t block_size , scoped_malloc_t < ser_buffer_t > buf ) ; <nl> page_t ( block_id_t block_id , page_cache_t * page_cache ) ; <nl> + page_t ( page_t * copyee , page_cache_t * page_cache ) ; <nl> ~ page_t ( ) ; <nl> <nl> void * get_buf ( ) ; <nl> uint32_t get_buf_size ( ) ; <nl> <nl> - void add_snapshotter ( current_page_acq_t * acq ) ; <nl> - void remove_snapshotter ( current_page_acq_t * acq ) ; <nl> + void add_snapshotter ( ) ; <nl> + void remove_snapshotter ( ) ; <nl> bool has_snapshot_references ( ) ; <nl> - page_t * make_copy ( ) ; <nl> + page_t * make_copy ( page_cache_t * page_cache ) ; <nl> + <nl> + void add_waiter ( page_acq_t * acq ) ; <nl> + void remove_waiter ( page_acq_t * acq ) ; <nl> <nl> private : <nl> + void pulse_waiters ( ) ; <nl> + <nl> static void load_with_block_id ( page_t * page , <nl> block_id_t block_id , <nl> page_cache_t * page_cache ) ; <nl> <nl> + static void load_from_copyee ( page_t * page , page_t * copyee , <nl> + page_cache_t * page_cache ) ; <nl> + <nl> / / One of destroy_ptr_ , buf_ , or block_token_ is non - null . <nl> bool * destroy_ptr_ ; <nl> block_size_t buf_size_ ; <nl> class page_t { <nl> / / How many pointers to this value are expecting it to be snapshotted ? <nl> size_t snapshot_refcount_ ; <nl> <nl> + / / RSP : This could be a single pointer instead of two . <nl> intrusive_list_t < page_acq_t > waiters_ ; <nl> DISABLE_COPYING ( page_t ) ; <nl> } ; <nl> class page_acq_t : public intrusive_list_node_t < page_acq_t > { <nl> bool has ( ) const ; <nl> <nl> private : <nl> + friend class page_t ; <nl> + <nl> + page_t * page_ ; <nl> cond_t buf_ready_signal_ ; <nl> DISABLE_COPYING ( page_acq_t ) ; <nl> } ; <nl> class page_acq_t : public intrusive_list_node_t < page_acq_t > { <nl> class current_page_t { <nl> public : <nl> / / Constructs a fresh , empty page . <nl> - current_page_t ( block_size_t block_size , scoped_malloc_t < ser_buffer_t > buf ) ; <nl> + current_page_t ( block_size_t block_size , scoped_malloc_t < ser_buffer_t > buf , <nl> + page_cache_t * page_cache ) ; <nl> / / Constructs a page to be loaded from the serializer . <nl> current_page_t ( block_id_t block_id , page_cache_t * page_cache ) ; <nl> ~ current_page_t ( ) ; <nl> class current_page_t { <nl> <nl> / / Our block id . <nl> block_id_t block_id_ ; <nl> - / / Either page_ is null or page_cache_ is null . block_id_ and page_cache_ can be <nl> - / / used to construct ( and load ) the page when it ' s null . <nl> - / / RSP : This is a waste of memory . <nl> + / / Either page_ is null or page_cache_ is null ( except that page_cache_ is never <nl> + / / null ) . block_id_ and page_cache_ can be used to construct ( and load ) the page <nl> + / / when it ' s null . RSP : This is a waste of memory . <nl> page_cache_t * page_cache_ ; <nl> page_t * page_ ; <nl> <nl> | Seemingly implemented non - flushing aspects of page cache . | rethinkdb/rethinkdb | a8e77f8dadf23758d48ac931a8f74d15783f1964 | 2013-09-26T17:01:52Z |
mmm a / tensorflow / core / BUILD <nl> ppp b / tensorflow / core / BUILD <nl> package ( default_visibility = [ <nl> <nl> licenses ( [ " notice " ] ) # Apache 2 . 0 <nl> <nl> - load ( <nl> - " @ io_bazel_rules_closure / / closure : defs . bzl " , <nl> - " closure_js_proto_library " , <nl> - ) <nl> load ( <nl> " / / tensorflow : tensorflow . bzl " , <nl> " full_path " , <nl> tf_nano_proto_library ( <nl> deps = [ " : protos_all_cc " ] , <nl> ) <nl> <nl> - closure_js_proto_library ( <nl> - name = " example_js_protos " , <nl> - srcs = [ <nl> - " example / example . proto " , <nl> - " example / feature . proto " , <nl> - ] , <nl> - visibility = [ " / / visibility : public " ] , <nl> - ) <nl> - <nl> exports_files ( [ <nl> " framework / types . proto " , <nl> ] ) <nl> | Remove closure_js_proto_library rule for tf . example protos . | tensorflow/tensorflow | f6c5cd435df9c64e79ad0f6434b619d4517e740a | 2018-04-13T19:47:03Z |
mmm a / scene / 2d / polygon_2d . cpp <nl> ppp b / scene / 2d / polygon_2d . cpp <nl> void Polygon2D : : _notification ( int p_what ) { <nl> <nl> <nl> Vector < Color > colors ; <nl> - colors . push_back ( color ) ; <nl> + int color_len = vertex_colors . size ( ) ; <nl> + colors . resize ( len ) ; <nl> + { <nl> + DVector < Color > : : Read color_r = vertex_colors . read ( ) ; <nl> + for ( int i = 0 ; i < color_len & & i < len ; i + + ) { <nl> + colors [ i ] = color_r [ i ] ; <nl> + } <nl> + for ( int i = color_len ; i < len ; i + + ) { <nl> + colors [ i ] = color ; <nl> + } <nl> + } <nl> + <nl> Vector < int > indices = Geometry : : triangulate_polygon ( points ) ; <nl> <nl> VS : : get_singleton ( ) - > canvas_item_add_triangle_array ( get_canvas_item ( ) , indices , points , colors , uvs , texture . is_valid ( ) ? texture - > get_rid ( ) : RID ( ) ) ; <nl> Color Polygon2D : : get_color ( ) const { <nl> return color ; <nl> } <nl> <nl> + void Polygon2D : : set_vertex_colors ( const DVector < Color > & p_colors ) { <nl> + <nl> + vertex_colors = p_colors ; <nl> + update ( ) ; <nl> + } <nl> + DVector < Color > Polygon2D : : get_vertex_colors ( ) const { <nl> + <nl> + return vertex_colors ; <nl> + } <nl> + <nl> void Polygon2D : : set_texture ( const Ref < Texture > & p_texture ) { <nl> <nl> texture = p_texture ; <nl> void Polygon2D : : _bind_methods ( ) { <nl> ObjectTypeDB : : bind_method ( _MD ( " set_color " , " color " ) , & Polygon2D : : set_color ) ; <nl> ObjectTypeDB : : bind_method ( _MD ( " get_color " ) , & Polygon2D : : get_color ) ; <nl> <nl> + ObjectTypeDB : : bind_method ( _MD ( " set_vertex_colors " , " vertex_colors " ) , & Polygon2D : : set_vertex_colors ) ; <nl> + ObjectTypeDB : : bind_method ( _MD ( " get_vertex_colors " ) , & Polygon2D : : get_vertex_colors ) ; <nl> + <nl> ObjectTypeDB : : bind_method ( _MD ( " set_texture " , " texture " ) , & Polygon2D : : set_texture ) ; <nl> ObjectTypeDB : : bind_method ( _MD ( " get_texture " ) , & Polygon2D : : get_texture ) ; <nl> <nl> void Polygon2D : : _bind_methods ( ) { <nl> ADD_PROPERTY ( PropertyInfo ( Variant : : VECTOR2_ARRAY , " polygon " ) , _SCS ( " set_polygon " ) , _SCS ( " get_polygon " ) ) ; <nl> ADD_PROPERTY ( PropertyInfo ( Variant : : VECTOR2_ARRAY , " uv " ) , _SCS ( " set_uv " ) , _SCS ( " get_uv " ) ) ; <nl> ADD_PROPERTY ( PropertyInfo ( Variant : : COLOR , " color " ) , _SCS ( " set_color " ) , _SCS ( " get_color " ) ) ; <nl> + ADD_PROPERTY ( PropertyInfo ( Variant : : COLOR_ARRAY , " vertex_colors " ) , _SCS ( " set_vertex_colors " ) , _SCS ( " get_vertex_colors " ) ) ; <nl> ADD_PROPERTY ( PropertyInfo ( Variant : : VECTOR2 , " offset " ) , _SCS ( " set_offset " ) , _SCS ( " get_offset " ) ) ; <nl> ADD_PROPERTY ( PropertyInfo ( Variant : : OBJECT , " texture / texture " , PROPERTY_HINT_RESOURCE_TYPE , " Texture " ) , _SCS ( " set_texture " ) , _SCS ( " get_texture " ) ) ; <nl> ADD_PROPERTY ( PropertyInfo ( Variant : : VECTOR2 , " texture / offset " ) , _SCS ( " set_texture_offset " ) , _SCS ( " get_texture_offset " ) ) ; <nl> mmm a / scene / 2d / polygon_2d . h <nl> ppp b / scene / 2d / polygon_2d . h <nl> class Polygon2D : public Node2D { <nl> <nl> DVector < Vector2 > polygon ; <nl> DVector < Vector2 > uv ; <nl> + DVector < Color > vertex_colors ; <nl> Color color ; <nl> Ref < Texture > texture ; <nl> Vector2 tex_scale ; <nl> class Polygon2D : public Node2D { <nl> void set_color ( const Color & p_color ) ; <nl> Color get_color ( ) const ; <nl> <nl> + void set_vertex_colors ( const DVector < Color > & p_colors ) ; <nl> + DVector < Color > get_vertex_colors ( ) const ; <nl> + <nl> void set_texture ( const Ref < Texture > & p_texture ) ; <nl> Ref < Texture > get_texture ( ) const ; <nl> <nl> | Polygon2D now exposes vertex colors . | godotengine/godot | 0d20ceeb61be915fea81c22c174efb9253d96974 | 2016-05-23T01:40:45Z |
mmm a / stdlib / objc / XCTest / CMakeLists . txt <nl> ppp b / stdlib / objc / XCTest / CMakeLists . txt <nl> set ( SHARED_LIBRARY ON ) <nl> set ( DISABLE_APPLICATION_EXTENSION ON ) <nl> set ( SWIFTXCTEST_SOURCES <nl> XCTestCaseAdditions . mm <nl> - XCTestCaseAdditions . h <nl> XCTest . swift <nl> ) <nl> <nl> - # There is some SPI implemented in ObjC for this overlay ; import its headers . <nl> - <nl> - list ( APPEND SWIFT_EXTRA_FLAGS <nl> - " - import - objc - header " " $ { CMAKE_CURRENT_SOURCE_DIR } / XCTestCaseAdditions . h " <nl> - ) <nl> - <nl> # XCTest . framework is provided by Xcode in the platforms , though that ' s recent <nl> # and may not have made it to all platforms yet so fall back to the SDK in those <nl> # cases . <nl> mmm a / stdlib / objc / XCTest / XCTest . swift <nl> ppp b / stdlib / objc / XCTest / XCTest . swift <nl> func _XCTFailureDescription ( assertionType : _XCTAssertionType , formatIndex : UInt , <nl> <nl> / / mmm Exception Support mmm <nl> <nl> + @ asmname ( " _XCTRunThrowableBlockBridge " ) func _XCTRunThrowableBlockBridge ( @ objc_block ( ) - > Void ) - > NSDictionary <nl> + <nl> / / / The Swift - style result of evaluating a block which may throw an exception . <nl> enum _XCTThrowableBlockResult { <nl> case Success <nl> deleted file mode 100644 <nl> index 1121be132284 . . 000000000000 <nl> mmm a / stdlib / objc / XCTest / XCTestCaseAdditions . h <nl> ppp / dev / null <nl> <nl> - / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> - / / <nl> - / / This source file is part of the Swift . org open source project <nl> - / / <nl> - / / Copyright ( c ) 2014 - 2015 Apple Inc . and the Swift project authors <nl> - / / Licensed under Apache License v2 . 0 with Runtime Library Exception <nl> - / / <nl> - / / See http : / / swift . org / LICENSE . txt for license information <nl> - / / See http : / / swift . org / CONTRIBUTORS . txt for the list of Swift project authors <nl> - / / <nl> - / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> - <nl> - # import < XCTest / XCTest . h > <nl> - <nl> - XCT_EXPORT NSDictionary * _XCTRunThrowableBlockBridge ( void ( ^ block ) ( ) ) ; <nl> mmm a / stdlib / objc / XCTest / XCTestCaseAdditions . mm <nl> ppp b / stdlib / objc / XCTest / XCTestCaseAdditions . mm <nl> <nl> / / = = = mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm - = = = / / <nl> <nl> # import < XCTest / XCTest . h > <nl> - # import " XCTestCaseAdditions . h " <nl> # include " swift / Runtime / Metadata . h " <nl> <nl> / / NOTE : This is a temporary workaround . <nl> - ( NSString * ) className <nl> / / it . <nl> / / <nl> / / If no exception is thrown by the block , returns an empty dictionary . <nl> + / / <nl> + / / Note that this function needs Swift calling conventions , hence the use of <nl> + / / NS_RETURNS_RETAINED and Block_release . ( The argument should also be marked <nl> + / / NS_RELEASES_ARGUMENT , but clang doesn ' t realize that a block parameter <nl> + / / should be treated as an Objective - C parameter here . ) <nl> + <nl> + XCT_EXPORT NS_RETURNS_RETAINED NSDictionary * _XCTRunThrowableBlockBridge ( void ( ^ block ) ( ) ) ; <nl> <nl> - NSDictionary * _XCTRunThrowableBlockBridge ( void ( ^ block ) ( ) ) <nl> + NS_RETURNS_RETAINED NSDictionary * _XCTRunThrowableBlockBridge ( void ( ^ block ) ( ) ) <nl> { <nl> NSDictionary * result ; <nl> <nl> - ( NSString * ) className <nl> } ; <nl> } <nl> <nl> - return result ; <nl> + Block_release ( block ) ; <nl> + return [ result retain ] ; <nl> } <nl> | Further work on handling exceptions in XCTest | apple/swift | 666e4ee2f309ce01d06326459c23b7c0e6f24931 | 2014-08-01T23:36:48Z |
mmm a / dbms / src / Storages / MergeTree / ReplicatedMergeTreeCleanupThread . cpp <nl> ppp b / dbms / src / Storages / MergeTree / ReplicatedMergeTreeCleanupThread . cpp <nl> void ReplicatedMergeTreeCleanupThread : : clearOldLogs ( ) <nl> <nl> Strings replicas = zookeeper - > getChildren ( storage . zookeeper_path + " / replicas " , & stat ) ; <nl> UInt64 min_pointer = std : : numeric_limits < UInt64 > : : max ( ) ; <nl> + <nl> + std : : unordered_map < String , UInt64 > log_pointers_losted_replicas ; <nl> + <nl> for ( const String & replica : replicas ) <nl> { <nl> String pointer = zookeeper - > get ( storage . zookeeper_path + " / replicas / " + replica + " / log_pointer " ) ; <nl> - if ( pointer . empty ( ) ) <nl> + if ( pointer . empty ( ) ) { <nl> return ; <nl> - min_pointer = std : : min ( min_pointer , parse < UInt64 > ( pointer ) ) ; <nl> + } <nl> + <nl> + UInt32 log_pointer = parse < UInt64 > ( pointer ) ; <nl> + <nl> + / / / Check status of replica ( active or not ) . <nl> + / / / If replica is not active , we will save it ' s log_pointer . <nl> + if ( zookeeper - > exists ( storage . zookeeper_path + " / replicas / " + replica + " / is_active " ) ) <nl> + min_pointer = std : : min ( min_pointer , log_pointer ) ; <nl> + else <nl> + log_pointers_losted_replicas [ replica ] = log_pointer ; <nl> } <nl> <nl> Strings entries = zookeeper - > getChildren ( storage . zookeeper_path + " / log " ) ; <nl> void ReplicatedMergeTreeCleanupThread : : clearOldLogs ( ) <nl> entries . erase ( entries . end ( ) - std : : min ( entries . size ( ) , storage . data . settings . replicated_logs_to_keep . value ) , entries . end ( ) ) ; <nl> / / / We will not touch records that are no less than ` min_pointer ` . <nl> entries . erase ( std : : lower_bound ( entries . begin ( ) , entries . end ( ) , " log - " + padIndex ( min_pointer ) ) , entries . end ( ) ) ; <nl> + / / / We will mark lost replicas . <nl> + markLostReplicas ( log_pointers_losted_replicas , * ( - - entries . end ( ) ) ) ; <nl> <nl> if ( entries . empty ( ) ) <nl> return ; <nl> void ReplicatedMergeTreeCleanupThread : : clearOldLogs ( ) <nl> } <nl> <nl> <nl> + void ReplicatedMergeTreeCleanupThread : : markLostReplicas ( std : : unordered_map < String , UInt64 > log_pointers_losted_replicas , String min_record ) <nl> + { <nl> + auto zookeeper = storage . getZooKeeper ( ) ; <nl> + <nl> + zkutil : : Requests ops ; <nl> + <nl> + for ( auto pair : log_pointers_losted_replicas ) <nl> + { <nl> + if ( " log - " + padIndex ( pair . second ) < = min_record ) <nl> + ops . emplace_back ( zkutil : : makeCreateRequest ( storage . zookeeper_path + " / replicas / " + pair . first + " / is_lost " , " " , <nl> + zkutil : : CreateMode : : Persistent ) ) ; <nl> + } <nl> + <nl> + zkutil : : Responses responses ; <nl> + auto code = zookeeper - > tryMulti ( ops , responses ) ; <nl> + if ( code & & code ! = ZooKeeperImpl : : ZooKeeper : : ZNODEEXISTS ) <nl> + throw zkutil : : KeeperException ( code ) ; <nl> + } <nl> + <nl> + <nl> struct ReplicatedMergeTreeCleanupThread : : NodeWithStat <nl> { <nl> String node ; <nl> mmm a / dbms / src / Storages / MergeTree / ReplicatedMergeTreeCleanupThread . h <nl> ppp b / dbms / src / Storages / MergeTree / ReplicatedMergeTreeCleanupThread . h <nl> class ReplicatedMergeTreeCleanupThread <nl> / / / Remove old records from ZooKeeper . <nl> void clearOldLogs ( ) ; <nl> <nl> + / / / Mark lost replicas . <nl> + void markLostReplicas ( std : : unordered_map < String , UInt64 > log_pointers_lost_replicas , String min_record ) ; <nl> + <nl> / / / Remove old block hashes from ZooKeeper . This is done by the leader replica . <nl> void clearOldBlocks ( ) ; <nl> <nl> mmm a / dbms / src / Storages / MergeTree / ReplicatedMergeTreeQueue . cpp <nl> ppp b / dbms / src / Storages / MergeTree / ReplicatedMergeTreeQueue . cpp <nl> void ReplicatedMergeTreeQueue : : pullLogsToQueue ( zkutil : : ZooKeeperPtr zookeeper , z <nl> { <nl> std : : lock_guard lock ( pull_logs_to_queue_mutex ) ; <nl> <nl> + if ( zookeeper - > exists ( replica_path + " / is_lost " ) ) <nl> + { <nl> + restartLostReplica ( zookeeper ) ; <nl> + <nl> + zookeeper - > remove ( replica_path + " / is_lost " , - 1 ) ; <nl> + } <nl> + <nl> String index_str = zookeeper - > get ( replica_path + " / log_pointer " ) ; <nl> UInt64 index ; <nl> <nl> void ReplicatedMergeTreeQueue : : pullLogsToQueue ( zkutil : : ZooKeeperPtr zookeeper , z <nl> } <nl> <nl> <nl> + / * * If necessary , restore a part , replica itself adds a record for its receipt . <nl> + * What time should I put for this entry in the queue ? Time is taken into account when calculating lag of replica . <nl> + * For these purposes , it makes sense to use creation time of missing part <nl> + * ( that is , in calculating lag , it will be taken into account how old is the part we need to recover ) . <nl> + * / <nl> + static time_t tryGetPartCreateTime ( zkutil : : ZooKeeperPtr & zookeeper , const String & replica_path , const String & part_name ) <nl> + { <nl> + time_t res = 0 ; <nl> + <nl> + / / / We get creation time of part , if it still exists ( was not merged , for example ) . <nl> + zkutil : : Stat stat ; <nl> + String unused ; <nl> + if ( zookeeper - > tryGet ( replica_path + " / parts / " + part_name , unused , & stat ) ) <nl> + res = stat . ctime / 1000 ; <nl> + <nl> + return res ; <nl> + } <nl> + <nl> + <nl> + void ReplicatedMergeTreeQueue : : restartLostReplica ( zkutil : : ZooKeeperPtr zookeeper ) <nl> + { <nl> + LOG_INFO ( log , " Restart Lost replica " < < replica_path ) ; <nl> + <nl> + String source_replica ; <nl> + <nl> + for ( const String & replica_name : zookeeper - > getChildren ( zookeeper_path + " / replicas " ) ) <nl> + { <nl> + if ( ! zookeeper - > exists ( zookeeper_path + " / replicas / " + replica_name + " / is_lost " ) ) <nl> + source_replica = replica_name ; <nl> + } <nl> + <nl> + String source_path = zookeeper_path + " / replicas / " + source_replica ; <nl> + <nl> + / * * If the reference / master replica is not yet fully created , let ' s wait . <nl> + * NOTE : If something went wrong while creating it , we can hang around forever . <nl> + * You can create an ephemeral node at the time of creation to make sure that the replica is created , and not abandoned . <nl> + * The same can be done for the table . You can automatically delete a replica / table node , <nl> + * if you see that it was not created up to the end , and the one who created it died . <nl> + * / <nl> + while ( ! zookeeper - > exists ( source_path + " / columns " ) ) <nl> + { <nl> + LOG_INFO ( log , " Waiting for replica " < < source_path < < " to be fully created " ) ; <nl> + <nl> + zkutil : : EventPtr event = std : : make_shared < Poco : : Event > ( ) ; <nl> + if ( zookeeper - > exists ( source_path + " / columns " , nullptr , event ) ) <nl> + { <nl> + LOG_WARNING ( log , " Oops , a watch has leaked " ) ; <nl> + break ; <nl> + } <nl> + <nl> + event - > wait ( ) ; <nl> + } <nl> + <nl> + / / / The order of the following three actions is important . Entries in the log can be duplicated , but they can not be lost . <nl> + <nl> + / / / Copy reference to the log from ` reference / master ` replica . <nl> + zookeeper - > set ( replica_path + " / log_pointer " , zookeeper - > get ( source_path + " / log_pointer " ) ) ; <nl> + <nl> + / / / Let ' s remember the queue of the reference / master replica . <nl> + Strings source_queue_names = zookeeper - > getChildren ( source_path + " / queue " ) ; <nl> + std : : sort ( source_queue_names . begin ( ) , source_queue_names . end ( ) ) ; <nl> + Strings source_queue ; <nl> + for ( const String & entry_name : source_queue_names ) <nl> + { <nl> + String entry ; <nl> + if ( ! zookeeper - > tryGet ( source_path + " / queue / " + entry_name , entry ) ) <nl> + continue ; <nl> + source_queue . push_back ( entry ) ; <nl> + } <nl> + <nl> + / / / Add to the queue jobs to receive all the active parts that the reference / master replica has . <nl> + Strings parts = zookeeper - > getChildren ( source_path + " / parts " ) ; <nl> + ActiveDataPartSet active_parts_set ( current_parts . getFormatVersion ( ) , parts ) ; <nl> + <nl> + Strings active_parts = active_parts_set . getParts ( ) ; <nl> + for ( const String & name : active_parts ) <nl> + { <nl> + LogEntry log_entry ; <nl> + log_entry . type = LogEntry : : GET_PART ; <nl> + log_entry . source_replica = source_replica ; <nl> + log_entry . new_part_name = name ; <nl> + log_entry . create_time = tryGetPartCreateTime ( zookeeper , source_path , name ) ; <nl> + <nl> + zookeeper - > create ( replica_path + " / queue / queue - " , log_entry . toString ( ) , zkutil : : CreateMode : : PersistentSequential ) ; <nl> + } <nl> + LOG_DEBUG ( log , " Queued " < < active_parts . size ( ) < < " parts to be fetched " ) ; <nl> + <nl> + / / / Add content of the reference / master replica queue to the queue . <nl> + for ( const String & entry : source_queue ) <nl> + { <nl> + zookeeper - > create ( replica_path + " / queue / queue - " , entry , zkutil : : CreateMode : : PersistentSequential ) ; <nl> + } <nl> + <nl> + / / / It will then be loaded into the queue variable in ` queue . initialize ` method . <nl> + <nl> + LOG_DEBUG ( log , " Copied " < < source_queue . size ( ) < < " queue entries " ) ; <nl> + } <nl> + <nl> + <nl> static size_t countPartsToMutate ( <nl> const ReplicatedMergeTreeMutationEntry & mutation , const ActiveDataPartSet & parts ) <nl> { <nl> mmm a / dbms / src / Storages / MergeTree / ReplicatedMergeTreeQueue . h <nl> ppp b / dbms / src / Storages / MergeTree / ReplicatedMergeTreeQueue . h <nl> class ReplicatedMergeTreeQueue <nl> const MergeTreePartInfo & range , const LogEntry & entry , String * out_description , <nl> std : : lock_guard < std : : mutex > & state_lock ) const ; <nl> <nl> + / / / Restart lost replica . <nl> + void restartLostReplica ( zkutil : : ZooKeeperPtr zookeeper ) ; <nl> + <nl> / / / Marks the element of the queue as running . <nl> class CurrentlyExecuting <nl> { <nl> | CLICKHOUSE - 3847 add support lost replica | ClickHouse/ClickHouse | 3f6cdab293c15caeda5f5b254972a237308692bd | 2018-07-30T16:31:14Z |
mmm a / Code / CryEngine / CrySystem / BootProfiler . cpp <nl> ppp b / Code / CryEngine / CrySystem / BootProfiler . cpp <nl> void CBootProfiler : : OnSectionStart ( const SProfilingSection & section ) <nl> uint threadIdx = gThreadsInterface . GetThreadIndexByID ( CryGetCurrentThreadId ( ) ) ; <nl> m_pCurrentSession - > StartBlock ( section . pDescription - > szEventname , section . szDynamicName , section . startValue , threadIdx ) ; <nl> <nl> - const char * szReqLabel = CV_sys_bp_frames_required_label - > GetString ( ) ; <nl> - if ( szReqLabel [ 0 ] & & strcmp ( szReqLabel , section . pDescription - > szEventname ) = = 0 ) <nl> + if ( CV_sys_bp_frames_required_label ) <nl> { <nl> - m_pCurrentSession - > SetRequiredLabel ( true ) ; <nl> + const char * szReqLabel = CV_sys_bp_frames_required_label - > GetString ( ) ; <nl> + if ( szReqLabel [ 0 ] & & strcmp ( szReqLabel , section . pDescription - > szEventname ) = = 0 ) <nl> + { <nl> + m_pCurrentSession - > SetRequiredLabel ( true ) ; <nl> + } <nl> } <nl> } <nl> } <nl> mmm a / Code / CryEngine / CrySystem / CryPak . cpp <nl> ppp b / Code / CryEngine / CrySystem / CryPak . cpp <nl> <nl> # include < sys / stat . h > / / fstat , fileno <nl> / / # define fileno ( X ) ( ( X ) - > _Handle ) <nl> # endif <nl> + # if CRY_PLATFORM_LINUX <nl> + # include < sys / sendfile . h > <nl> + # endif <nl> <nl> # if CRY_PLATFORM_ANDROID & & defined ( ANDROID_OBB ) <nl> # include < android / asset_manager . h > <nl> bool CCryPak : : CopyFileOnDisk ( const char * source , const char * dest , bool bFailIfE <nl> { <nl> # if CRY_PLATFORM_WINDOWS <nl> return : : CopyFile ( ( LPCSTR ) source , ( LPCSTR ) dest , bFailIfExist ) = = TRUE ; <nl> + # elif CRY_PLATFORM_LINUX <nl> + if ( bFailIfExist & & IsFileExist ( dest , eFileLocation_OnDisk ) ) <nl> + return false ; <nl> + <nl> + const SignedFileSize sourceSize = GetFileSizeOnDisk ( source ) ; <nl> + if ( sourceSize < 0 ) <nl> + return false ; <nl> + <nl> + FILE * hSource = fopen ( source , " r " ) ; <nl> + FILE * hDestination = fopen ( dest , " w " ) ; <nl> + if ( hSource = = nullptr | | hDestination = = nullptr ) <nl> + { <nl> + fclose ( hSource ) ; <nl> + fclose ( hDestination ) ; <nl> + return false ; <nl> + } <nl> + <nl> + const bool success = ( size_t ( sourceSize ) ! = sendfile ( fileno ( hDestination ) , fileno ( hSource ) , nullptr , size_t ( sourceSize ) ) ) ; <nl> + fclose ( hSource ) ; <nl> + fclose ( hDestination ) ; <nl> + <nl> + return success ; <nl> # else <nl> if ( bFailIfExist & & IsFileExist ( dest , eFileLocation_OnDisk ) ) <nl> return false ; <nl> mmm a / Code / CryEngine / CrySystem / Profiling / CryProfilingSystem . cpp <nl> ppp b / Code / CryEngine / CrySystem / Profiling / CryProfilingSystem . cpp <nl> const CCryProfilingSystem : : PeakList * CCryProfilingSystem : : GetPeakRecords ( ) const <nl> <nl> void CCryProfilingSystem : : CheckForPeak ( int64 time , SProfilingSectionTracker * pTracker ) <nl> { <nl> - float average = pTracker - > selfValue . Average ( ) ; <nl> - float peakValue = pTracker - > selfValue . Latest ( ) ; <nl> + const float average = pTracker - > selfValue . Average ( ) ; <nl> + const float peakValue = pTracker - > selfValue . Latest ( ) ; <nl> <nl> if ( ( peakValue - average ) > profile_peak_tolerance ) <nl> { <nl> void CCryProfilingSystem : : CheckForPeak ( int64 time , SProfilingSectionTracker * pTr <nl> peak . peakValue = peakValue ; <nl> peak . averageValue = average ; <nl> peak . variance = pTracker - > selfValue . Variance ( ) ; <nl> - peak . count = pTracker - > count ; <nl> + peak . count = int ( pTracker - > count . Latest ( ) ) ; <nl> <nl> peak . pageFaults = m_pageFaultsPerFrame . CurrentRaw ( ) ; <nl> peak . frame = gEnv - > nMainFrameID ; <nl> mmm a / Code / CryEngine / RenderDll / Common / ParticleBuffer . cpp <nl> ppp b / Code / CryEngine / RenderDll / Common / ParticleBuffer . cpp <nl> void CParticleSubBuffer : : Release ( ) <nl> { <nl> Unlock ( 0 ) ; <nl> m_buffer . Release ( ) ; <nl> - if ( m_handle ) <nl> + if ( m_handle & & gRenDev ) <nl> gRenDev - > m_DevBufMan . Destroy ( m_handle ) ; <nl> m_handle = 0 ; <nl> m_flags = 0 ; <nl> void CParticleBufferSet : : Release ( ) <nl> m_subBufferAxes . Release ( ) ; <nl> m_subBufferColors . Release ( ) ; <nl> <nl> - if ( m_spriteIndexBufferHandle ) <nl> + if ( m_spriteIndexBufferHandle & & gRenDev ) <nl> gRenDev - > m_DevBufMan . Destroy ( m_spriteIndexBufferHandle ) ; <nl> m_spriteIndexBufferHandle = 0 ; <nl> <nl> mmm a / Code / CryPlugins / CryLobby / Module / CryLobby . cpp <nl> ppp b / Code / CryPlugins / CryLobby / Module / CryLobby . cpp <nl> void CCryLobby : : InternalSocketCreate ( ECryLobbyService service ) <nl> } <nl> else <nl> { <nl> - NetLog ( " [ Lobby ] Socket could not be created , check firewall or try a different port . Connecting to network games may fail if not fixed . " ) ; <nl> + CryWarning ( VALIDATOR_MODULE_ONLINE , VALIDATOR_ERROR , <nl> + " [ Lobby ] Socket could not be created , check firewall or try a different port . Connecting to network games may fail if not fixed . " ) ; <nl> } <nl> } <nl> } <nl> | ! I integrate from / / ce / main . . . | CRYTEK/CRYENGINE | d7195f4b987b5729590b871685cf0ef006f11faa | 2019-06-12T08:02:06Z |
mmm a / tensorflow / core / kernels / stack_ops . cc <nl> ppp b / tensorflow / core / kernels / stack_ops . cc <nl> class StackPushOp : public OpKernel { <nl> stack - > Push ( PersistentTensor ( ctx - > input ( 1 ) ) ) ; <nl> ctx - > set_output ( 0 , ctx - > input ( 1 ) ) ; <nl> } <nl> + <nl> + bool IsExpensive ( ) override { return false ; } <nl> } ; <nl> <nl> REGISTER_KERNEL_BUILDER ( Name ( " StackPush " ) . Device ( DEVICE_CPU ) , StackPushOp ) ; <nl> class StackPopOp : public OpKernel { <nl> " Calling Pop ( ) when the stack is empty . " ) ) ; <nl> ctx - > set_output ( 0 , * value . AccessTensor ( ctx ) ) ; <nl> } <nl> + <nl> + bool IsExpensive ( ) override { return false ; } <nl> } ; <nl> <nl> REGISTER_KERNEL_BUILDER ( Name ( " StackPop " ) . Device ( DEVICE_CPU ) , StackPopOp ) ; <nl> mmm a / tensorflow / core / kernels / tensor_array_ops . cc <nl> ppp b / tensorflow / core / kernels / tensor_array_ops . cc <nl> class TensorArrayWriteOp : public OpKernel { <nl> PersistentTensor persistent_tensor ( * tensor_value ) ; <nl> OP_REQUIRES_OK ( ctx , tensor_array - > Write ( ctx , index , & persistent_tensor ) ) ; <nl> } <nl> + <nl> + bool IsExpensive ( ) override { return false ; } <nl> } ; <nl> <nl> # define REGISTER_WRITE ( type ) \ <nl> class TensorArrayReadOp : public OpKernel { <nl> ctx - > set_output ( 0 , * value . AccessTensor ( ctx ) ) ; <nl> } <nl> <nl> + bool IsExpensive ( ) override { return false ; } <nl> + <nl> private : <nl> DataType dtype_ ; <nl> } ; <nl> | Inline read / write ops of Stack and TensorArray . | tensorflow/tensorflow | 5dc0ab7565afc0f707adc628c2865233a9702cfa | 2016-01-30T04:15:37Z |
mmm a / src / mongo / shell / dbshell . cpp <nl> ppp b / src / mongo / shell / dbshell . cpp <nl> <nl> using namespace std : : literals : : string_literals ; <nl> using namespace mongo ; <nl> <nl> + std : : string historyFile ; <nl> bool gotInterrupted = false ; <nl> bool inMultiLine = false ; <nl> static AtomicWord < bool > atPrompt ( false ) ; / / can eval before getting to prompt <nl> void completionHook ( const char * text , linenoiseCompletions * lc ) { <nl> } <nl> <nl> void shellHistoryInit ( ) { <nl> - Status res = linenoiseHistoryLoad ( shell_utils : : getHistoryFilePath ( ) . string ( ) . c_str ( ) ) ; <nl> + std : : stringstream ss ; <nl> + const char * h = shell_utils : : getUserDir ( ) ; <nl> + if ( h ) <nl> + ss < < h < < " / " ; <nl> + ss < < " . dbshell " ; <nl> + historyFile = ss . str ( ) ; <nl> + <nl> + Status res = linenoiseHistoryLoad ( historyFile . c_str ( ) ) ; <nl> if ( ! res . isOK ( ) ) { <nl> error ( ) < < " Error loading history file : " < < res ; <nl> } <nl> void shellHistoryInit ( ) { <nl> } <nl> <nl> void shellHistoryDone ( ) { <nl> - Status res = linenoiseHistorySave ( shell_utils : : getHistoryFilePath ( ) . string ( ) . c_str ( ) ) ; <nl> + Status res = linenoiseHistorySave ( historyFile . c_str ( ) ) ; <nl> if ( ! res . isOK ( ) ) { <nl> error ( ) < < " Error saving history file : " < < res ; <nl> } <nl> int _main ( int argc , char * argv [ ] , char * * envp ) { <nl> std : : stringstream ss ; <nl> ss < < " DB . prototype . _defaultAuthenticationMechanism = \ " " < < escape ( authMechanisms . get ( ) ) <nl> < < " \ " ; " < < std : : endl ; <nl> - mongo : : shell_utils : : dbConnect + = ss . str ( ) ; <nl> + mongo : : shell_utils : : _dbConnect + = ss . str ( ) ; <nl> } <nl> <nl> if ( const auto gssapiServiveName = parsedURI . getOption ( " gssapiServiceName " ) ) { <nl> std : : stringstream ss ; <nl> ss < < " DB . prototype . _defaultGssapiServiceName = \ " " < < escape ( gssapiServiveName . get ( ) ) <nl> < < " \ " ; " < < std : : endl ; <nl> - mongo : : shell_utils : : dbConnect + = ss . str ( ) ; <nl> + mongo : : shell_utils : : _dbConnect + = ss . str ( ) ; <nl> } <nl> <nl> if ( ! shellGlobalParams . nodb ) { / / connect to db <nl> int _main ( int argc , char * argv [ ] , char * * envp ) { <nl> ss < < " db = db . getMongo ( ) . startSession ( ) . getDatabase ( db . getName ( ) ) ; " < < std : : endl ; <nl> } <nl> <nl> - mongo : : shell_utils : : dbConnect + = ss . str ( ) ; <nl> + mongo : : shell_utils : : _dbConnect + = ss . str ( ) ; <nl> } <nl> <nl> mongo : : ScriptEngine : : setConnectCallback ( mongo : : shell_utils : : onConnect ) ; <nl> mmm a / src / mongo / shell / shell_utils . cpp <nl> ppp b / src / mongo / shell / shell_utils . cpp <nl> <nl> <nl> # include " mongo / shell / shell_utils . h " <nl> <nl> - # include < algorithm > <nl> - # include < boost / filesystem . hpp > <nl> - # include < memory > <nl> - # include < set > <nl> - # include < stdlib . h > <nl> - # include < string > <nl> - # include < vector > <nl> - <nl> - # ifndef _WIN32 <nl> - # include < pwd . h > <nl> - # include < sys / types . h > <nl> - # endif <nl> - <nl> - # include " mongo / base / shim . h " <nl> # include " mongo / client / dbclient_base . h " <nl> # include " mongo / client / replica_set_monitor . h " <nl> # include " mongo / db / hasher . h " <nl> <nl> # include " mongo / shell / shell_options . h " <nl> # include " mongo / shell / shell_utils_extended . h " <nl> # include " mongo / shell / shell_utils_launcher . h " <nl> - # include " mongo / stdx / mutex . h " <nl> # include " mongo / util / fail_point_service . h " <nl> # include " mongo / util / log . h " <nl> # include " mongo / util / processinfo . h " <nl> # include " mongo / util / quick_exit . h " <nl> # include " mongo / util / text . h " <nl> # include " mongo / util / version . h " <nl> - # include < pwd . h > <nl> - <nl> - namespace mongo : : shell_utils { <nl> - namespace { <nl> - boost : : filesystem : : path getUserDir ( ) { <nl> - # ifdef _WIN32 <nl> - auto envp = getenv ( " USERPROFILE " ) ; <nl> - if ( envp ) <nl> - return envp ; <nl> - <nl> - return " . / " ; <nl> - # else <nl> - const auto homeDir = getenv ( " HOME " ) ; <nl> - if ( homeDir ) <nl> - return homeDir ; <nl> - <nl> - / / The storage for these variables has to live until the value is captured into a std : : string at <nl> - / / the end of this function . This is because getpwuid_r ( 3 ) doesn ' t use static storage , but <nl> - / / storage provided by the caller . As a fallback , reserve enough space to store 8 paths , on the <nl> - / / theory that the pwent buffer probably needs about that many paths , to fully describe a user <nl> - / / - - shell paths , home directory paths , etc . <nl> - <nl> - const long pwentBufferSize = std : : max < long > ( sysconf ( _SC_GETPW_R_SIZE_MAX ) , PATH_MAX * 8 ) ; <nl> <nl> - struct passwd pwent ; <nl> - struct passwd * res ; <nl> - <nl> - std : : vector < char > buffer ( pwentBufferSize ) ; <nl> - <nl> - do { <nl> - if ( ! getpwuid_r ( getuid ( ) , & pwent , & buffer [ 0 ] , buffer . size ( ) , & res ) ) <nl> - break ; <nl> - <nl> - if ( errno ! = EINTR ) <nl> - uasserted ( mongo : : ErrorCodes : : InternalError , <nl> - " Unable to get home directory for the current user . " ) ; <nl> - } while ( errno = = EINTR ) ; <nl> - <nl> - return pwent . pw_dir ; <nl> - # endif <nl> - } <nl> - <nl> - } / / namespace <nl> - } / / namespace mongo : : shell_utils <nl> - <nl> - boost : : filesystem : : path mongo : : shell_utils : : getHistoryFilePath ( ) { <nl> - static const auto & historyFile = * new boost : : filesystem : : path ( getUserDir ( ) / " . dbshell " ) ; <nl> - <nl> - return historyFile ; <nl> - } <nl> + namespace mongo { <nl> <nl> + using std : : set ; <nl> + using std : : map ; <nl> + using std : : string ; <nl> <nl> - namespace mongo { <nl> namespace JSFiles { <nl> extern const JSFile servers ; <nl> extern const JSFile shardingtest ; <nl> extern const JSFile servers_misc ; <nl> extern const JSFile replsettest ; <nl> extern const JSFile bridge ; <nl> - } / / namespace JSFiles <nl> + } <nl> <nl> MONGO_REGISTER_SHIM ( BenchRunConfig : : createConnectionImpl ) <nl> ( const BenchRunConfig & config ) - > std : : unique_ptr < DBClientBase > { <nl> MONGO_REGISTER_SHIM ( BenchRunConfig : : createConnectionImpl ) <nl> <nl> namespace shell_utils { <nl> <nl> - std : : string dbConnect ; <nl> - <nl> - static const char * argv0 = 0 ; <nl> + std : : string _dbConnect ; <nl> <nl> + const char * argv0 = 0 ; <nl> void RecordMyLocation ( const char * _argv0 ) { <nl> argv0 = _argv0 ; <nl> } <nl> BSONElement singleArg ( const BSONObj & args ) { <nl> return args . firstElement ( ) ; <nl> } <nl> <nl> + const char * getUserDir ( ) { <nl> + # ifdef _WIN32 <nl> + return getenv ( " USERPROFILE " ) ; <nl> + # else <nl> + return getenv ( " HOME " ) ; <nl> + # endif <nl> + } <nl> + <nl> / / real methods <nl> <nl> BSONObj JSGetMemInfo ( const BSONObj & args , void * data ) { <nl> void initScope ( Scope & scope ) { <nl> scope . injectNative ( " benchStart " , BenchRunner : : benchStart ) ; <nl> scope . injectNative ( " benchFinish " , BenchRunner : : benchFinish ) ; <nl> <nl> - if ( ! dbConnect . empty ( ) ) { <nl> - uassert ( 12513 , " connect failed " , scope . exec ( dbConnect , " ( connect ) " , false , true , false ) ) ; <nl> + if ( ! _dbConnect . empty ( ) ) { <nl> + uassert ( 12513 , " connect failed " , scope . exec ( _dbConnect , " ( connect ) " , false , true , false ) ) ; <nl> } <nl> } <nl> <nl> - Prompter : : Prompter ( const std : : string & prompt ) : _prompt ( prompt ) , _confirmed ( ) { } <nl> + Prompter : : Prompter ( const string & prompt ) : _prompt ( prompt ) , _confirmed ( ) { } <nl> <nl> bool Prompter : : confirm ( ) { <nl> if ( _confirmed ) { <nl> ConnectionRegistry : : ConnectionRegistry ( ) = default ; <nl> void ConnectionRegistry : : registerConnection ( DBClientBase & client ) { <nl> BSONObj info ; <nl> if ( client . runCommand ( " admin " , BSON ( " whatsmyuri " < < 1 ) , info ) ) { <nl> - std : : string connstr = client . getServerAddress ( ) ; <nl> + string connstr = client . getServerAddress ( ) ; <nl> stdx : : lock_guard < stdx : : mutex > lk ( _mutex ) ; <nl> _connectionUris [ connstr ] . insert ( info [ " you " ] . str ( ) ) ; <nl> } <nl> void ConnectionRegistry : : registerConnection ( DBClientBase & client ) { <nl> void ConnectionRegistry : : killOperationsOnAllConnections ( bool withPrompt ) const { <nl> Prompter prompter ( " do you want to kill the current op ( s ) on the server ? " ) ; <nl> stdx : : lock_guard < stdx : : mutex > lk ( _mutex ) ; <nl> - for ( auto & connection : _connectionUris ) { <nl> - auto status = ConnectionString : : parse ( connection . first ) ; <nl> + for ( map < string , set < string > > : : const_iterator i = _connectionUris . begin ( ) ; <nl> + i ! = _connectionUris . end ( ) ; <nl> + + + i ) { <nl> + auto status = ConnectionString : : parse ( i - > first ) ; <nl> if ( ! status . isOK ( ) ) { <nl> continue ; <nl> } <nl> <nl> const ConnectionString cs ( status . getValue ( ) ) ; <nl> <nl> - std : : string errmsg ; <nl> + string errmsg ; <nl> std : : unique_ptr < DBClientBase > conn ( cs . connect ( " MongoDB Shell " , errmsg ) ) ; <nl> if ( ! conn ) { <nl> continue ; <nl> } <nl> <nl> - const std : : set < std : : string > & uris = connection . second ; <nl> + const set < string > & uris = i - > second ; <nl> <nl> BSONObj currentOpRes ; <nl> conn - > runPseudoCommand ( " admin " , " currentOp " , " $ cmd . sys . inprog " , { } , currentOpRes ) ; <nl> void ConnectionRegistry : : killOperationsOnAllConnections ( bool withPrompt ) const { <nl> auto inprog = currentOpRes [ " inprog " ] . embeddedObject ( ) ; <nl> for ( const auto op : inprog ) { <nl> / / For sharded clusters , ` client_s ` is used instead and ` client ` is not present . <nl> - std : : string client ; <nl> + string client ; <nl> if ( auto elem = op [ " client " ] ) { <nl> / / mongod currentOp client <nl> if ( elem . type ( ) ! = String ) { <nl> bool fileExists ( const std : : string & file ) { <nl> <nl> <nl> stdx : : mutex & mongoProgramOutputMutex ( * ( new stdx : : mutex ( ) ) ) ; <nl> - } / / namespace shell_utils <nl> + } <nl> } / / namespace mongo <nl> mmm a / src / mongo / shell / shell_utils . h <nl> ppp b / src / mongo / shell / shell_utils . h <nl> <nl> <nl> # pragma once <nl> <nl> - # include < boost / filesystem . hpp > <nl> - # include < map > <nl> - # include < set > <nl> - # include < string > <nl> - <nl> # include " mongo / db / jsobj . h " <nl> # include " mongo / stdx / mutex . h " <nl> # include " mongo / util / concurrency / mutex . h " <nl> class DBClientBase ; <nl> <nl> namespace shell_utils { <nl> <nl> - extern std : : string dbConnect ; <nl> + extern std : : string _dbConnect ; <nl> <nl> void RecordMyLocation ( const char * _argv0 ) ; <nl> void installShellUtils ( Scope & scope ) ; <nl> void installShellUtils ( Scope & scope ) ; <nl> void initScope ( Scope & scope ) ; <nl> void onConnect ( DBClientBase & c ) ; <nl> <nl> - boost : : filesystem : : path getHistoryFilePath ( ) ; <nl> + const char * getUserDir ( ) ; <nl> <nl> BSONElement singleArg ( const BSONObj & args ) ; <nl> extern const BSONObj undefinedReturn ; <nl> | Revert " SERVER - 39195 Make shell history file placement more correct . " | mongodb/mongo | 6664b30dc1cc38b5985ce9920e1d00a490b280a5 | 2019-03-15T21:54:31Z |
mmm a / include / spdlog / details / async_log_helper . h <nl> ppp b / include / spdlog / details / async_log_helper . h <nl> inline void spdlog : : details : : async_log_helper : : sleep_or_yield ( const spdlog : : log_ <nl> inline void spdlog : : details : : async_log_helper : : wait_empty_q ( ) <nl> { <nl> auto last_op = details : : os : : now ( ) ; <nl> - while ( _q . approx_size ( ) > 0 ) <nl> + while ( ! _q . is_empty ( ) ) <nl> { <nl> sleep_or_yield ( details : : os : : now ( ) , last_op ) ; <nl> } <nl> mmm a / include / spdlog / details / mpmc_bounded_q . h <nl> ppp b / include / spdlog / details / mpmc_bounded_q . h <nl> Distributed under the MIT License ( http : / / opensource . org / licenses / MIT ) <nl> <nl> namespace spdlog <nl> { <nl> - namespace details <nl> - { <nl> - <nl> - template < typename T > <nl> - class mpmc_bounded_queue <nl> - { <nl> - public : <nl> - <nl> - using item_type = T ; <nl> - mpmc_bounded_queue ( size_t buffer_size ) <nl> - : max_size_ ( buffer_size ) , <nl> - buffer_ ( new cell_t [ buffer_size ] ) , <nl> - buffer_mask_ ( buffer_size - 1 ) <nl> - { <nl> - / / queue size must be power of two <nl> - if ( ! ( ( buffer_size > = 2 ) & & ( ( buffer_size & ( buffer_size - 1 ) ) = = 0 ) ) ) <nl> - throw spdlog_ex ( " async logger queue size must be power of two " ) ; <nl> - <nl> - for ( size_t i = 0 ; i ! = buffer_size ; i + = 1 ) <nl> - buffer_ [ i ] . sequence_ . store ( i , std : : memory_order_relaxed ) ; <nl> - enqueue_pos_ . store ( 0 , std : : memory_order_relaxed ) ; <nl> - dequeue_pos_ . store ( 0 , std : : memory_order_relaxed ) ; <nl> - } <nl> - <nl> - ~ mpmc_bounded_queue ( ) <nl> - { <nl> - delete [ ] buffer_ ; <nl> - } <nl> - <nl> - <nl> - bool enqueue ( T & & data ) <nl> - { <nl> - cell_t * cell ; <nl> - size_t pos = enqueue_pos_ . load ( std : : memory_order_relaxed ) ; <nl> - for ( ; ; ) <nl> - { <nl> - cell = & buffer_ [ pos & buffer_mask_ ] ; <nl> - size_t seq = cell - > sequence_ . load ( std : : memory_order_acquire ) ; <nl> - intptr_t dif = static_cast < intptr_t > ( seq ) - static_cast < intptr_t > ( pos ) ; <nl> - if ( dif = = 0 ) <nl> - { <nl> - if ( enqueue_pos_ . compare_exchange_weak ( pos , pos + 1 , std : : memory_order_relaxed ) ) <nl> - break ; <nl> - } <nl> - else if ( dif < 0 ) <nl> - { <nl> - return false ; <nl> - } <nl> - else <nl> - { <nl> - pos = enqueue_pos_ . load ( std : : memory_order_relaxed ) ; <nl> - } <nl> - } <nl> - cell - > data_ = std : : move ( data ) ; <nl> - cell - > sequence_ . store ( pos + 1 , std : : memory_order_release ) ; <nl> - return true ; <nl> - } <nl> - <nl> - bool dequeue ( T & data ) <nl> - { <nl> - cell_t * cell ; <nl> - size_t pos = dequeue_pos_ . load ( std : : memory_order_relaxed ) ; <nl> - for ( ; ; ) <nl> - { <nl> - cell = & buffer_ [ pos & buffer_mask_ ] ; <nl> - size_t seq = <nl> - cell - > sequence_ . load ( std : : memory_order_acquire ) ; <nl> - intptr_t dif = static_cast < intptr_t > ( seq ) - static_cast < intptr_t > ( pos + 1 ) ; <nl> - if ( dif = = 0 ) <nl> - { <nl> - if ( dequeue_pos_ . compare_exchange_weak ( pos , pos + 1 , std : : memory_order_relaxed ) ) <nl> - break ; <nl> - } <nl> - else if ( dif < 0 ) <nl> - return false ; <nl> - else <nl> - pos = dequeue_pos_ . load ( std : : memory_order_relaxed ) ; <nl> - } <nl> - data = std : : move ( cell - > data_ ) ; <nl> - cell - > sequence_ . store ( pos + buffer_mask_ + 1 , std : : memory_order_release ) ; <nl> - return true ; <nl> - } <nl> - <nl> - size_t approx_size ( ) <nl> - { <nl> - size_t first_pos = dequeue_pos_ . load ( std : : memory_order_relaxed ) ; <nl> - size_t last_pos = enqueue_pos_ . load ( std : : memory_order_relaxed ) ; <nl> - if ( last_pos < = first_pos ) <nl> - return 0 ; <nl> - auto size = last_pos - first_pos ; <nl> - return size < max_size_ ? size : max_size_ ; <nl> - } <nl> - <nl> - private : <nl> - struct cell_t <nl> - { <nl> - std : : atomic < size_t > sequence_ ; <nl> - T data_ ; <nl> - } ; <nl> - <nl> - size_t const max_size_ ; <nl> - <nl> - static size_t const cacheline_size = 64 ; <nl> - typedef char cacheline_pad_t [ cacheline_size ] ; <nl> - <nl> - cacheline_pad_t pad0_ ; <nl> - cell_t * const buffer_ ; <nl> - size_t const buffer_mask_ ; <nl> - cacheline_pad_t pad1_ ; <nl> - std : : atomic < size_t > enqueue_pos_ ; <nl> - cacheline_pad_t pad2_ ; <nl> - std : : atomic < size_t > dequeue_pos_ ; <nl> - cacheline_pad_t pad3_ ; <nl> - <nl> - mpmc_bounded_queue ( mpmc_bounded_queue const & ) = delete ; <nl> - void operator = ( mpmc_bounded_queue const & ) = delete ; <nl> - } ; <nl> - <nl> - } / / ns details <nl> + namespace details <nl> + { <nl> + <nl> + template < typename T > <nl> + class mpmc_bounded_queue <nl> + { <nl> + public : <nl> + <nl> + using item_type = T ; <nl> + mpmc_bounded_queue ( size_t buffer_size ) <nl> + : max_size_ ( buffer_size ) , <nl> + buffer_ ( new cell_t [ buffer_size ] ) , <nl> + buffer_mask_ ( buffer_size - 1 ) <nl> + { <nl> + / / queue size must be power of two <nl> + if ( ! ( ( buffer_size > = 2 ) & & ( ( buffer_size & ( buffer_size - 1 ) ) = = 0 ) ) ) <nl> + throw spdlog_ex ( " async logger queue size must be power of two " ) ; <nl> + <nl> + for ( size_t i = 0 ; i ! = buffer_size ; i + = 1 ) <nl> + buffer_ [ i ] . sequence_ . store ( i , std : : memory_order_relaxed ) ; <nl> + enqueue_pos_ . store ( 0 , std : : memory_order_relaxed ) ; <nl> + dequeue_pos_ . store ( 0 , std : : memory_order_relaxed ) ; <nl> + } <nl> + <nl> + ~ mpmc_bounded_queue ( ) <nl> + { <nl> + delete [ ] buffer_ ; <nl> + } <nl> + <nl> + <nl> + bool enqueue ( T & & data ) <nl> + { <nl> + cell_t * cell ; <nl> + size_t pos = enqueue_pos_ . load ( std : : memory_order_relaxed ) ; <nl> + for ( ; ; ) { <nl> + cell = & buffer_ [ pos & buffer_mask_ ] ; <nl> + size_t seq = cell - > sequence_ . load ( std : : memory_order_acquire ) ; <nl> + intptr_t dif = static_cast < intptr_t > ( seq ) - static_cast < intptr_t > ( pos ) ; <nl> + if ( dif = = 0 ) { <nl> + if ( enqueue_pos_ . compare_exchange_weak ( pos , pos + 1 , std : : memory_order_relaxed ) ) <nl> + break ; <nl> + } <nl> + else if ( dif < 0 ) { <nl> + return false ; <nl> + } <nl> + else { <nl> + pos = enqueue_pos_ . load ( std : : memory_order_relaxed ) ; <nl> + } <nl> + } <nl> + cell - > data_ = std : : move ( data ) ; <nl> + cell - > sequence_ . store ( pos + 1 , std : : memory_order_release ) ; <nl> + return true ; <nl> + } <nl> + <nl> + bool dequeue ( T & data ) <nl> + { <nl> + cell_t * cell ; <nl> + size_t pos = dequeue_pos_ . load ( std : : memory_order_relaxed ) ; <nl> + for ( ; ; ) { <nl> + cell = & buffer_ [ pos & buffer_mask_ ] ; <nl> + size_t seq = <nl> + cell - > sequence_ . load ( std : : memory_order_acquire ) ; <nl> + intptr_t dif = static_cast < intptr_t > ( seq ) - static_cast < intptr_t > ( pos + 1 ) ; <nl> + if ( dif = = 0 ) { <nl> + if ( dequeue_pos_ . compare_exchange_weak ( pos , pos + 1 , std : : memory_order_relaxed ) ) <nl> + break ; <nl> + } <nl> + else if ( dif < 0 ) <nl> + return false ; <nl> + else <nl> + pos = dequeue_pos_ . load ( std : : memory_order_relaxed ) ; <nl> + } <nl> + data = std : : move ( cell - > data_ ) ; <nl> + cell - > sequence_ . store ( pos + buffer_mask_ + 1 , std : : memory_order_release ) ; <nl> + return true ; <nl> + } <nl> + <nl> + bool is_empty ( ) <nl> + { <nl> + unsigned front , front1 , back ; <nl> + / / try to take a consistent snapshot of front / tail . <nl> + do { <nl> + front = enqueue_pos_ . load ( std : : memory_order_acquire ) ; <nl> + back = dequeue_pos_ . load ( std : : memory_order_acquire ) ; <nl> + front1 = enqueue_pos_ . load ( std : : memory_order_relaxed ) ; <nl> + } while ( front ! = front1 ) ; <nl> + return back = = front ; <nl> + } <nl> + <nl> + private : <nl> + struct cell_t <nl> + { <nl> + std : : atomic < size_t > sequence_ ; <nl> + T data_ ; <nl> + } ; <nl> + <nl> + size_t const max_size_ ; <nl> + <nl> + static size_t const cacheline_size = 64 ; <nl> + typedef char cacheline_pad_t [ cacheline_size ] ; <nl> + <nl> + cacheline_pad_t pad0_ ; <nl> + cell_t * const buffer_ ; <nl> + size_t const buffer_mask_ ; <nl> + cacheline_pad_t pad1_ ; <nl> + std : : atomic < size_t > enqueue_pos_ ; <nl> + cacheline_pad_t pad2_ ; <nl> + std : : atomic < size_t > dequeue_pos_ ; <nl> + cacheline_pad_t pad3_ ; <nl> + <nl> + mpmc_bounded_queue ( mpmc_bounded_queue const & ) = delete ; <nl> + void operator = ( mpmc_bounded_queue const & ) = delete ; <nl> + } ; <nl> + <nl> + } / / ns details <nl> } / / ns spdlog <nl> | Fixed issue by adding an " is_empty " method to the queue instead of the buggy approx_size | gabime/spdlog | f5fe681a4193866cda6fd8deb1c7026e4491d75d | 2017-11-04T22:21:00Z |
mmm a / xbmc / cores / omxplayer / OMXAudio . cpp <nl> ppp b / xbmc / cores / omxplayer / OMXAudio . cpp <nl> extern " C " { <nl> <nl> using namespace std ; <nl> <nl> + / / the size of the audio_render output port buffers <nl> + # define AUDIO_DECODE_OUTPUT_BUFFER ( 32 * 1024 ) <nl> + static const char rounded_up_channels_shift [ ] = { 0 , 0 , 1 , 2 , 2 , 3 , 3 , 3 , 3 } ; <nl> + <nl> static const uint16_t AC3Bitrates [ ] = { 32 , 40 , 48 , 56 , 64 , 80 , 96 , 112 , 128 , 160 , 192 , 224 , 256 , 320 , 384 , 448 , 512 , 576 , 640 } ; <nl> static const uint16_t AC3FSCod [ ] = { 48000 , 44100 , 32000 , 0 } ; <nl> <nl> COMXAudio : : COMXAudio ( ) : <nl> m_Passthrough ( false ) , <nl> m_HWDecode ( false ) , <nl> m_BytesPerSec ( 0 ) , <nl> + m_InputBytesPerSec ( 0 ) , <nl> m_BufferLen ( 0 ) , <nl> m_ChunkLen ( 0 ) , <nl> m_InputChannels ( 0 ) , <nl> bool COMXAudio : : Initialize ( AEAudioFormat format , OMXClock * clock , CDVDStreamInfo <nl> <nl> m_SampleRate = m_format . m_sampleRate ; <nl> m_BitsPerSample = CAEUtil : : DataFormatToBits ( m_format . m_dataFormat ) ; <nl> - m_BufferLen = m_BytesPerSec = m_format . m_sampleRate * ( 16 > > 3 ) * m_InputChannels ; <nl> - m_BufferLen * = AUDIO_BUFFER_SECONDS ; <nl> + m_BytesPerSec = m_SampleRate * 2 < < rounded_up_channels_shift [ m_InputChannels ] ; <nl> + m_BufferLen = m_BytesPerSec * AUDIO_BUFFER_SECONDS ; <nl> + m_InputBytesPerSec = m_SampleRate * m_BitsPerSample * m_InputChannels > > 3 ; <nl> + <nl> + / / should be big enough that common formats ( e . g . 6 channel DTS ) fit in a single packet . <nl> + / / we don ' t mind less common formats being split ( e . g . ape / wma output large frames ) <nl> / / the audio_decode output buffer size is 32K , and typically we convert from <nl> - / / 6 channel 32bpp float to 8 channel 16bpp in , so a full 48K input buffer will fit the outbut buffer <nl> - m_ChunkLen = 48 * 1024 ; <nl> + / / 6 channel 32bpp float to 8 channel 16bpp in , so a full 48K input buffer will fit the output buffer <nl> + m_ChunkLen = AUDIO_DECODE_OUTPUT_BUFFER * ( m_InputChannels * m_BitsPerSample ) > > ( rounded_up_channels_shift [ m_InputChannels ] + 4 ) ; <nl> <nl> m_wave_header . Samples . wSamplesPerBlock = 0 ; <nl> m_wave_header . Format . nChannels = m_InputChannels ; <nl> bool COMXAudio : : Initialize ( AEAudioFormat format , OMXClock * clock , CDVDStreamInfo <nl> m_maxLevel = 0 . 0f ; <nl> <nl> CLog : : Log ( LOGDEBUG , " COMXAudio : : Initialize Input bps % d samplerate % d channels % d buffer size % d bytes per second % d " , <nl> - ( int ) m_pcm_input . nBitPerSample , ( int ) m_pcm_input . nSamplingRate , ( int ) m_pcm_input . nChannels , m_BufferLen , m_BytesPerSec ) ; <nl> + ( int ) m_pcm_input . nBitPerSample , ( int ) m_pcm_input . nSamplingRate , ( int ) m_pcm_input . nChannels , m_BufferLen , m_InputBytesPerSec ) ; <nl> PrintPCM ( & m_pcm_input , std : : string ( " input " ) ) ; <nl> CLog : : Log ( LOGDEBUG , " COMXAudio : : Initialize device passthrough % d hwdecode % d " , <nl> m_Passthrough , m_HWDecode ) ; <nl> bool COMXAudio : : ApplyVolume ( void ) <nl> / / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> unsigned int COMXAudio : : AddPackets ( const void * data , unsigned int len ) <nl> { <nl> - return AddPackets ( data , len , 0 , 0 ) ; <nl> + return AddPackets ( data , len , 0 , 0 , 0 ) ; <nl> } <nl> <nl> / / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> - unsigned int COMXAudio : : AddPackets ( const void * data , unsigned int len , double dts , double pts ) <nl> + unsigned int COMXAudio : : AddPackets ( const void * data , unsigned int len , double dts , double pts , unsigned int frame_size ) <nl> { <nl> CSingleLock lock ( m_critSection ) ; <nl> <nl> unsigned int COMXAudio : : AddPackets ( const void * data , unsigned int len , double dt <nl> omx_buffer - > nOffset = 0 ; <nl> omx_buffer - > nFlags = 0 ; <nl> <nl> + / / we want audio_decode output buffer size to be no more than AUDIO_DECODE_OUTPUT_BUFFER . <nl> + / / it will be 16 - bit and rounded up to next power of 2 in channels <nl> + unsigned int max_buffer = AUDIO_DECODE_OUTPUT_BUFFER * ( m_InputChannels * m_BitsPerSample ) > > ( rounded_up_channels_shift [ m_InputChannels ] + 4 ) ; <nl> + <nl> unsigned int remaining = demuxer_samples - demuxer_samples_sent ; <nl> - unsigned int samples_space = omx_buffer - > nAllocLen / pitch ; <nl> + unsigned int samples_space = std : : min ( max_buffer , omx_buffer - > nAllocLen ) / pitch ; <nl> unsigned int samples = std : : min ( remaining , samples_space ) ; <nl> <nl> omx_buffer - > nFilledLen = samples * pitch ; <nl> <nl> - if ( samples < demuxer_samples & & m_BitsPerSample = = 32 & & ! ( m_Passthrough | | m_HWDecode ) ) <nl> + unsigned int frames = frame_size ? len / frame_size : 0 ; <nl> + if ( ( samples < demuxer_samples | | frames > 1 ) & & m_BitsPerSample = = 32 & & ! ( m_Passthrough | | m_HWDecode ) ) <nl> { <nl> - uint8_t * dst = omx_buffer - > pBuffer ; <nl> - uint8_t * src = demuxer_content + demuxer_samples_sent * ( m_BitsPerSample > > 3 ) ; <nl> - / / we need to extract samples from planar audio , so the copying needs to be done per plane <nl> - for ( int i = 0 ; i < ( int ) m_InputChannels ; i + + ) <nl> - { <nl> - memcpy ( dst , src , omx_buffer - > nFilledLen / m_InputChannels ) ; <nl> - dst + = omx_buffer - > nFilledLen / m_InputChannels ; <nl> - src + = demuxer_samples * ( m_BitsPerSample > > 3 ) ; <nl> - } <nl> - assert ( dst < = omx_buffer - > pBuffer + m_ChunkLen ) ; <nl> + const unsigned int sample_pitch = m_BitsPerSample > > 3 ; <nl> + const unsigned int frame_samples = frame_size / pitch ; <nl> + const unsigned int plane_size = frame_samples * sample_pitch ; <nl> + const unsigned int out_plane_size = samples * sample_pitch ; <nl> + / / CLog : : Log ( LOGDEBUG , " % s : : % s samples : % d / % d ps : % d ops : % d fs : % d pitch : % d filled : % d frames = % d " , CLASSNAME , __func__ , samples , demuxer_samples , plane_size , out_plane_size , frame_size , pitch , omx_buffer - > nFilledLen , frames ) ; <nl> + for ( unsigned int sample = 0 ; sample < samples ; ) <nl> + { <nl> + unsigned int frame = ( demuxer_samples_sent + sample ) / frame_samples ; <nl> + unsigned int sample_in_frame = ( demuxer_samples_sent + sample ) - frame * frame_samples ; <nl> + int out_remaining = std : : min ( std : : min ( frame_samples - sample_in_frame , samples ) , samples - sample ) ; <nl> + uint8_t * src = demuxer_content + frame * frame_size + sample_in_frame * sample_pitch ; <nl> + uint8_t * dst = ( uint8_t * ) omx_buffer - > pBuffer + sample * sample_pitch ; <nl> + for ( unsigned int channel = 0 ; channel < m_InputChannels ; channel + + ) <nl> + { <nl> + / / CLog : : Log ( LOGDEBUG , " % s : : % s copy ( % d , % d , % d ) ( s : % d f : % d sin : % d c : % d ) " , CLASSNAME , __func__ , dst - ( uint8_t * ) omx_buffer - > pBuffer , src - demuxer_content , out_remaining , sample , frame , sample_in_frame , channel ) ; <nl> + memcpy ( dst , src , out_remaining * sample_pitch ) ; <nl> + src + = plane_size ; <nl> + dst + = out_plane_size ; <nl> + } <nl> + sample + = out_remaining ; <nl> + } <nl> } <nl> else <nl> { <nl> float COMXAudio : : GetCacheTime ( ) <nl> <nl> float COMXAudio : : GetCacheTotal ( ) <nl> { <nl> - return m_BytesPerSec ? ( float ) m_BufferLen / ( float ) m_BytesPerSec : 0 . 0f ; <nl> + float audioplus_buffer = m_SampleRate ? 0 . 0f : 32 . 0f * 512 . 0f / m_SampleRate ; <nl> + float input_buffer = ( float ) m_omx_decoder . GetInputBufferSize ( ) / ( float ) m_InputBytesPerSec ; <nl> + return AUDIO_BUFFER_SECONDS + input_buffer + audioplus_buffer ; <nl> } <nl> <nl> / / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <nl> mmm a / xbmc / cores / omxplayer / OMXAudio . h <nl> ppp b / xbmc / cores / omxplayer / OMXAudio . h <nl> class COMXAudio <nl> ~ COMXAudio ( ) ; <nl> <nl> unsigned int AddPackets ( const void * data , unsigned int len ) ; <nl> - unsigned int AddPackets ( const void * data , unsigned int len , double dts , double pts ) ; <nl> + unsigned int AddPackets ( const void * data , unsigned int len , double dts , double pts , unsigned int frame_size ) ; <nl> unsigned int GetSpace ( ) ; <nl> bool Deinitialize ( ) ; <nl> <nl> class COMXAudio <nl> bool m_Passthrough ; <nl> bool m_HWDecode ; <nl> unsigned int m_BytesPerSec ; <nl> + unsigned int m_InputBytesPerSec ; <nl> unsigned int m_BufferLen ; <nl> unsigned int m_ChunkLen ; <nl> unsigned int m_InputChannels ; <nl> mmm a / xbmc / cores / omxplayer / OMXAudioCodecOMX . cpp <nl> ppp b / xbmc / cores / omxplayer / OMXAudioCodecOMX . cpp <nl> <nl> <nl> # include " cores / AudioEngine / Utils / AEUtil . h " <nl> <nl> + / / the size of the audio_render output port buffers <nl> + # define AUDIO_DECODE_OUTPUT_BUFFER ( 32 * 1024 ) <nl> + static const char rounded_up_channels_shift [ ] = { 0 , 0 , 1 , 2 , 2 , 3 , 3 , 3 , 3 } ; <nl> + <nl> COMXAudioCodecOMX : : COMXAudioCodecOMX ( ) <nl> { <nl> m_pBufferOutput = NULL ; <nl> m_iBufferOutputAlloced = 0 ; <nl> + m_iBufferOutputUsed = 0 ; <nl> <nl> m_pCodecContext = NULL ; <nl> m_pConvert = NULL ; <nl> COMXAudioCodecOMX : : COMXAudioCodecOMX ( ) <nl> <nl> m_channels = 0 ; <nl> m_pFrame1 = NULL ; <nl> + m_frameSize = 0 ; <nl> m_bGotFrame = false ; <nl> + m_bNoConcatenate = false ; <nl> + <nl> m_iSampleFormat = AV_SAMPLE_FMT_NONE ; <nl> m_desiredSampleFormat = AV_SAMPLE_FMT_NONE ; <nl> } <nl> COMXAudioCodecOMX : : ~ COMXAudioCodecOMX ( ) <nl> av_free ( m_pBufferOutput ) ; <nl> m_pBufferOutput = NULL ; <nl> m_iBufferOutputAlloced = 0 ; <nl> + m_iBufferOutputUsed = 0 ; <nl> Dispose ( ) ; <nl> } <nl> <nl> bool COMXAudioCodecOMX : : Open ( CDVDStreamInfo & hints ) <nl> m_pCodecContext - > bit_rate = hints . bitrate ; <nl> m_pCodecContext - > bits_per_coded_sample = hints . bitspersample ; <nl> <nl> + / / vorbis has variable sized planar output , so skip concatenation <nl> + if ( hints . codec = = AV_CODEC_ID_VORBIS ) <nl> + m_bNoConcatenate = true ; <nl> + <nl> if ( m_pCodecContext - > bits_per_coded_sample = = 0 ) <nl> m_pCodecContext - > bits_per_coded_sample = 16 ; <nl> <nl> void COMXAudioCodecOMX : : Dispose ( ) <nl> m_bGotFrame = false ; <nl> } <nl> <nl> - int COMXAudioCodecOMX : : Decode ( BYTE * pData , int iSize ) <nl> + int COMXAudioCodecOMX : : Decode ( BYTE * pData , int iSize , double dts , double pts ) <nl> { <nl> int iBytesUsed , got_frame ; <nl> if ( ! m_pCodecContext ) return - 1 ; <nl> int COMXAudioCodecOMX : : Decode ( BYTE * pData , int iSize ) <nl> } <nl> <nl> m_bGotFrame = true ; <nl> + if ( ! m_iBufferOutputUsed ) <nl> + { <nl> + m_dts = dts ; <nl> + m_pts = pts ; <nl> + } <nl> return iBytesUsed ; <nl> } <nl> <nl> - int COMXAudioCodecOMX : : GetData ( BYTE * * dst ) <nl> + int COMXAudioCodecOMX : : GetData ( BYTE * * dst , double & dts , double & pts ) <nl> { <nl> if ( ! m_bGotFrame ) <nl> return 0 ; <nl> int COMXAudioCodecOMX : : GetData ( BYTE * * dst ) <nl> int inputSize = av_samples_get_buffer_size ( & inLineSize , m_pCodecContext - > channels , m_pFrame1 - > nb_samples , m_pCodecContext - > sample_fmt , 0 ) ; <nl> / * output audio will be packed * / <nl> int outputSize = av_samples_get_buffer_size ( & outLineSize , m_pCodecContext - > channels , m_pFrame1 - > nb_samples , m_desiredSampleFormat , 1 ) ; <nl> - bool cont = ! m_pFrame1 - > data [ 1 ] | | ( m_pFrame1 - > data [ 1 ] = = m_pFrame1 - > data [ 0 ] + inLineSize & & inLineSize = = outLineSize & & inLineSize * m_pCodecContext - > channels = = inputSize ) ; <nl> <nl> - if ( m_iBufferOutputAlloced < outputSize ) <nl> + if ( m_iBufferOutputAlloced < m_iBufferOutputUsed + outputSize ) <nl> { <nl> - av_free ( m_pBufferOutput ) ; <nl> - m_pBufferOutput = ( BYTE * ) av_malloc ( outputSize + FF_INPUT_BUFFER_PADDING_SIZE ) ; <nl> - m_iBufferOutputAlloced = outputSize ; <nl> + m_pBufferOutput = ( BYTE * ) av_realloc ( m_pBufferOutput , m_iBufferOutputUsed + outputSize + FF_INPUT_BUFFER_PADDING_SIZE ) ; <nl> + m_iBufferOutputAlloced = m_iBufferOutputUsed + outputSize ; <nl> } <nl> * dst = m_pBufferOutput ; <nl> <nl> int COMXAudioCodecOMX : : GetData ( BYTE * * dst ) <nl> <nl> / * use unaligned flag to keep output packed * / <nl> uint8_t * out_planes [ m_pCodecContext - > channels ] ; <nl> - if ( av_samples_fill_arrays ( out_planes , NULL , m_pBufferOutput , m_pCodecContext - > channels , m_pFrame1 - > nb_samples , m_desiredSampleFormat , 1 ) < 0 | | <nl> + if ( av_samples_fill_arrays ( out_planes , NULL , m_pBufferOutput + m_iBufferOutputUsed , m_pCodecContext - > channels , m_pFrame1 - > nb_samples , m_desiredSampleFormat , 1 ) < 0 | | <nl> swr_convert ( m_pConvert , out_planes , m_pFrame1 - > nb_samples , ( const uint8_t * * ) m_pFrame1 - > data , m_pFrame1 - > nb_samples ) < 0 ) <nl> { <nl> CLog : : Log ( LOGERROR , " COMXAudioCodecOMX : : Decode - Unable to convert format % d to % d " , ( int ) m_pCodecContext - > sample_fmt , m_desiredSampleFormat ) ; <nl> int COMXAudioCodecOMX : : GetData ( BYTE * * dst ) <nl> } <nl> else <nl> { <nl> - / * if it is already contiguous , just return decoded frame * / <nl> - if ( cont ) <nl> - { <nl> - * dst = m_pFrame1 - > data [ 0 ] ; <nl> - } <nl> - else <nl> + / * copy to a contiguous buffer * / <nl> + uint8_t * out_planes [ m_pCodecContext - > channels ] ; <nl> + if ( av_samples_fill_arrays ( out_planes , NULL , m_pBufferOutput + m_iBufferOutputUsed , m_pCodecContext - > channels , m_pFrame1 - > nb_samples , m_desiredSampleFormat , 1 ) < 0 | | <nl> + av_samples_copy ( out_planes , m_pFrame1 - > data , 0 , 0 , m_pFrame1 - > nb_samples , m_pCodecContext - > channels , m_desiredSampleFormat ) < 0 ) <nl> { <nl> - / * copy to a contiguous buffer * / <nl> - uint8_t * out_planes [ m_pCodecContext - > channels ] ; <nl> - if ( av_samples_fill_arrays ( out_planes , NULL , m_pBufferOutput , m_pCodecContext - > channels , m_pFrame1 - > nb_samples , m_desiredSampleFormat , 1 ) < 0 | | <nl> - av_samples_copy ( out_planes , m_pFrame1 - > data , 0 , 0 , m_pFrame1 - > nb_samples , m_pCodecContext - > channels , m_desiredSampleFormat ) < 0 ) <nl> - { <nl> - outputSize = 0 ; <nl> - } <nl> + outputSize = 0 ; <nl> } <nl> } <nl> + int desired_size = AUDIO_DECODE_OUTPUT_BUFFER * ( m_pCodecContext - > channels * GetBitsPerSample ( ) ) > > ( rounded_up_channels_shift [ m_pCodecContext - > channels ] + 4 ) ; <nl> <nl> if ( m_bFirstFrame ) <nl> { <nl> - CLog : : Log ( LOGDEBUG , " COMXAudioCodecOMX : : GetData size = % d / % d line = % d / % d cont = % d buf = % p " , inputSize , outputSize , inLineSize , outLineSize , cont , * dst ) ; <nl> + CLog : : Log ( LOGDEBUG , " COMXAudioCodecOMX : : GetData size = % d / % d line = % d / % d buf = % p , desired = % d " , inputSize , outputSize , inLineSize , outLineSize , * dst , desired_size ) ; <nl> m_bFirstFrame = false ; <nl> } <nl> - return outputSize ; <nl> + m_iBufferOutputUsed + = outputSize ; <nl> + <nl> + if ( ! m_bNoConcatenate & & m_pCodecContext - > sample_fmt = = AV_SAMPLE_FMT_FLTP & & m_frameSize & & ( int ) m_frameSize ! = outputSize ) <nl> + CLog : : Log ( LOGERROR , " COMXAudioCodecOMX : : GetData Unexpected change of size ( % d - > % d ) " , m_frameSize , outputSize ) ; <nl> + m_frameSize = outputSize ; <nl> + <nl> + / / if next buffer submitted won ' t fit then flush it out <nl> + if ( m_iBufferOutputUsed + outputSize > desired_size | | m_bNoConcatenate ) <nl> + { <nl> + int ret = m_iBufferOutputUsed ; <nl> + m_bGotFrame = false ; <nl> + m_iBufferOutputUsed = 0 ; <nl> + dts = m_dts ; <nl> + pts = m_pts ; <nl> + return ret ; <nl> + } <nl> + return 0 ; <nl> } <nl> <nl> void COMXAudioCodecOMX : : Reset ( ) <nl> { <nl> if ( m_pCodecContext ) avcodec_flush_buffers ( m_pCodecContext ) ; <nl> m_bGotFrame = false ; <nl> + m_iBufferOutputUsed = 0 ; <nl> } <nl> <nl> int COMXAudioCodecOMX : : GetChannels ( ) <nl> mmm a / xbmc / cores / omxplayer / OMXAudioCodecOMX . h <nl> ppp b / xbmc / cores / omxplayer / OMXAudioCodecOMX . h <nl> class COMXAudioCodecOMX <nl> virtual ~ COMXAudioCodecOMX ( ) ; <nl> bool Open ( CDVDStreamInfo & hints ) ; <nl> void Dispose ( ) ; <nl> - int Decode ( BYTE * pData , int iSize ) ; <nl> - int GetData ( BYTE * * dst ) ; <nl> + int Decode ( BYTE * pData , int iSize , double dts , double pts ) ; <nl> + int GetData ( BYTE * * dst , double & dts , double & pts ) ; <nl> void Reset ( ) ; <nl> int GetChannels ( ) ; <nl> uint64_t GetChannelMap ( ) ; <nl> class COMXAudioCodecOMX <nl> int GetBitsPerSample ( ) ; <nl> static const char * GetName ( ) { return " FFmpeg " ; } <nl> int GetBitRate ( ) ; <nl> + unsigned int GetFrameSize ( ) { return m_frameSize ; } <nl> <nl> protected : <nl> AVCodecContext * m_pCodecContext ; <nl> class COMXAudioCodecOMX <nl> AVFrame * m_pFrame1 ; <nl> <nl> BYTE * m_pBufferOutput ; <nl> + int m_iBufferOutputUsed ; <nl> int m_iBufferOutputAlloced ; <nl> <nl> bool m_bOpenedCodec ; <nl> class COMXAudioCodecOMX <nl> <nl> bool m_bFirstFrame ; <nl> bool m_bGotFrame ; <nl> + bool m_bNoConcatenate ; <nl> + unsigned int m_frameSize ; <nl> + double m_dts , m_pts ; <nl> } ; <nl> mmm a / xbmc / cores / omxplayer / OMXPlayerAudio . cpp <nl> ppp b / xbmc / cores / omxplayer / OMXPlayerAudio . cpp <nl> bool OMXPlayerAudio : : Decode ( DemuxPacket * pkt , bool bDropPacket ) <nl> <nl> if ( ! OMX_IS_RAW ( m_format . m_dataFormat ) & & ! bDropPacket ) <nl> { <nl> + double dts = pkt - > dts , pts = pkt - > pts ; <nl> while ( ! m_bStop & & data_len > 0 ) <nl> { <nl> - int len = m_pAudioCodec - > Decode ( ( BYTE * ) data_dec , data_len ) ; <nl> + int len = m_pAudioCodec - > Decode ( ( BYTE * ) data_dec , data_len , dts , pts ) ; <nl> if ( ( len < 0 ) | | ( len > data_len ) ) <nl> { <nl> m_pAudioCodec - > Reset ( ) ; <nl> bool OMXPlayerAudio : : Decode ( DemuxPacket * pkt , bool bDropPacket ) <nl> data_len - = len ; <nl> <nl> uint8_t * decoded ; <nl> - int decoded_size = m_pAudioCodec - > GetData ( & decoded ) ; <nl> + int decoded_size = m_pAudioCodec - > GetData ( & decoded , dts , pts ) ; <nl> <nl> if ( decoded_size < = 0 ) <nl> continue ; <nl> bool OMXPlayerAudio : : Decode ( DemuxPacket * pkt , bool bDropPacket ) <nl> if ( m_silence ) <nl> memset ( decoded , 0x0 , decoded_size ) ; <nl> <nl> - ret = m_omxAudio . AddPackets ( decoded , decoded_size , m_audioClock , m_audioClock ) ; <nl> + ret = m_omxAudio . AddPackets ( decoded , decoded_size , dts , pts , m_pAudioCodec - > GetFrameSize ( ) ) ; <nl> <nl> if ( ret ! = decoded_size ) <nl> { <nl> bool OMXPlayerAudio : : Decode ( DemuxPacket * pkt , bool bDropPacket ) <nl> if ( m_silence ) <nl> memset ( pkt - > pData , 0x0 , pkt - > iSize ) ; <nl> <nl> - m_omxAudio . AddPackets ( pkt - > pData , pkt - > iSize , m_audioClock , m_audioClock ) ; <nl> + m_omxAudio . AddPackets ( pkt - > pData , pkt - > iSize , m_audioClock , m_audioClock , 0 ) ; <nl> } <nl> <nl> m_audioStats . AddSampleBytes ( pkt - > iSize ) ; <nl> | [ omxplayer ] Allow small audio packets to be concatenated to make better use of audio fifo | xbmc/xbmc | f504be6984a5ea6383a7261a8164b05c490cde65 | 2014-05-24T12:04:34Z |
mmm a / lib / AST / ASTDumper . cpp <nl> ppp b / lib / AST / ASTDumper . cpp <nl> class PrintExpr : public ExprVisitor < PrintExpr > { <nl> printCommon ( E , " keypath_expr " ) ; <nl> if ( E - > isObjC ( ) ) <nl> OS < < " objc " ; <nl> + <nl> + OS < < ' \ n ' ; <nl> + Indent + = 2 ; <nl> + OS . indent ( Indent ) ; <nl> + PrintWithColorRAII ( OS , ParenthesisColor ) < < ' ( ' ; <nl> + PrintWithColorRAII ( OS , ExprColor ) < < " components " ; <nl> + OS . indent ( Indent + 2 ) ; <nl> for ( unsigned i : indices ( E - > getComponents ( ) ) ) { <nl> auto & component = E - > getComponents ( ) [ i ] ; <nl> OS < < ' \ n ' ; <nl> OS . indent ( Indent + 2 ) ; <nl> - OS < < " ( component = " ; <nl> + PrintWithColorRAII ( OS , ParenthesisColor ) < < ' ( ' ; <nl> switch ( component . getKind ( ) ) { <nl> case KeyPathExpr : : Component : : Kind : : Invalid : <nl> - OS < < " invalid " ; <nl> + PrintWithColorRAII ( OS , ASTNodeColor ) < < " invalid " ; <nl> break ; <nl> <nl> case KeyPathExpr : : Component : : Kind : : OptionalChain : <nl> - OS < < " optional_chain " ; <nl> + PrintWithColorRAII ( OS , ASTNodeColor ) < < " optional_chain " ; <nl> break ; <nl> <nl> case KeyPathExpr : : Component : : Kind : : OptionalForce : <nl> - OS < < " optional_force " ; <nl> + PrintWithColorRAII ( OS , ASTNodeColor ) < < " optional_force " ; <nl> break ; <nl> <nl> case KeyPathExpr : : Component : : Kind : : OptionalWrap : <nl> - OS < < " optional_wrap " ; <nl> + PrintWithColorRAII ( OS , ASTNodeColor ) < < " optional_wrap " ; <nl> break ; <nl> <nl> case KeyPathExpr : : Component : : Kind : : Property : <nl> - OS < < " property " ; <nl> + PrintWithColorRAII ( OS , ASTNodeColor ) < < " property " ; <nl> + PrintWithColorRAII ( OS , DeclColor ) < < " decl = " ; <nl> printDeclRef ( component . getDeclRef ( ) ) ; <nl> - OS < < " " ; <nl> break ; <nl> <nl> case KeyPathExpr : : Component : : Kind : : Subscript : <nl> - OS < < " subscript " ; <nl> + PrintWithColorRAII ( OS , ASTNodeColor ) < < " subscript " ; <nl> + PrintWithColorRAII ( OS , DeclColor ) < < " decl = ' " ; <nl> printDeclRef ( component . getDeclRef ( ) ) ; <nl> - OS < < ' \ n ' ; <nl> - Indent + = 2 ; <nl> - printRec ( component . getIndexExpr ( ) ) ; <nl> - Indent - = 2 ; <nl> - OS . indent ( Indent + 4 ) ; <nl> + PrintWithColorRAII ( OS , DeclColor ) < < " ' " ; <nl> break ; <nl> <nl> case KeyPathExpr : : Component : : Kind : : UnresolvedProperty : <nl> - OS < < " unresolved_property " ; <nl> - component . getUnresolvedDeclName ( ) . print ( OS ) ; <nl> - OS < < " " ; <nl> + PrintWithColorRAII ( OS , ASTNodeColor ) < < " unresolved_property " ; <nl> + PrintWithColorRAII ( OS , IdentifierColor ) <nl> + < < " decl_name = ' " < < component . getUnresolvedDeclName ( ) < < " ' " ; <nl> break ; <nl> <nl> case KeyPathExpr : : Component : : Kind : : UnresolvedSubscript : <nl> - OS < < " unresolved_subscript " ; <nl> - OS < < ' \ n ' ; <nl> - Indent + = 2 ; <nl> - printRec ( component . getIndexExpr ( ) ) ; <nl> - Indent - = 2 ; <nl> - OS . indent ( Indent + 4 ) ; <nl> + PrintWithColorRAII ( OS , ASTNodeColor ) < < " unresolved_subscript " ; <nl> + printArgumentLabels ( component . getSubscriptLabels ( ) ) ; <nl> break ; <nl> case KeyPathExpr : : Component : : Kind : : Identity : <nl> - OS < < " identity " ; <nl> - OS < < ' \ n ' ; <nl> + PrintWithColorRAII ( OS , ASTNodeColor ) < < " identity " ; <nl> break ; <nl> + <nl> case KeyPathExpr : : Component : : Kind : : TupleElement : <nl> - OS < < " tuple_element " ; <nl> - OS < < " # " < < component . getTupleIndex ( ) ; <nl> - OS < < " " ; <nl> + PrintWithColorRAII ( OS , ASTNodeColor ) < < " tuple_element " ; <nl> + PrintWithColorRAII ( OS , DiscriminatorColor ) <nl> + < < " # " < < component . getTupleIndex ( ) ; <nl> break ; <nl> } <nl> - OS < < " type = " ; <nl> - GetTypeOfKeyPathComponent ( E , i ) . print ( OS ) ; <nl> + PrintWithColorRAII ( OS , TypeColor ) <nl> + < < " type = ' " < < GetTypeOfKeyPathComponent ( E , i ) < < " ' " ; <nl> + if ( auto indexExpr = component . getIndexExpr ( ) ) { <nl> + OS < < ' \ n ' ; <nl> + Indent + = 2 ; <nl> + printRec ( indexExpr ) ; <nl> + Indent - = 2 ; <nl> + } <nl> PrintWithColorRAII ( OS , ParenthesisColor ) < < ' ) ' ; <nl> } <nl> + <nl> + PrintWithColorRAII ( OS , ParenthesisColor ) < < ' ) ' ; <nl> + Indent - = 2 ; <nl> + <nl> if ( auto stringLiteral = E - > getObjCStringLiteralExpr ( ) ) { <nl> OS < < ' \ n ' ; <nl> - printRec ( stringLiteral ) ; <nl> + printRecLabeled ( stringLiteral , " objc_string_literal " ) ; <nl> } <nl> if ( ! E - > isObjC ( ) ) { <nl> - OS < < " \ n " ; <nl> if ( auto root = E - > getParsedRoot ( ) ) { <nl> - printRec ( root ) ; <nl> - } else { <nl> - OS . indent ( Indent + 2 ) < < " < < null > > " ; <nl> + OS < < " \ n " ; <nl> + printRecLabeled ( root , " parsed_root " ) ; <nl> } <nl> - OS < < " \ n " ; <nl> if ( auto path = E - > getParsedPath ( ) ) { <nl> - printRec ( path ) ; <nl> - } else { <nl> - OS . indent ( Indent + 2 ) < < " < < null > > " ; <nl> + OS < < " \ n " ; <nl> + printRecLabeled ( path , " parsed_path " ) ; <nl> } <nl> } <nl> PrintWithColorRAII ( OS , ParenthesisColor ) < < ' ) ' ; <nl> | Reformat and colorize KeyPathExpr AST dumps | apple/swift | 713a2ab747db51513700fe79a88354eccc81ae4a | 2019-04-17T21:34:45Z |
mmm a / Source / Common / Include / MPIWrapper . h <nl> ppp b / Source / Common / Include / MPIWrapper . h <nl> class MPIWrapper : public std : : enable_shared_from_this < MPIWrapper > <nl> <nl> static void DeleteInstance ( ) <nl> { <nl> + s_initialized = false ; <nl> s_mpi = nullptr ; <nl> } <nl> <nl> | Fix MPI reentrance crash | microsoft/CNTK | ba39d9fe3c99c6283c7effe89236fe2e93eeddf2 | 2016-10-26T20:48:46Z |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.