Skip to content

Instantly share code, notes, and snippets.

Jeremy Roman jeremyroman

Block or report user

Report or block jeremyroman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View foo.cc
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();
}
}
View mojo-iothread.diff
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
public/private API class trick
View api.cc
namespace blink {
class RealClass : public RealBase {
public:
static RealClass* Create();
void DoSomething();
private:
// members here
};
@jeremyroman
jeremyroman / idl_union.cc
Last active Apr 25, 2017
union template sketch
View idl_union.cc
// 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>
View wasm.cpp
class ValueSerializer {
class Delegate {
/*
* Delegate serializes the module content and returns an ID representing it.
* Using v8::WasmCompiledModule::GetTransferrableModule is recommended for efficiency,
* but a V8 client could do something else (like store the wire bytes, or store
* a URL to remote server that hosts wasm modules, or something else).
*/
virtual Maybe<uint32_t> GetWasmCompiledModuleId(
Isolate* isolate, Local<WasmCompiledModule> wasm_module);
@jeremyroman
jeremyroman / api-dictionary.cc
Created Mar 14, 2017
v8::DictionarySchema to make reading dictionaries fast
View api-dictionary.cc
Local<DictionarySchema> DictionarySchema::New(Isolate* v8_isolate,
Local<Value> keys[],
int keyCount) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
i::Handle<i::DictionarySchema> schema = i::DictionarySchema::New(isolate, keyCount);
for (int i = 0; i < keyCount; i++) {
Handle<Object> key = Utils::OpenHandle(keys[i]);
uint32_t array_index;
Utils::ApiCheck(key->IsName() || key->ToArrayIndex(&array_index),
@jeremyroman
jeremyroman / api_signature.cc
Created Dec 22, 2016
WDYT of templating APISignature::ParseArgumentsImpl
View api_signature.cc
namespace {
class V8ParsingBuffer {
public:
V8ParsingBuffer(std::vector<v8::Local<v8::Value>> values, v8::Isolate* isolate)
: values_(values), isolate_(isolate) {}
void AddNull() { values_.push_back(v8::Null(isolate)); }
std::nullptr_t GetParsedArgumentBuffer() { return nullptr; }
void AddParsedArgument(v8::Local<v8::Value> value) { values_->push_back(value); }
private:
View pre-commit
#!/bin/sh
if [[ "$(git symbolic-ref HEAD)" = "refs/heads/master" ]]; then
echo "Refusing to commit on master." >&2
exit 1
fi
View gist:255e8b820c7d64479af1
class TestFontSelector : public FontSelector {
public:
static PassRefPtr<TestFontSelector> create(const String& path)
{
WebUnitTestSupport* unitTestSupport = Platform::current()->unitTestSupport();
String filePath = unitTestSupport->webKitRootDir() + path;
RefPtr<SharedBuffer> fontBuffer = static_cast<PassRefPtr<SharedBuffer>>(unitTestSupport->readFromFile(filePath));
return adoptRef(new TestFontSelector(FontCustomPlatformData::create(fontBuffer.get())));
}
@jeremyroman
jeremyroman / textblob-counter.diff
Created Sep 24, 2014
text blob counting patch
View textblob-counter.diff
diff --git a/Source/core/rendering/TextPainter.cpp b/Source/core/rendering/TextPainter.cpp
index 3901813..4133ea0 100644
--- a/Source/core/rendering/TextPainter.cpp
+++ b/Source/core/rendering/TextPainter.cpp
@@ -178,6 +178,8 @@ static bool graphicsContextAllowsTextBlobs(GraphicsContext* context)
return !context->strokeGradient() && !context->strokePattern() && !context->fillGradient() && !context->fillPattern();
}
+static unsigned long g_totalBlobsPainted = 0;
+
You can’t perform that action at this time.