diff options
Diffstat (limited to 'chromium/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc')
-rw-r--r-- | chromium/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/chromium/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc b/chromium/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc index b8dcbd34eca..ddd89ee4c2e 100644 --- a/chromium/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc +++ b/chromium/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc @@ -61,7 +61,6 @@ #include "third_party/blink/renderer/core/page/page.h" #include "third_party/blink/renderer/core/probe/core_probes.h" #include "third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h" -#include "third_party/blink/renderer/core/workers/worker_global_scope.h" #include "third_party/blink/renderer/modules/websockets/inspector_websocket_events.h" #include "third_party/blink/renderer/modules/websockets/websocket_channel_client.h" #include "third_party/blink/renderer/platform/heap/heap.h" @@ -74,6 +73,7 @@ #include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" #include "third_party/blink/renderer/platform/wtf/text/ascii_ctype.h" +#include "third_party/blink/renderer/platform/wtf/text/string_builder.h" #include "third_party/blink/renderer/platform/wtf/text/string_impl.h" #include "v8/include/v8.h" @@ -262,10 +262,7 @@ WebSocketChannelImpl::WebSocketChannelImpl( mojo::SimpleWatcher::ArmingPolicy::MANUAL, execution_context->GetTaskRunner(TaskType::kNetworking)), file_reading_task_runner_( - execution_context->GetTaskRunner(TaskType::kFileReading)) { - if (auto* scope = DynamicTo<WorkerGlobalScope>(*execution_context_)) - scope->EnsureFetcher(); -} + execution_context->GetTaskRunner(TaskType::kFileReading)) {} WebSocketChannelImpl::~WebSocketChannelImpl() = default; @@ -327,7 +324,7 @@ bool WebSocketChannelImpl::Connect(const KURL& url, const String& protocol) { message.Append(url.GetString()); message.Append("' failed: Insufficient resources"); execution_context_->AddConsoleMessage(MakeGarbageCollected<ConsoleMessage>( - mojom::blink::ConsoleMessageSource::kJavaScript, + mojom::blink::ConsoleMessageSource::kNetwork, mojom::blink::ConsoleMessageLevel::kError, message.ToString())); execution_context_->GetTaskRunner(TaskType::kNetworking) ->PostTask(FROM_HERE, @@ -341,11 +338,16 @@ bool WebSocketChannelImpl::Connect(const KURL& url, const String& protocol) { connector.BindNewPipeAndPassReceiver( execution_context_->GetTaskRunner(TaskType::kWebSocket))); + absl::optional<base::UnguessableToken> devtools_token; + probe::WillCreateWebSocket(execution_context_, identifier_, url, protocol, + &devtools_token); + connector->Connect( url, protocols, GetBaseFetchContext()->GetSiteForCookies(), execution_context_->UserAgent(), handshake_client_receiver_.BindNewPipeAndPassRemote( - execution_context_->GetTaskRunner(TaskType::kWebSocket))); + execution_context_->GetTaskRunner(TaskType::kWebSocket)), + /*throttling_profile_id=*/devtools_token); handshake_client_receiver_.set_disconnect_with_reason_handler( WTF::Bind(&WebSocketChannelImpl::OnConnectionError, WrapWeakPersistent(this), FROM_HERE)); @@ -366,7 +368,6 @@ bool WebSocketChannelImpl::Connect(const KURL& url, const String& protocol) { DEVTOOLS_TIMELINE_TRACE_EVENT_INSTANT( "WebSocketCreate", InspectorWebSocketCreateEvent::Data, execution_context_, identifier_, url, protocol); - probe::DidCreateWebSocket(execution_context_, identifier_, url, protocol); return true; } @@ -464,6 +465,8 @@ void WebSocketChannelImpl::Close(int code, const String& reason) { code == kCloseEventCodeNotSpecified ? kCloseEventCodeNoStatusRcvd : code); messages_.push_back(Message(code_to_send, reason)); ProcessSendQueue(); + // Make the page back/forward cache-able. + feature_handle_for_scheduler_.reset(); } void WebSocketChannelImpl::Fail(const String& reason, @@ -487,7 +490,7 @@ void WebSocketChannelImpl::Fail(const String& reason, } execution_context_->AddConsoleMessage(MakeGarbageCollected<ConsoleMessage>( - mojom::ConsoleMessageSource::kJavaScript, level, message, + mojom::ConsoleMessageSource::kNetwork, level, message, std::move(location))); // |reason| is only for logging and should not be provided for scripts, // hence close reason must be empty in tearDownFailedConnection. |