#include "third_party/blink/renderer/modules/ai/ai_rewriter.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_rewriter_rewrite_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.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 kExceptionMessageRewriterDestroyed[] = …;
}
AIRewriter::AIRewriter(
ExecutionContext* execution_context,
scoped_refptr<base::SequencedTaskRunner> task_runner,
mojo::PendingRemote<mojom::blink::AIRewriter> pending_remote,
const String& shared_context_string,
const V8AIRewriterTone& tone,
const V8AIRewriterLength& length)
: … { … }
void AIRewriter::Trace(Visitor* visitor) const { … }
ScriptPromise<IDLString> AIRewriter::rewrite(
ScriptState* script_state,
const String& input,
const AIRewriterRewriteOptions* options,
ExceptionState& exception_state) { … }
ReadableStream* AIRewriter::rewriteStreaming(
ScriptState* script_state,
const String& input,
const AIRewriterRewriteOptions* options,
ExceptionState& exception_state) { … }
void AIRewriter::destroy(ScriptState* script_state,
ExceptionState& exception_state) { … }
}