1 /* 2 * Copyright (c) 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 16 #ifndef ECMASCRIPT_JOBS_HIREACE_SCOPE_H 17 #define ECMASCRIPT_JOBS_HIREACE_SCOPE_H 18 19 #include "ecmascript/jobs/micro_job_queue.h" 20 #include "ecmascript/js_handle.h" 21 22 #if defined(ENABLE_HITRACE) 23 #include "hitrace/hitraceid.h" 24 #endif 25 26 namespace panda::ecmascript::job { 27 #if defined(ENABLE_HITRACE) 28 using namespace OHOS::HiviewDFX; 29 #endif 30 class PendingJob; 31 class EnqueueJobScope { 32 public: 33 EnqueueJobScope(const JSHandle<PendingJob> &pendingJob, job::QueueType queueType); 34 35 ~EnqueueJobScope(); 36 }; 37 38 class ExecuteJobScope { 39 public: 40 explicit ExecuteJobScope(const JSHandle<PendingJob> &pendingJob); 41 42 ~ExecuteJobScope(); 43 private: 44 #if defined(ENABLE_HITRACE) 45 HiTraceId saveId_; 46 HiTraceId hitraceId_; 47 #endif 48 }; 49 } // namespace panda::ecmascript::job 50 #endif // ECMASCRIPT_JOBS_HIREACE_SCOPE_H 51