feat(webframe): export set cache capacity interface
This commit is contained in:
parent
b9c0bab8f1
commit
d172e29270
2 changed files with 11 additions and 0 deletions
|
@ -368,6 +368,15 @@ void WebFrame::ClearCache(v8::Isolate* isolate) {
|
||||||
base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL);
|
base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WebFrame::SetCacheCapacity(v8::Isolate* isolate, int capacity) {
|
||||||
|
if (capacity > 0) {
|
||||||
|
blink::WebCache::SetCapacity(capacity);
|
||||||
|
} else {
|
||||||
|
isolate->ThrowException(v8::Exception::TypeError(
|
||||||
|
mate::StringToV8(isolate, "Invalid cache capacity")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void WebFrame::BuildPrototype(
|
void WebFrame::BuildPrototype(
|
||||||
v8::Isolate* isolate, v8::Local<v8::FunctionTemplate> prototype) {
|
v8::Isolate* isolate, v8::Local<v8::FunctionTemplate> prototype) {
|
||||||
|
@ -408,6 +417,7 @@ void WebFrame::BuildPrototype(
|
||||||
&WebFrame::SetIsolatedWorldHumanReadableName)
|
&WebFrame::SetIsolatedWorldHumanReadableName)
|
||||||
.SetMethod("getResourceUsage", &WebFrame::GetResourceUsage)
|
.SetMethod("getResourceUsage", &WebFrame::GetResourceUsage)
|
||||||
.SetMethod("clearCache", &WebFrame::ClearCache)
|
.SetMethod("clearCache", &WebFrame::ClearCache)
|
||||||
|
.SetMethod("setCacheCapacity", &WebFrame::SetCacheCapacity)
|
||||||
// TODO(kevinsawicki): Remove in 2.0, deprecate before then with warnings
|
// TODO(kevinsawicki): Remove in 2.0, deprecate before then with warnings
|
||||||
.SetMethod("setZoomLevelLimits", &WebFrame::SetVisualZoomLevelLimits);
|
.SetMethod("setZoomLevelLimits", &WebFrame::SetVisualZoomLevelLimits);
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,7 @@ class WebFrame : public mate::Wrappable<WebFrame> {
|
||||||
// Resource related methods
|
// Resource related methods
|
||||||
blink::WebCache::ResourceTypeStats GetResourceUsage(v8::Isolate* isolate);
|
blink::WebCache::ResourceTypeStats GetResourceUsage(v8::Isolate* isolate);
|
||||||
void ClearCache(v8::Isolate* isolate);
|
void ClearCache(v8::Isolate* isolate);
|
||||||
|
void SetCacheCapacity(v8::Isolate* isolate, int capacity);
|
||||||
|
|
||||||
std::unique_ptr<SpellCheckClient> spell_check_client_;
|
std::unique_ptr<SpellCheckClient> spell_check_client_;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue