• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 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_TOOLING_INTERFACE_STREAM_H
17 #define ECMASCRIPT_TOOLING_INTERFACE_STREAM_H
18 
19 namespace panda::ecmascript {
20 class HeapStat {
21 public:
HeapStat(int32_t index,int32_t count,int32_t size)22     HeapStat(int32_t index, int32_t count, int32_t size)
23         : index_(index), count_(count), size_(size) {}
24 
25     int32_t index_;
26     int32_t count_;
27     int32_t size_;
28 };
29 
30 class Stream {
31 public:
32     virtual ~Stream() = default;
33 
34     virtual void EndOfStream() = 0;
35 
36     // Get chunk's size
37     virtual int GetSize() = 0;
38 
39     // Writes the chunk of data into the stream
40     virtual bool WriteChunk(char *data, int32_t size) = 0;
41     virtual bool Good() = 0;
42     virtual void UpdateHeapStats(HeapStat* data, int32_t count) = 0;
43     virtual void UpdateLastSeenObjectId(int32_t lastSeenObjectId) = 0;
44 };
45 }  // namespace panda::ecmascript
46 
47 #endif  // ECMASCRIPT_TOOLING_INTERFACE_STREAM_H
48