1 /* 2 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #include "js_framework_raw.h" 16 17 #include <cstring> 18 19 namespace OHOS { 20 namespace ACELite { 21 // The following two header files should can only be included from this source file, 22 // define one macro to alert any incorrect using. 23 #define ACELITE_FRAMEWORK_RAW_BUFFER 24 // The build result from `js/framework` 25 #include "framework_min_bc.h" 26 #include "framework_min_js.h" 27 GetFrameworkRawBuffer(bool snapshotMode,size_t & bufLen)28const char *GetFrameworkRawBuffer(bool snapshotMode, size_t &bufLen) 29 { 30 if (snapshotMode) { 31 bufLen = sizeof(FRAMEWORK_BC_BUFFER); 32 return reinterpret_cast<const char *>(FRAMEWORK_BC_BUFFER); 33 } 34 bufLen = strlen(g_frameworkJSBuffer); 35 return g_frameworkJSBuffer; 36 } 37 } // namespace ACELite 38 } // namespace OHOS 39