1 /* 2 * Copyright (c) Meta Platforms, Inc. and affiliates. 3 * 4 * This source code is licensed under the MIT license found in the 5 * LICENSE file in the root directory of this source tree. 6 */ 7 8 #include "ABI49_0_0JSExecutor.h" 9 10 #include "ABI49_0_0RAMBundleRegistry.h" 11 12 #include <folly/Conv.h> 13 14 #include <chrono> 15 16 namespace ABI49_0_0facebook { 17 namespace ABI49_0_0React { 18 getSyntheticBundlePath(uint32_t bundleId,const std::string & bundlePath)19std::string JSExecutor::getSyntheticBundlePath( 20 uint32_t bundleId, 21 const std::string &bundlePath) { 22 if (bundleId == RAMBundleRegistry::MAIN_BUNDLE_ID) { 23 return bundlePath; 24 } 25 return folly::to<std::string>("seg-", bundleId, ".js"); 26 } 27 performanceNow()28double JSExecutor::performanceNow() { 29 auto time = std::chrono::steady_clock::now(); 30 auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>( 31 time.time_since_epoch()) 32 .count(); 33 34 constexpr double NANOSECONDS_IN_MILLISECOND = 1000000.0; 35 return duration / NANOSECONDS_IN_MILLISECOND; 36 } 37 38 } // namespace ABI49_0_0React 39 } // namespace ABI49_0_0facebook 40