Skip to content

Instantly share code, notes, and snippets.

View jeremyroman's full-sized avatar

Jeremy Roman jeremyroman

View GitHub Profile
@jeremyroman
jeremyroman / explainer.md
Last active June 13, 2023 15:50
PerformanceResourceTiming deliveryType explainer

PerformanceResourceTiming deliveryType explainer

This is based on w3c/resource-timing#332. See also w3c/resource-timing#343, w3c/navigation-timing#163, WICG/nav-speculation#180.

Resources on the web are usually fetched via HTTP (from the origin server), but in some cases they are known to be delivered from a cache or other buffer, in a way that affects loading performance. Insight into this is useful for authors understanding when these caches accelerate resource loading.

The deliveryType attribute on PerformanceResourceTiming addresses this, with the following values:

""
@jeremyroman
jeremyroman / README.txt
Created May 4, 2021 01:47
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.1+commit.df193b15.js&optimize=false&runs=200&gist=
REMIX EXAMPLE PROJECT
Remix example project is present when Remix loads very first time or there are no files existing in the File Explorer.
It contains 3 directories:
1. 'contracts': Holds three contracts with different complexity level, denoted with number prefix in file name.
2. 'scripts': Holds two scripts to deploy a contract. It is explained below.
3. 'tests': Contains one test file for 'Ballot' contract with unit tests in Solidity.
SCRIPTS
@jeremyroman
jeremyroman / bikeshedproxy.js
Last active January 21, 2021 20:53
server to proxy requests to CSSWG bikeshed
#!/usr/bin/env node
const crypto = require('crypto');
const http = require('http');
const https = require('https');
const fs = require('fs');
http.createServer((req, res) => {
if (req.url !== '/') {
res.writeHead(404);
res.end();
class AssociatedFrobnicator : public base::SupportsUserData::Data {
public:
Frobnicator* frobnicator() const { return frobnicator_; }
void set_frobnicator(Frobnicator* frobnicator) const { frobnicator_ = frobnicator; }
private:
Frobnicator* frobnicator_;
};
base::SupportsUserData::Data* data;
static_cast<AssociatedFrobnicator*>(data)->set_frobnicator(new_frobnicator);
diff --git a/third_party/blink/renderer/modules/modules_initializer.cc b/third_party/blink/renderer/modules/modules_initializer.cc
index 4eaa4575ca63..50e56db64b5b 100644
--- a/third_party/blink/renderer/modules/modules_initializer.cc
+++ b/third_party/blink/renderer/modules/modules_initializer.cc
@@ -170,6 +170,8 @@ void ModulesInitializer::InitLocalFrame(LocalFrame& frame) const {
&AppBannerController::BindMojoRequest, WrapWeakPersistent(&frame)));
frame.GetInterfaceRegistry()->AddInterface(WTF::BindRepeating(
&TextSuggestionBackendImpl::Create, WrapWeakPersistent(&frame)));
+ frame.GetInterfaceRegistry()->AddInterface(WTF::BindRepeating(
+ &RemoteObjectGatewayImpl::BindMojoReceiver, WrapWeakPersistent(&frame)));
#0 0x00007ffff79f2e10 in IPC::(anonymous namespace)::ChannelAssociatedGroupController::DetachEndpointClient(mojo::ScopedInterfaceEndpointHandle const&) (this=0x3c9213fe3aa0, handle=...) at ../../ipc/ipc_mojo_bootstrap.cc:362
#1 0x00007ffff791adf7 in mojo::InterfaceEndpointClient::~InterfaceEndpointClient() (this=0x3c921528b2e0) at ../../mojo/public/cpp/bindings/lib/interface_endpoint_client.cc:178
#2 0x00007ffff791afac in mojo::InterfaceEndpointClient::~InterfaceEndpointClient() (this=0x3c921528b2e0) at ../../mojo/public/cpp/bindings/lib/interface_endpoint_client.cc:175
#3 0x00007ffff78f949f in std::__Cr::default_delete<mojo::InterfaceEndpointClient>::operator()(mojo::InterfaceEndpointClient*) const (this=0x3c92146c28c0, __ptr=0x3c921528b2e0) at ../../buildtools/third_party/libc++/trunk/include/memory:2338
#4 0x00007ffff78f8b9d in std::__Cr::unique_ptr<mojo::InterfaceEndpointClient, std::__Cr::default_delete<mojo::InterfaceEndpointClient> >::reset(mojo::InterfaceEndpointClient*) (this=0x3c92146c28c0, __p
@jeremyroman
jeremyroman / foo.cc
Last active December 11, 2018 18:51
PlatformPaintWorkletInput(
Vector<std::pair<CSSPropertyID, String>> native_values)
: native_values_(std::move(native_values)) {
for (auto& pair : native_values_) {
String& s = pair.second;
if (!s.IsSafeToSendToAnotherThread())
s = s.IsolatedCopy();
}
}
diff --git a/content/browser/web_package/web_package_context_impl.cc b/content/browser/web_package/web_package_context_impl.cc
index ea3956d77739..86367c49ad54 100644
--- a/content/browser/web_package/web_package_context_impl.cc
+++ b/content/browser/web_package/web_package_context_impl.cc
@@ -4,40 +4,19 @@
#include "content/browser/web_package/web_package_context_impl.h"
-#include "base/bind.h"
-#include "base/single_thread_task_runner.h"
@jeremyroman
jeremyroman / api.cc
Created May 2, 2017 01:14
public/private API class trick
namespace blink {
class RealClass : public RealBase {
public:
static RealClass* Create();
void DoSomething();
private:
// members here
};
@jeremyroman
jeremyroman / idl_union.cc
Last active April 25, 2017 01:01
union template sketch
// template definition
template <int index, typename... UnionMemberTraits>
class IDLUnionImpl {
public:
bool IsNull() const { return type_ == 0; }
protected:
int type_ = 0;
};
template <int index, typename UnionMemberTraits, typename... Rest>