Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1690)

Unified Diff: Source/web/WorkerPermissionClient.cpp

Issue 50773002: Introduce WebWorkerPermissionClientProxy to deprecate WorkerAllowMainThreadBridge (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: updated comments, minor code fix Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/web/WorkerPermissionClient.h ('k') | Source/web/web.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WorkerPermissionClient.cpp
diff --git a/Source/web/WebDOMError.cpp b/Source/web/WorkerPermissionClient.cpp
similarity index 52%
copy from Source/web/WebDOMError.cpp
copy to Source/web/WorkerPermissionClient.cpp
index d92123b1f1efd83a5538e068c73562e30de30ebc..d6ff42aea64d62c39b6f72e3d2b2de9fa8bd3906 100644
--- a/Source/web/WebDOMError.cpp
+++ b/Source/web/WorkerPermissionClient.cpp
@@ -29,67 +29,65 @@
*/
#include "config.h"
-#include "WebDOMError.h"
+#include "WorkerPermissionClient.h"
-#include "V8DOMError.h"
-#include "bindings/v8/V8Binding.h"
-#include "core/dom/DOMError.h"
+#include "core/workers/WorkerGlobalScope.h"
+#include "public/platform/WebString.h"
+#include "public/web/WebWorkerPermissionClientProxy.h"
#include "wtf/PassOwnPtr.h"
using namespace WebCore;
namespace WebKit {
-WebDOMError WebDOMError::create(const WebString& name, const WebString& message)
+PassOwnPtr<WorkerPermissionClient> WorkerPermissionClient::create(PassOwnPtr<WebWorkerPermissionClientProxy> proxy)
{
- return WebDOMError(DOMError::create(name, message));
+ return adoptPtr(new WorkerPermissionClient(proxy));
}
-void WebDOMError::reset()
+WorkerPermissionClient::~WorkerPermissionClient()
{
- m_private.reset();
}
-void WebDOMError::assign(const WebDOMError& other)
+bool WorkerPermissionClient::allowDatabase(const WebString& name, const WebString& displayName, unsigned long estimatedSize)
{
- m_private = other.m_private;
+ if (!m_proxy)
+ return false;
+ return m_proxy->allowDatabase(name, displayName, estimatedSize);
}
-WebString WebDOMError::name() const
+bool WorkerPermissionClient::allowFileSystem()
{
- if (!m_private.get())
- return WebString();
- return m_private->name();
+ if (!m_proxy)
+ return false;
+ return m_proxy->allowFileSystem();
}
-WebString WebDOMError::message() const
+bool WorkerPermissionClient::allowIndexedDB(const WebString& name)
{
- if (!m_private.get())
- return WebString();
- return m_private->message();
+ if (!m_proxy)
+ return false;
+ return m_proxy->allowIndexedDB(name);
}
-v8::Handle<v8::Value> WebDOMError::toV8Value()
+const char* WorkerPermissionClient::supplementName()
{
- if (!m_private.get())
- return v8::Handle<v8::Value>();
- return toV8(m_private.get(), v8::Handle<v8::Object>(), v8::Isolate::GetCurrent());
+ return "WorkerPermissionClient";
}
-WebDOMError::WebDOMError(const WTF::PassRefPtr<WebCore::DOMError>& error)
- : m_private(error)
+WorkerPermissionClient* WorkerPermissionClient::from(ExecutionContext* context)
{
+ return static_cast<WorkerPermissionClient*>(Supplement<WorkerClients>::from(toWorkerGlobalScope(context)->clients(), supplementName()));
}
-WebDOMError& WebDOMError::operator=(const WTF::PassRefPtr<WebCore::DOMError>& error)
+WorkerPermissionClient::WorkerPermissionClient(PassOwnPtr<WebWorkerPermissionClientProxy> proxy)
+ : m_proxy(proxy)
{
- m_private = error;
- return *this;
}
-WebDOMError::operator WTF::PassRefPtr<WebCore::DOMError>() const
+void providePermissionClientToWorker(WorkerClients* clients, PassOwnPtr<WebWorkerPermissionClientProxy> proxy)
{
- return m_private.get();
+ WorkerPermissionClient::provideTo(clients, WorkerPermissionClient::supplementName(), WorkerPermissionClient::create(proxy));
}
} // namespace WebKit
« no previous file with comments | « Source/web/WorkerPermissionClient.h ('k') | Source/web/web.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698