Merge remote-tracking branch 'origin/master' into roller/chromium/master

This commit is contained in:
Jeremy Rose 2021-03-23 11:14:58 -07:00
commit 39e3576c48
68 changed files with 578 additions and 182 deletions

View file

@ -0,0 +1,26 @@
enum RecordingMode { "record-until-full", "record-continuously", "record-as-much-as-possible", "trace-to-console" };
dictionary TraceConfig {
Recordingmode recording_mode;
unsigned long trace_buffer_size_in_kb;
unsigned long trace_buffer_size_in_events;
boolean enable_argument_filter;
sequence<DOMString> included_categories;
sequence<DOMString> excluded_categories;
sequence<unsigned short> included_process_ids;
sequence<DOMString> histogram_names;
object memory_dump_config;
};
dictionary TraceCategoriesAndOptions {
DOMString categoryFilter;
DOMString traceOptions;
};
interface ContentTracing {
Promise<sequence<DOMString>> getCategories();
Promise<void> startRecording(TraceConfig config);
Promise<void> startRecording(TraceCategoriesAndOptions categoriesAndOptions);
Promise<DOMString> stopRecording(optional DOMString resultFilePath);
Promise<TraceBufferUsage> getTraceBufferUsage();
};

View file

@ -1114,6 +1114,8 @@ int32_t BaseWindow::GetID() const {
}
void BaseWindow::ResetBrowserViews() {
v8::HandleScope scope(isolate());
for (auto& item : browser_views_) {
gin::Handle<BrowserView> browser_view;
if (gin::ConvertFromV8(isolate(),

View file

@ -162,6 +162,9 @@ void DesktopCapturer::UpdateSourcesList(DesktopMediaList* list) {
v8::Locker locker(isolate);
v8::HandleScope scope(isolate);
gin_helper::CallMethod(this, "_onerror", "Failed to get sources.");
Unpin();
return;
}
@ -195,12 +198,19 @@ void DesktopCapturer::UpdateSourcesList(DesktopMediaList* list) {
v8::Locker locker(isolate);
v8::HandleScope scope(isolate);
gin_helper::CallMethod(this, "_onfinished", captured_sources_);
Unpin();
}
}
// static
gin::Handle<DesktopCapturer> DesktopCapturer::Create(v8::Isolate* isolate) {
return gin::CreateHandle(isolate, new DesktopCapturer(isolate));
auto handle = gin::CreateHandle(isolate, new DesktopCapturer(isolate));
// Keep reference alive until capturing has finished.
handle->Pin(isolate);
return handle;
}
gin::ObjectTemplateBuilder DesktopCapturer::GetObjectTemplateBuilder(

View file

@ -13,12 +13,14 @@
#include "chrome/browser/media/webrtc/native_desktop_media_list.h"
#include "gin/handle.h"
#include "gin/wrappable.h"
#include "shell/common/gin_helper/pinnable.h"
namespace electron {
namespace api {
class DesktopCapturer : public gin::Wrappable<DesktopCapturer>,
public gin_helper::Pinnable<DesktopCapturer>,
public DesktopMediaListObserver {
public:
struct Source {

View file

@ -88,7 +88,7 @@ void MenuMac::PopupOnUI(const base::WeakPtr<NativeWindow>& native_window,
}
// If no preferred item is specified, try to show all of the menu items.
if (!positioning_item) {
if (!item) {
CGFloat windowBottom = CGRectGetMinY([view window].frame);
CGFloat lowestMenuPoint = windowBottom + position.y - [menu size].height;
CGFloat screenBottom = CGRectGetMinY([view window].screen.frame);

View file

@ -10,6 +10,7 @@
#include "base/command_line.h"
#include "base/stl_util.h"
#include "content/common/url_schemes.h"
#include "content/public/browser/child_process_security_policy.h"
#include "gin/object_template_builder.h"
#include "shell/browser/browser.h"
@ -124,6 +125,13 @@ void RegisterSchemesAsPrivileged(gin_helper::ErrorThrower thrower,
}
if (custom_scheme.options.allowServiceWorkers) {
service_worker_schemes.push_back(custom_scheme.scheme);
// There is no API to add service worker scheme, but there is an API to
// return const reference to the schemes vector.
// If in future the API is changed to return a copy instead of reference,
// the compilation will fail, and we should add a patch at that time.
auto& mutable_schemes = const_cast<std::vector<std::string>&>(
content::GetServiceWorkerSchemes());
mutable_schemes.push_back(custom_scheme.scheme);
}
if (custom_scheme.options.stream) {
g_streaming_schemes.push_back(custom_scheme.scheme);

View file

@ -915,6 +915,7 @@ WebContents::~WebContents() {
return;
}
inspectable_web_contents_->GetView()->SetDelegate(nullptr);
if (guest_delegate_)
guest_delegate_->WillDestroy();
@ -1761,6 +1762,7 @@ void WebContents::DevToolsOpened() {
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
DCHECK(inspectable_web_contents_);
DCHECK(inspectable_web_contents_->GetDevToolsWebContents());
auto handle = FromOrCreate(
isolate, inspectable_web_contents_->GetDevToolsWebContents());
devtools_web_contents_.Reset(isolate, handle.ToV8());