electron/shell/common/api/electron_bindings.h
electron-roller[bot] 04df5ce492
chore: bump chromium to 124.0.6323.0 (main) (#41412)
* chore: bump chromium in DEPS to 124.0.6315.0

* chore: update patches

* 5279678: Stream AIDA responses

https://chromium-review.googlesource.com/c/chromium/src/+/5279678

* 5276439: Remove non_network_url_loader_factory_remotes_

https://chromium-review.googlesource.com/c/chromium/src/+/5276439

* 5310165: Add DevTools API to show search results

https://chromium-review.googlesource.com/c/chromium/src/+/5310165

* chore: bump chromium in DEPS to 124.0.6317.0

* chore: update patches

* Remove Setup.Install.CumulativeDiskUsage2 and supporting code

https://chromium-review.googlesource.com/c/chromium/src/+/5314269

* browser: Make cmd line non-const in process singleton callback

https://chromium-review.googlesource.com/c/chromium/src/+/5311256

* chore: bump chromium in DEPS to 124.0.6319.0

* chore: bump chromium in DEPS to 124.0.6321.0

* chore: bump chromium in DEPS to 124.0.6323.0

* 5318335: Roll src/third_party/boringssl/src 23824fa0f..4fe29ebc7

https://chromium-review.googlesource.com/c/chromium/src/+/5318335

* 5318051: [CBE Watermarking] Hoist `watermark_view` to a member variable.

https://chromium-review.googlesource.com/c/chromium/src/+/5318051

* chore: fixup patch indices

* 4946553: Delegate HID permission to Chrome App in webview

https://chromium-review.googlesource.com/c/chromium/src/+/4946553

* 5310001: DevTools UI binding for reporting client events to AIDA

https://chromium-review.googlesource.com/c/chromium/src/+/5310001

* [libc++] Refactor the predicate taking variant of `__cxx_atomic_wait`

* chore: fix browser_view patch harder

* 5293937: Reland "[gUM] Use preferred device if more than one is eligible"

https://chromium-review.googlesource.com/c/chromium/src/+/5293937

* fix: filter {video|audio} devices by eligible device id

* 5267921: enable speak content under the pointer on PWA and WV2

https://chromium-review.googlesource.com/c/chromium/src/+/5267921

* 5310195: heap: Remove Blink's GCTaskRunner

https://chromium-review.googlesource.com/c/chromium/src/+/5310195

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-02-29 10:31:13 +01:00

86 lines
2.8 KiB
C++

// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ELECTRON_SHELL_COMMON_API_ELECTRON_BINDINGS_H_
#define ELECTRON_SHELL_COMMON_API_ELECTRON_BINDINGS_H_
#include <list>
#include <memory>
#include "base/files/file_path.h"
#include "base/memory/scoped_refptr.h"
#include "base/process/process_metrics.h"
#include "shell/common/gin_helper/promise.h"
#include "shell/common/node_bindings.h"
#include "uv.h" // NOLINT(build/include_directory)
namespace gin_helper {
class Arguments;
class Dictionary;
} // namespace gin_helper
namespace memory_instrumentation {
class GlobalMemoryDump;
}
namespace node {
class Environment;
}
namespace electron {
class ElectronBindings {
public:
explicit ElectronBindings(uv_loop_t* loop);
virtual ~ElectronBindings();
// disable copy
ElectronBindings(const ElectronBindings&) = delete;
ElectronBindings& operator=(const ElectronBindings&) = delete;
// Add process._linkedBinding function, which behaves like process.binding
// but load native code from Electron instead.
void BindTo(v8::Isolate* isolate, v8::Local<v8::Object> process);
// Should be called when a node::Environment has been destroyed.
void EnvironmentDestroyed(node::Environment* env);
static void BindProcess(v8::Isolate* isolate,
gin_helper::Dictionary* process,
base::ProcessMetrics* metrics);
static void Crash();
static void DidReceiveMemoryDump(
v8::Global<v8::Context> context,
gin_helper::Promise<gin_helper::Dictionary> promise,
base::ProcessId target_pid,
bool success,
std::unique_ptr<memory_instrumentation::GlobalMemoryDump> dump);
private:
static void Hang();
static v8::Local<v8::Value> GetHeapStatistics(v8::Isolate* isolate);
static v8::Local<v8::Value> GetCreationTime(v8::Isolate* isolate);
static v8::Local<v8::Value> GetSystemMemoryInfo(v8::Isolate* isolate,
gin_helper::Arguments* args);
static v8::Local<v8::Promise> GetProcessMemoryInfo(v8::Isolate* isolate);
static v8::Local<v8::Value> GetBlinkMemoryInfo(v8::Isolate* isolate);
static v8::Local<v8::Value> GetCPUUsage(base::ProcessMetrics* metrics,
v8::Isolate* isolate);
static bool TakeHeapSnapshot(v8::Isolate* isolate,
const base::FilePath& file_path);
void ActivateUVLoop(v8::Isolate* isolate);
static void OnCallNextTick(uv_async_t* handle);
UvHandle<uv_async_t> call_next_tick_async_;
std::list<node::Environment*> pending_next_ticks_;
std::unique_ptr<base::ProcessMetrics> metrics_;
};
} // namespace electron
#endif // ELECTRON_SHELL_COMMON_API_ELECTRON_BINDINGS_H_