Skip to content

Commit

Permalink
- Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
oceanlantern committed Jan 13, 2020
1 parent ba3cd38 commit 9819e45
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/content/browser/renderer_host/system_info_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ void SystemInfoImpl::Create(
// process called from Blink/Renderer process
//
// This function queries the operating system name using the abstracted base APIs.
// The callback is run and the lambda callback and the lambda callback
// function is executed in Blink/Renderer process
// The callback is run and the lambda callback function is executed in Blink/Renderer
// process
//
//=============================================================================

Expand Down
23 changes: 5 additions & 18 deletions src/third_party/blink/renderer/modules/systeminfo/system_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ namespace blink
// Create
//
//=============================================================================

SystemInfo *SystemInfo::Create(ExecutionContext *context,
ExceptionState &exception_state)
{
Expand All @@ -45,6 +46,7 @@ SystemInfo *SystemInfo::Create(ExecutionContext *context,
// Create
//
//=============================================================================

SystemInfo *SystemInfo::Create(ExecutionContext *context,
const SystemInfoOptions *options,
ExceptionState &exception_state)
Expand Down Expand Up @@ -105,10 +107,8 @@ SystemInfo::~SystemInfo() = default;

ScriptPromise SystemInfo::start(ScriptState *script_state, ExceptionState &exception_state)
{

if (!GetExecutionContext() || GetExecutionContext()->IsContextDestroyed())
{

return ScriptPromise::RejectWithDOMException(
script_state,
MakeGarbageCollected<DOMException>(DOMExceptionCode::kNotAllowedError));
Expand All @@ -124,7 +124,6 @@ ScriptPromise SystemInfo::start(ScriptState *script_state, ExceptionState &excep

if (state_ != State::kInactive)
{

return ScriptPromise::RejectWithDOMException(
script_state,
MakeGarbageCollected<DOMException>(DOMExceptionCode::kInvalidStateError));
Expand All @@ -142,7 +141,6 @@ ScriptPromise SystemInfo::start(ScriptState *script_state, ExceptionState &excep
bool result) {
if (result)
{

VLOG(1) << "SystemInfo::start succeeded";

systemInfo->state_ = State::kActive;
Expand All @@ -153,14 +151,12 @@ ScriptPromise SystemInfo::start(ScriptState *script_state, ExceptionState &excep
}
else
{

VLOG(0) << "SystemInfo::start failed " << result;

resolver->Reject(
MakeGarbageCollected<DOMException>(DOMExceptionCode::kNotSupportedError, (char *)"SystemInfo::start failed"));
}
},
WrapPersistent(this), WrapPersistent(resolver)));
}, WrapPersistent(this), WrapPersistent(resolver)));

return resolver_result;
}
Expand Down Expand Up @@ -188,7 +184,6 @@ ScriptPromise SystemInfo::stop(ScriptState *script_state, ExceptionState &except

if (!GetExecutionContext() || GetExecutionContext()->IsContextDestroyed())
{

return ScriptPromise::RejectWithDOMException(
script_state,
MakeGarbageCollected<DOMException>(DOMExceptionCode::kNotAllowedError));
Expand All @@ -204,7 +199,6 @@ ScriptPromise SystemInfo::stop(ScriptState *script_state, ExceptionState &except

if (state_ != State::kActive)
{

return ScriptPromise::RejectWithDOMException(
script_state,
MakeGarbageCollected<DOMException>(DOMExceptionCode::kInvalidStateError));
Expand All @@ -226,8 +220,7 @@ ScriptPromise SystemInfo::stop(ScriptState *script_state, ExceptionState &except
SystemInfo->ScheduleDispatchEvent(Event::Create(event_type_names::kStop));

resolver->Resolve(true);
},
WrapPersistent(this), WrapPersistent(resolver)));
}, WrapPersistent(this), WrapPersistent(resolver)));

return resolver_result;
}
Expand All @@ -252,10 +245,8 @@ ScriptPromise SystemInfo::stop(ScriptState *script_state, ExceptionState &except

ScriptPromise SystemInfo::getOperatingSystemName(ScriptState *script_state, ExceptionState &exception_state)
{

if (!GetExecutionContext() || GetExecutionContext()->IsContextDestroyed())
{

return ScriptPromise::RejectWithDOMException(
script_state,
MakeGarbageCollected<DOMException>(DOMExceptionCode::kNotAllowedError));
Expand Down Expand Up @@ -288,21 +279,18 @@ ScriptPromise SystemInfo::getOperatingSystemName(ScriptState *script_state, Exce
const WTF::String &result) {
if (result.length())
{

VLOG(1) << "SystemInfo::GetOperatingSystemName succeeded";

resolver->Resolve(result);
}
else
{

VLOG(0) << "SystemInfo::GetOperatingSystemName failed " << result;

resolver->Reject(
MakeGarbageCollected<DOMException>(DOMExceptionCode::kNotSupportedError, (char *)"SystemInfo::start failed"));
}
},
WrapPersistent(this), WrapPersistent(resolver)));
}, WrapPersistent(this), WrapPersistent(resolver)));

return resolver_result;
}
Expand All @@ -319,7 +307,6 @@ ExecutionContext *SystemInfo::GetExecutionContext() const

void SystemInfo::Shutdown()
{

if (state_ != State::kInactive)
{
ScheduleDispatchEvent(Event::Create(event_type_names::kStop));
Expand Down

0 comments on commit 9819e45

Please sign in to comment.