• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "src/trace_processor/prelude/table_functions/view.h"
18 
19 namespace perfetto {
20 namespace trace_processor {
21 
ViewTableFunction(const View * view,const char * name)22 ViewTableFunction::ViewTableFunction(const View* view, const char* name)
23     : view_(view), name_(name) {}
24 
25 ViewTableFunction::~ViewTableFunction() = default;
26 
ValidateConstraints(const QueryConstraints &)27 base::Status ViewTableFunction::ValidateConstraints(const QueryConstraints&) {
28   return base::OkStatus();
29 }
30 
ComputeTable(const std::vector<Constraint> & cs,const std::vector<Order> & ob,const BitVector & cols_used,std::unique_ptr<Table> & table)31 base::Status ViewTableFunction::ComputeTable(const std::vector<Constraint>& cs,
32                                              const std::vector<Order>& ob,
33                                              const BitVector& cols_used,
34                                              std::unique_ptr<Table>& table) {
35   table.reset(new Table(view_->Query(cs, ob, cols_used)));
36   return base::OkStatus();
37 }
38 
CreateSchema()39 Table::Schema ViewTableFunction::CreateSchema() {
40   return view_->schema();
41 }
42 
TableName()43 std::string ViewTableFunction::TableName() {
44   return name_;
45 }
46 
EstimateRowCount()47 uint32_t ViewTableFunction::EstimateRowCount() {
48   return view_->EstimateRowCount();
49 }
50 
51 }  // namespace trace_processor
52 }  // namespace perfetto
53