#include "third_party/blink/renderer/modules/ai/ai_writer.h"
#include "base/functional/callback_helpers.h"
#include "base/metrics/histogram_functions.h"
#include "base/task/sequenced_task_runner.h"
#include "third_party/blink/public/mojom/ai/model_streaming_responder.mojom-blink.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_ai_writer_write_options.h"
#include "third_party/blink/renderer/core/dom/abort_signal.h"
#include "third_party/blink/renderer/core/streams/readable_stream.h"
#include "third_party/blink/renderer/modules/ai/ai_metrics.h"
#include "third_party/blink/renderer/modules/ai/exception_helpers.h"
#include "third_party/blink/renderer/modules/ai/model_execution_responder.h"
namespace blink {
namespace {
const char kExceptionMessageWriterDestroyed[] = …;
}
AIWriter::AIWriter(ExecutionContext* execution_context,
scoped_refptr<base::SequencedTaskRunner> task_runner,
mojo::PendingRemote<mojom::blink::AIWriter> pending_remote,
const String& shared_context_string)
: … { … }
void AIWriter::Trace(Visitor* visitor) const { … }
ScriptPromise<IDLString> AIWriter::write(ScriptState* script_state,
const String& input,
const AIWriterWriteOptions* options,
ExceptionState& exception_state) { … }
ReadableStream* AIWriter::writeStreaming(ScriptState* script_state,
const String& input,
const AIWriterWriteOptions* options,
ExceptionState& exception_state) { … }
void AIWriter::destroy(ScriptState* script_state,
ExceptionState& exception_state) { … }
}