Flutter Engine
The Flutter Engine
constants.h
Go to the documentation of this file.
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#ifndef FLUTTER_COMMON_CONSTANTS_H_
6#define FLUTTER_COMMON_CONSTANTS_H_
7
8namespace flutter {
9constexpr double kMegaByteSizeInBytes = (1 << 20);
10
11// The ID for the implicit view if the implicit view is enabled.
12//
13// The implicit view is a compatibility mechanism to help the transition from
14// the older single-view APIs to the newer multi-view APIs. The two sets of APIs
15// use different models for view management. The implicit view mechanism allows
16// single-view APIs to operate a special view as if other views don't exist.
17//
18// In the regular multi-view model, all views should be created by
19// `Shell::AddView` before being used, and removed by `Shell::RemoveView` to
20// signify that they are gone. If a view is added or removed, the framework
21// (`PlatformDispatcher`) will be notified. New view IDs are always unique,
22// never reused. Operating a non-existing view is an error.
23//
24// The implicit view is another special view in addition to the "regular views"
25// as above. The shell starts up having the implicit view, which has a fixed
26// view ID of `kFlutterImplicitViewId` and is available throughout the lifetime
27// of the shell. `Shell::AddView` or `RemoveView` must not be called for this
28// view. Even when the window that shows the view is closed, the framework is
29// unaware and might continue rendering into or operating this view.
30//
31// The single-view APIs, which are APIs that do not specify view IDs, operate
32// the implicit view. The multi-view APIs can operate all views, including the
33// implicit view if the target ID is `kFlutterImplicitViewId`, unless specified
34// otherwise.
35constexpr int64_t kFlutterImplicitViewId = 0;
36} // namespace flutter
37
38#endif // FLUTTER_COMMON_CONSTANTS_H_
constexpr int64_t kFlutterImplicitViewId
Definition: constants.h:35
constexpr double kMegaByteSizeInBytes
Definition: constants.h:9