diff --git a/third_party/WebKit/Source/modules/webcl/WebCLEvent.cpp b/third_party/WebKit/Source/modules/webcl/WebCLEvent.cpp index c4ac399d9c3f2..f2d4a699fe5c4 100644 --- a/third_party/WebKit/Source/modules/webcl/WebCLEvent.cpp +++ b/third_party/WebKit/Source/modules/webcl/WebCLEvent.cpp @@ -84,18 +84,20 @@ int WebCLEvent::getStatus() return CL_INVALID_VALUE; } -unsigned WebCLEvent::getProfilingInfo(int paramName, ExceptionState& es) +ScriptValue WebCLEvent::getProfilingInfo(ScriptState* scriptState, unsigned paramName, ExceptionState& es) { + v8::Isolate* isolate = scriptState->isolate(); + if (isReleased()) { es.throwWebCLException(WebCLException::INVALID_EVENT, WebCLException::invalidEventMessage); - return 0; + return ScriptValue(scriptState, v8::Null(isolate)); } int status = getStatus(); unsigned properties = m_commandQueue ? m_commandQueue->getProperties() : 0; if (isUserEvent() || status != CL_COMPLETE || !(properties & CL_QUEUE_PROFILING_ENABLE)) { es.throwWebCLException(WebCLException::PROFILING_INFO_NOT_AVAILABLE, WebCLException::profilingInfoNotAvailableMessage); - return 0; + return ScriptValue(scriptState, v8::Null(isolate)); } cl_int err = CL_SUCCESS; @@ -104,30 +106,30 @@ unsigned WebCLEvent::getProfilingInfo(int paramName, ExceptionState& es) case CL_PROFILING_COMMAND_QUEUED: err = clGetEventProfilingInfo(m_clEvent, CL_PROFILING_COMMAND_QUEUED, sizeof(cl_ulong), &ulongUnits, nullptr); if (err == CL_SUCCESS) - return static_cast(ulongUnits); + return ScriptValue(scriptState, v8::Number::New(isolate, static_cast(ulongUnits))); break; case CL_PROFILING_COMMAND_SUBMIT: err = clGetEventProfilingInfo(m_clEvent, CL_PROFILING_COMMAND_SUBMIT, sizeof(cl_ulong), &ulongUnits, nullptr); if (err == CL_SUCCESS) - return static_cast(ulongUnits); + return ScriptValue(scriptState, v8::Number::New(isolate, static_cast(ulongUnits))); break; case CL_PROFILING_COMMAND_START: err = clGetEventProfilingInfo(m_clEvent, CL_PROFILING_COMMAND_START, sizeof(cl_ulong), &ulongUnits, nullptr); if (err == CL_SUCCESS) - return static_cast(ulongUnits); + return ScriptValue(scriptState, v8::Number::New(isolate, static_cast(ulongUnits))); break; case CL_PROFILING_COMMAND_END: err = clGetEventProfilingInfo(m_clEvent, CL_PROFILING_COMMAND_END, sizeof(cl_ulong), &ulongUnits, nullptr); if (err == CL_SUCCESS) - return static_cast(ulongUnits); + return ScriptValue(scriptState, v8::Number::New(isolate, static_cast(ulongUnits))); break; default: es.throwWebCLException(WebCLException::INVALID_VALUE, WebCLException::invalidValueMessage); - return 0; + return ScriptValue(scriptState, v8::Null(isolate)); } WebCLException::throwException(err, es); - return 0; + return ScriptValue(scriptState, v8::Null(isolate)); } void WebCLEvent::setCallback(unsigned commandExecCallbackType, WebCLCallback* callback, ExceptionState& es) diff --git a/third_party/WebKit/Source/modules/webcl/WebCLEvent.h b/third_party/WebKit/Source/modules/webcl/WebCLEvent.h index 2b8415788150f..1b5e49cf21ba1 100644 --- a/third_party/WebKit/Source/modules/webcl/WebCLEvent.h +++ b/third_party/WebKit/Source/modules/webcl/WebCLEvent.h @@ -27,7 +27,7 @@ class WebCLEvent : public WebCLObject, public ScriptWrappable { static PassRefPtr create(); virtual ScriptValue getInfo(ScriptState*, unsigned, ExceptionState&); - unsigned getProfilingInfo(int, ExceptionState&); + virtual ScriptValue getProfilingInfo(ScriptState*, unsigned, ExceptionState&); void setCallback(unsigned, WebCLCallback*, ExceptionState&); void release() override; diff --git a/third_party/WebKit/Source/modules/webcl/WebCLEvent.idl b/third_party/WebKit/Source/modules/webcl/WebCLEvent.idl index acdcf2195f880..94d0142f6bc38 100644 --- a/third_party/WebKit/Source/modules/webcl/WebCLEvent.idl +++ b/third_party/WebKit/Source/modules/webcl/WebCLEvent.idl @@ -8,7 +8,7 @@ typedef unsigned long long CLulong; Constructor, ] interface WebCLEvent { [CallWith=ScriptState, RaisesException] any getInfo(CLenum name); - [RaisesException] CLulong getProfilingInfo(CLenum name); + [CallWith=ScriptState, RaisesException] any getProfilingInfo(CLenum name); [RaisesException] void setCallback(CLenum commandExecCallbackType, WebCLCallback notify); void release();