Commit a0228514 authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

Reland "Fix about:webrtc-internals "Stats Tables""

This reland adds two extra sanity checks for when
sending WTF::String over mojo, in case they were generated
from std::string instances with String::FromUTF8().

Null WTF::String passed over mojo from renderer to
browser can cause mojo validation errors as seen on
[1] and [2]. This is bug [3]

[1] https://ci.chromium.org/p/chromium/builders/ci/Mac10.10%20Tests/48280
[2] https://ci.chromium.org/p/chromium/builders/ci/Win7%20%2832%29%20Tests/53971
[3] https://crbug.com/635987

BUG=1020525, 787254

Original change's description:
> Fix about:webrtc-internals "Stats Tables"
>
> This is a fixup CL of [1] spotted and report by hbos@chromium.org
> on [2].
>
> [1] https://crrev.com/c/1842414 (Onion soup RTCPeerConnectionHandler and its direct dependences)
> [2] https://crrev.com/c/1842414/14#message-daf2b117b98895c3692a635ac873e249e6f905c1
>
> Basically the original CL was supposed to replace the code
> that used to bound PeerConnectionTracker to its associated
> mojom::Receiver instance in [3] by the corresponding code in
> Blink.
> However, the replacement code got accidentally missing while rebasing
> the CL over and over.
>
> [3] https://crrev.com/c/1842414/14/content/renderer/render_thread_impl.cc#b777
>
> This CL amends the original CL with the proper code in
> blink/renderer/modules/modules_initializer.cc@RegisterInterfaces().
>
> TEST=<out>/browser_tests --gtest_filter=WebRtcInternalsPerfBrowserTest.MANUAL_RunsAudioVideoCall60SecsAndLogsInternalMetricsVp8 \
> --run-manual --ui-test-action-max-timeout=100000 --test-launcher-timeout=100001
>
> Manual test= Open Chromium load about:webrtc-internals and [4].
> It is expected that WebRTC statistics appear.
>
> [4] https://codepen.io/anon/pen/JQLEqR?editors=1010
>
> R=haraken@chromium.org
> TBR=guidou@chromium.org, hbos@chromium.org
>
> BUG=787254
>
> Change-Id: I88f26b8cbcc09b707f6db5c9e7ba40bdbd8e82e8
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1893293
> Reviewed-by: Kentaro Hara <haraken@chromium.org>
> Reviewed-by: Henrik Boström <hbos@chromium.org>
> Reviewed-by: Antonio Gomes <tonikitoo@igalia.com>
> Commit-Queue: Henrik Boström <hbos@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#711647}

R=armax@chromium.org, haraken@chromium.org

Bug: 787254
Change-Id: Ie8936038788c9bc05610fcf3684375712bedae2b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1895393Reviewed-by: default avatarArmando Miraglia <armax@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Cr-Commit-Position: refs/heads/master@{#711738}
parent e92ea9aa
......@@ -62,6 +62,7 @@
#include "third_party/blink/renderer/modules/media_controls/media_controls_impl.h"
#include "third_party/blink/renderer/modules/mediastream/user_media_client.h"
#include "third_party/blink/renderer/modules/mediastream/user_media_controller.h"
#include "third_party/blink/renderer/modules/peerconnection/peer_connection_tracker.h"
#include "third_party/blink/renderer/modules/picture_in_picture/picture_in_picture_controller_impl.h"
#include "third_party/blink/renderer/modules/presentation/presentation_controller.h"
#include "third_party/blink/renderer/modules/presentation/presentation_receiver.h"
......@@ -316,6 +317,11 @@ void ModulesInitializer::RegisterInterfaces(
registry.AddInterface(
ConvertToBaseCallback(CrossThreadBindRepeating(&WebDatabaseImpl::Create)),
Platform::Current()->GetIOTaskRunner());
registry.AddInterface(
ConvertToBaseCallback(CrossThreadBindRepeating(
&PeerConnectionTracker::Bind,
WTF::CrossThreadUnretained(PeerConnectionTracker::GetInstance()))),
Thread::MainThread()->GetTaskRunner());
}
} // namespace blink
......@@ -1077,8 +1077,13 @@ void PeerConnectionTracker::TrackSessionId(RTCPeerConnectionHandler* pc_handler,
if (local_id == -1) {
return;
}
peer_connection_tracker_host_->OnPeerConnectionSessionIdSet(
local_id, String::FromUTF8(session_id));
String wtf_session_id = String::FromUTF8(session_id);
if (wtf_session_id.IsNull())
wtf_session_id = String("");
peer_connection_tracker_host_->OnPeerConnectionSessionIdSet(local_id,
wtf_session_id);
}
void PeerConnectionTracker::TrackOnRenegotiationNeeded(
......@@ -1108,8 +1113,12 @@ void PeerConnectionTracker::TrackRtcEventLogWrite(
int id = GetLocalIDForHandler(pc_handler);
if (id == -1)
return;
peer_connection_tracker_host_->WebRtcEventLogWrite(id,
String::FromUTF8(output));
String wtf_output = String::FromUTF8(output);
if (wtf_output.IsNull())
wtf_output = String("");
peer_connection_tracker_host_->WebRtcEventLogWrite(id, wtf_output);
}
int PeerConnectionTracker::GetNextLocalID() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment