From 93637f5a9e05a9fe93d4d3e035e71b08c440448d Mon Sep 17 00:00:00 2001 From: Per Lundberg Date: Thu, 7 Nov 2013 23:59:50 +0100 Subject: [PATCH] =?UTF-8?q?#209.=20Can=20there=20be=20anything=20more=20fu?= =?UTF-8?q?n=20than=20deleting=20old,=20no=20longer=20used=20code=3F=20I?= =?UTF-8?q?=20don=E2=80=99t=20think=20so.=20:)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CefSharp/ScriptCore.cpp | 52 +---------------------------------------- CefSharp/ScriptCore.h | 2 -- 2 files changed, 1 insertion(+), 53 deletions(-) diff --git a/CefSharp/ScriptCore.cpp b/CefSharp/ScriptCore.cpp index 5b0830f8a..47d22bfb7 100644 --- a/CefSharp/ScriptCore.cpp +++ b/CefSharp/ScriptCore.cpp @@ -31,21 +31,6 @@ namespace CefSharp } } - void ScriptCore::UIT_Evaluate(CefRefPtr browser, CefString script) - { - CefRefPtr mainFrame; - if (TryGetMainFrame(browser, mainFrame)) - { - // TODO: fails, most likely because we are not in the render process. - } - else - { - _exceptionMessage = "Failed to obtain reference to main frame"; - } - - SetEvent(_event); - } - void ScriptCore::Execute(CefRefPtr browser, CefString script) { if (CefCurrentlyOn(TID_UI)) @@ -54,42 +39,7 @@ namespace CefSharp } else { - CefPostTask(TID_UI, NewCefRunnableMethod(this, &ScriptCore::UIT_Execute, - browser, script)); - } - } - - gcroot ScriptCore::Evaluate(CefRefPtr browser, CefString script, DWORD timeout) - { - AutoLock lock_scope(this); - _result = nullptr; - _exceptionMessage = nullptr; - - if (CefCurrentlyOn(TID_UI)) - { - UIT_Evaluate(browser, script); - } - else - { - CefPostTask(TID_UI, NewCefRunnableMethod(this, &ScriptCore::UIT_Evaluate, browser, script)); - } - - switch (WaitForSingleObject(_event, timeout)) - { - case WAIT_TIMEOUT: - throw gcnew ScriptException("Script timed out"); - case WAIT_ABANDONED: - case WAIT_FAILED: - throw gcnew ScriptException("Script error"); - } - - if (_exceptionMessage) - { - throw gcnew ScriptException(_exceptionMessage); - } - else - { - return _result; + CefPostTask(TID_UI, NewCefRunnableMethod(this, &ScriptCore::UIT_Execute, browser, script)); } } } \ No newline at end of file diff --git a/CefSharp/ScriptCore.h b/CefSharp/ScriptCore.h index f2e7fa688..58abf27a8 100644 --- a/CefSharp/ScriptCore.h +++ b/CefSharp/ScriptCore.h @@ -18,7 +18,6 @@ namespace CefSharp bool TryGetMainFrame(CefRefPtr browser, CefRefPtr& frame); void UIT_Execute(CefRefPtr browser, CefString script); - void UIT_Evaluate(CefRefPtr browser, CefString script); public: ScriptCore() @@ -27,7 +26,6 @@ namespace CefSharp } DECL void Execute(CefRefPtr browser, CefString script); - DECL gcroot Evaluate(CefRefPtr browser, CefString script, DWORD timeout); IMPLEMENT_LOCKING(ScriptCore); IMPLEMENT_REFCOUNTING(ScriptCore);