| Flutter Impeller |

Classes | Public Member Functions | Static Public Member Functions | List of all members
impeller::CaptureContext Class Reference

`#include <capture.h>`

## Public Member Functions
| CaptureContext ()
bool | IsActive () const
void | Rewind ()
Capture | GetDocument (const std::string &label)
bool | DoesDocumentExist (const std::string &label) const

## Static Public Member Functions
static CaptureContext | MakeInactive ()
static CaptureContext | MakeAllowlist (std::initializer_list< std::string > allowlist)

## Detailed Description

Definition at line 263 of file capture.h.

## Constructor & Destructor Documentation

## ◆ CaptureContext()

impeller::CaptureContext::CaptureContext | ( |  | ) |

CaptureContext

Definition at line 149 of file capture.cc.

149 {}

Referenced by MakeAllowlist(), and MakeInactive().

## Member Function Documentation

## ◆ DoesDocumentExist()

bool impeller::CaptureContext::DoesDocumentExist | ( | const std::string & | label | ) | const

Definition at line 209 of file capture.cc.

209 {
210 #ifdef IMPELLER_ENABLE_CAPTURE
211 if (!active_) {
212 return false;
213 }
214 return documents_.find(label) != documents_.end();
215 #else
216 return false;
217 #endif
218 }

## ◆ GetDocument()

Capture impeller::CaptureContext::GetDocument | ( | const std::string & | label | ) |

Definition at line 182 of file capture.cc.

182 {
183 #ifdef IMPELLER_ENABLE_CAPTURE
184 if (!active_) {
185 return Capture::MakeInactive();
186 }
187
188 if (allowlist_.has_value()) {
189 if (allowlist_->find(label) == allowlist_->end()) {
190 return Capture::MakeInactive();
191 }
192 }
193
194 auto found = documents_.find(label);
195 if (found != documents_.end()) {
196 // Always rewind when fetching an existing document.
197 found->second.Rewind();
198 return found->second;
199 }
200
201 auto new_document = Capture(label);
202 documents_.emplace(label, new_document);
203 return new_document;
204 #else
205 return Capture::MakeInactive();
206 #endif
207 }

References impeller::Capture::MakeInactive().

## ◆ IsActive()

bool impeller::CaptureContext::IsActive | ( |  | ) | const

Definition at line 164 of file capture.cc.

164 {
165 #ifdef IMPELLER_ENABLE_CAPTURE
166 return active_;
167 #else
168 return false;
169 #endif
170 }

## ◆ MakeAllowlist()

CaptureContext impeller::CaptureContext::MakeAllowlist | ( | std::initializer_list< std::string > | allowlist | ) |
| static

Definition at line 159 of file capture.cc.

160 {
161 return CaptureContext(allowlist);
162 }

References CaptureContext().

Referenced by impeller::AiksInspector::RenderInspector().

## ◆ MakeInactive()

CaptureContext impeller::CaptureContext::MakeInactive | ( |  | ) |
| static

Definition at line 155 of file capture.cc.

155 {
156 return CaptureContext(InactiveFlag{});
157 }

References CaptureContext().

Referenced by impeller::AiksInspector::RenderInspector().

## ◆ Rewind()

void impeller::CaptureContext::Rewind | ( |  | ) |

Definition at line 172 of file capture.cc.

172 {
173 #ifdef IMPELLER_ENABLE_CAPTURE
174 for (auto& [name, capture] : documents_) {
175 capture.GetElement()->Rewind();
176 }
177 #else
178 return;
179 #endif
180 }

The documentation for this class was generated from the following files:

- impeller/core/capture.h
- impeller/core/capture.cc

impeller::Capture::MakeInactive
static Capture MakeInactive()
Definition: capture.cc:101
impeller::CaptureContext::CaptureContext
CaptureContext()
Definition: capture.cc:149