| // Copyright 2018 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| module previews.mojom; |
| |
| import "mojo/public/mojom/base/time.mojom"; |
| import "third_party/blink/public/mojom/optimization_guide/optimization_guide.mojom"; |
| |
| // Resource loading hints passed by the browser to renderers. Send at most once |
| // per page load from browser to renderer as part of a preview treatment. The |
| // hints are provided to the renderer and aid in optimizing the loading of |
| // resources. |
| struct PreviewsResourceLoadingHints { |
| // SourceId to use when recording UKM for the resource loading hints. This |
| // is based on the browser NavigationHandle's navigation id. |
| int64 ukm_source_id; |
| // List of subresources to block. The list contains the URL patterns of |
| // subresources to block. |
| // TODO(tbansal): https://crbug.com/856243. Update the mojom message below |
| // to match the updated resource loading hints proto. |
| array<string> subresources_to_block; |
| }; |
| |
| // LiteVideo hints passed by the browser to renderers. Send at most once |
| // per render frame from browser to renderer. The hints are provided to the |
| // renderer and aid in optimizing media data use. |
| struct LiteVideoHint { |
| // The number of kilobytes for media to be observed before starting to |
| // throttle requests. |
| int64 kilobytes_to_buffer_before_throttle; |
| // The network downlink bandwidth target in kilobytes per second used to |
| // calculate the throttling delay on media requests. |
| int64 target_downlink_bandwidth_kbps; |
| // The network downlink rtt target in milliseconds used to calculate the |
| // throttling delay on media requests. |
| mojo_base.mojom.TimeDelta target_downlink_rtt_latency; |
| // The maximum delay a throttle can introduce for a media request. |
| mojo_base.mojom.TimeDelta max_throttling_delay; |
| }; |
| |
| // Render process implemented interface that receives hints from the browser |
| // about how to load resources. |
| interface PreviewsResourceLoadingHintsReceiver { |
| // Sends the resource loading hints from the browser to renderers. |
| SetResourceLoadingHints(PreviewsResourceLoadingHints previews_resource_loading_hints); |
| |
| // Sends the hints for reducing the data-costs of streaming |
| // media/videos from the browser to renderers. |
| SetLiteVideoHint(LiteVideoHint lite_video_hint); |
| |
| // Sends the hints for Blink. |
| // TODO(https://crbug.com/1113980): Move this to its own mojo plumbing. |
| SetBlinkOptimizationGuideHints(blink.mojom.BlinkOptimizationGuideHints hints); |
| |
| // Notifies the renderers that active media request throttles should be stopped |
| // and not allow any new throttles. |
| StopThrottlingMediaRequests(); |
| }; |