Chromium Code Reviews| Index: src/sksl/ir/SkSLSymbolTable.h |
| diff --git a/src/sksl/ir/SkSLSymbolTable.h b/src/sksl/ir/SkSLSymbolTable.h |
| index 151475d6423690d3024d322c2c3968f0a21a9066..d732023ff091e01344f170221a64b0cc1cf91213 100644 |
| --- a/src/sksl/ir/SkSLSymbolTable.h |
| +++ b/src/sksl/ir/SkSLSymbolTable.h |
| @@ -10,12 +10,14 @@ |
| #include <memory> |
| #include <unordered_map> |
| +#include <vector> |
| #include "SkSLErrorReporter.h" |
| #include "SkSLSymbol.h" |
| -#include "SkSLUnresolvedFunction.h" |
| namespace SkSL { |
| +struct FunctionDeclaration; |
| + |
| /** |
| * Maps identifiers to symbols. Functions, in particular, are mapped to either FunctionDeclaration |
| * or UnresolvedFunction depending on whether they are overloaded or not. |
| @@ -29,17 +31,22 @@ public: |
| : fParent(parent) |
| , fErrorReporter(errorReporter) {} |
| - std::shared_ptr<Symbol> operator[](const std::string& name); |
| + const Symbol* operator[](const std::string& name); |
| + |
| + void add(const std::string& name, std::unique_ptr<Symbol> symbol); |
| - void add(const std::string& name, std::shared_ptr<Symbol> symbol); |
| + void addWithoutOwnership(const std::string& name, const Symbol* symbol); |
| + |
| + Symbol* takeOwnership(Symbol* s); |
|
dogben
2016/07/11 20:05:33
nit: Sorry, I had meant to put the same comment he
|
| const std::shared_ptr<SymbolTable> fParent; |
| private: |
| - static std::vector<std::shared_ptr<FunctionDeclaration>> GetFunctions( |
| - const std::shared_ptr<Symbol>& s); |
| + static std::vector<const FunctionDeclaration*> GetFunctions(const Symbol& s); |
| + |
| + std::vector<std::unique_ptr<Symbol>> fOwnedPointers; |
| - std::unordered_map<std::string, std::shared_ptr<Symbol>> fSymbols; |
| + std::unordered_map<std::string, const Symbol*> fSymbols; |
| ErrorReporter& fErrorReporter; |
| }; |