chromium/third_party/blink/public/platform/web_isolated_world_info.h

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/public/platform/web_common.h"
#include "third_party/blink/public/platform/web_security_origin.h"
#include "third_party/blink/public/platform/web_string.h"
#include "v8/include/v8-forward.h"

#ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_ISOLATED_WORLD_INFO_H_
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_ISOLATED_WORLD_INFO_H_

namespace blink {

struct WebIsolatedWorldInfo {};

// The ID of the "main" execution world for a document.
static constexpr int32_t kMainDOMWorldId =;

// Sets up an isolated world by associating a |world_id| with |info|.
// worldID must be > 0 (as 0 represents the main world).
// worldID must be < kEmbedderWorldIdLimit, high number used internally.
BLINK_EXPORT void SetIsolatedWorldInfo(int32_t world_id,
                                       const WebIsolatedWorldInfo& info);

// Checks if |world_id| is equal or exceeds kEmbedderWorldIdLimit value.
BLINK_EXPORT bool IsEqualOrExceedEmbedderWorldIdLimit(int32_t world_id);

// Returns the stable ID that was set with SetIsolatedWorldInfo.
BLINK_EXPORT WebString GetIsolatedWorldStableId(v8::Local<v8::Context>);

// Returns the human readable name that was set with SetIsolatedWorldInfo.
BLINK_EXPORT WebString
    GetIsolatedWorldHumanReadableName(v8::Local<v8::Context>);

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_ISOLATED_WORLD_INFO_H_