chromium/third_party/blink/renderer/modules/broadcastchannel/broadcast_channel.cc

// Copyright 2016 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/renderer/modules/broadcastchannel/broadcast_channel.h"

#include "base/metrics/histogram_functions.h"
#include "base/notreached.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/thread_safe_browser_interface_broker_proxy.h"
#include "third_party/blink/public/mojom/navigation/renderer_eviction_reason.mojom-blink.h"
#include "third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom-shared.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h"
#include "third_party/blink/renderer/core/event_target_names.h"
#include "third_party/blink/renderer/core/events/message_event.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/workers/worker_global_scope.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"

namespace blink {

namespace {

// To ensure proper ordering of messages sent to/from multiple BroadcastChannel
// instances in the same thread, this uses one BroadcastChannelProvider
// connection as basis for all connections to channels from the same thread. The
// actual connections used to send/receive messages are then created using
// associated interfaces, ensuring proper message ordering. Note that this
// approach only works in the case of workers, since each worker has it's own
// thread.
mojo::Remote<mojom::blink::BroadcastChannelProvider>&
GetWorkerThreadSpecificProvider(WorkerGlobalScope& worker_global_scope) {}

}  // namespace

// static
BroadcastChannel* BroadcastChannel::Create(ExecutionContext* execution_context,
                                           const String& name,
                                           ExceptionState& exception_state) {}

BroadcastChannel::~BroadcastChannel() = default;

void BroadcastChannel::Dispose() {}

void BroadcastChannel::postMessage(const ScriptValue& message,
                                   ExceptionState& exception_state) {}

void BroadcastChannel::PostMessageInternal(
    scoped_refptr<SerializedScriptValue> value,
    scoped_refptr<SecurityOrigin> sender_origin,
    const base::UnguessableToken sender_agent_cluster_id) {}

void BroadcastChannel::close() {}

void BroadcastChannel::CloseInternal() {}

const AtomicString& BroadcastChannel::InterfaceName() const {}

bool BroadcastChannel::HasPendingActivity() const {}

void BroadcastChannel::ContextDestroyed() {}

void BroadcastChannel::Trace(Visitor* visitor) const {}

void BroadcastChannel::OnMessage(BlinkCloneableMessage message) {}

void BroadcastChannel::OnError() {}

BroadcastChannel::BroadcastChannel(ExecutionContext* execution_context,
                                   const String& name)
    :{}

BroadcastChannel::BroadcastChannel(
    base::PassKey<StorageAccessHandle>,
    ExecutionContext* execution_context,
    const String& name,
    mojom::blink::BroadcastChannelProvider* provider)
    :{}

BroadcastChannel::BroadcastChannel(
    base::PassKey<BroadcastChannelTester>,
    ExecutionContext* execution_context,
    const String& name,
    mojo::PendingAssociatedReceiver<mojom::blink::BroadcastChannelClient>
        receiver,
    mojo::PendingAssociatedRemote<mojom::blink::BroadcastChannelClient> remote)
    :{}

BroadcastChannel::BroadcastChannel(
    ExecutionContext* execution_context,
    const String& name,
    mojo::PendingAssociatedReceiver<mojom::blink::BroadcastChannelClient>
        receiver,
    mojo::PendingAssociatedRemote<mojom::blink::BroadcastChannelClient> remote)
    :{}

void BroadcastChannel::SetupDisconnectHandlers() {}

bool BroadcastChannel::IsRemoteClientConnectedForTesting() const {}

}  // namespace blink