• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "flutter/fml/memory/weak_ptr_internal.h"
6 
7 #include "flutter/fml/logging.h"
8 
9 namespace fml {
10 namespace internal {
11 
WeakPtrFlag()12 WeakPtrFlag::WeakPtrFlag() : is_valid_(true) {}
13 
~WeakPtrFlag()14 WeakPtrFlag::~WeakPtrFlag() {
15   // Should be invalidated before destruction.
16   FML_DCHECK(!is_valid_);
17 }
18 
Invalidate()19 void WeakPtrFlag::Invalidate() {
20   // Invalidation should happen exactly once.
21   FML_DCHECK(is_valid_);
22   is_valid_ = false;
23 }
24 
25 }  // namespace internal
26 }  // namespace fml
27