Commit cec48c8f authored by Hwanseung Lee's avatar Hwanseung Lee Committed by Commit Bot

make a static-only class for DOMWindowTimers instead of namespace

Namespace should be lower-cased. DOMWindowTimers Namespace also
should be lower-cased,
and it is used to [ImplementedAs] to implement WindowTimers.
According to Blink IDL extended attributes[1],
it doesn't mention class name's rule.
so it looks like not violate to use snake_case in any rules.

However this CL makes DOMWindowTimers a static-only class
because ImplementedAs=dom_window_timers is inconsistent
with other ImplementedAs instances.

This CL has no behavior changes.

[1]https://chromium.googlesource.com/chromium/src/+/HEAD/third_party/blink/renderer/bindings/IDLExtendedAttributes.md#ImplementedAs_i_m_s_a

Bug: None
Change-Id: Ia1d7305ebc28feb0c50d6b406ab381998959038e
Reviewed-on: https://chromium-review.googlesource.com/c/1307533
Commit-Queue: Hwanseung Lee <hs1217.lee@samsung.com>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#605231}
parent 5b5ea84e
...@@ -46,8 +46,6 @@ ...@@ -46,8 +46,6 @@
namespace blink { namespace blink {
namespace DOMWindowTimers {
static bool IsAllowed(ScriptState* script_state, static bool IsAllowed(ScriptState* script_state,
ExecutionContext* execution_context, ExecutionContext* execution_context,
bool is_eval, bool is_eval,
...@@ -82,11 +80,11 @@ static bool IsAllowed(ScriptState* script_state, ...@@ -82,11 +80,11 @@ static bool IsAllowed(ScriptState* script_state,
return false; return false;
} }
int setTimeout(ScriptState* script_state, int DOMWindowTimers::setTimeout(ScriptState* script_state,
EventTarget& event_target, EventTarget& event_target,
const ScriptValue& handler, const ScriptValue& handler,
int timeout, int timeout,
const Vector<ScriptValue>& arguments) { const Vector<ScriptValue>& arguments) {
ExecutionContext* execution_context = event_target.GetExecutionContext(); ExecutionContext* execution_context = event_target.GetExecutionContext();
if (!IsAllowed(script_state, execution_context, false, g_empty_string)) if (!IsAllowed(script_state, execution_context, false, g_empty_string))
return 0; return 0;
...@@ -101,12 +99,13 @@ int setTimeout(ScriptState* script_state, ...@@ -101,12 +99,13 @@ int setTimeout(ScriptState* script_state,
TimeDelta::FromMilliseconds(timeout), true); TimeDelta::FromMilliseconds(timeout), true);
} }
int setTimeout(ScriptState* script_state, int DOMWindowTimers::setTimeout(
EventTarget& event_target, ScriptState* script_state,
const StringOrTrustedScript& string_or_trusted_script, EventTarget& event_target,
int timeout, const StringOrTrustedScript& string_or_trusted_script,
const Vector<ScriptValue>& arguments, int timeout,
ExceptionState& exception_state) { const Vector<ScriptValue>& arguments,
ExceptionState& exception_state) {
ExecutionContext* execution_context = event_target.GetExecutionContext(); ExecutionContext* execution_context = event_target.GetExecutionContext();
Document* document = execution_context->IsDocument() Document* document = execution_context->IsDocument()
? static_cast<Document*>(execution_context) ? static_cast<Document*>(execution_context)
...@@ -119,11 +118,11 @@ int setTimeout(ScriptState* script_state, ...@@ -119,11 +118,11 @@ int setTimeout(ScriptState* script_state,
arguments); arguments);
} }
int setTimeoutFromString(ScriptState* script_state, int DOMWindowTimers::setTimeoutFromString(ScriptState* script_state,
EventTarget& event_target, EventTarget& event_target,
const String& handler, const String& handler,
int timeout, int timeout,
const Vector<ScriptValue>&) { const Vector<ScriptValue>&) {
ExecutionContext* execution_context = event_target.GetExecutionContext(); ExecutionContext* execution_context = event_target.GetExecutionContext();
if (!IsAllowed(script_state, execution_context, true, handler)) if (!IsAllowed(script_state, execution_context, true, handler))
return 0; return 0;
...@@ -142,11 +141,11 @@ int setTimeoutFromString(ScriptState* script_state, ...@@ -142,11 +141,11 @@ int setTimeoutFromString(ScriptState* script_state,
TimeDelta::FromMilliseconds(timeout), true); TimeDelta::FromMilliseconds(timeout), true);
} }
int setInterval(ScriptState* script_state, int DOMWindowTimers::setInterval(ScriptState* script_state,
EventTarget& event_target, EventTarget& event_target,
const ScriptValue& handler, const ScriptValue& handler,
int timeout, int timeout,
const Vector<ScriptValue>& arguments) { const Vector<ScriptValue>& arguments) {
ExecutionContext* execution_context = event_target.GetExecutionContext(); ExecutionContext* execution_context = event_target.GetExecutionContext();
if (!IsAllowed(script_state, execution_context, false, g_empty_string)) if (!IsAllowed(script_state, execution_context, false, g_empty_string))
return 0; return 0;
...@@ -156,12 +155,13 @@ int setInterval(ScriptState* script_state, ...@@ -156,12 +155,13 @@ int setInterval(ScriptState* script_state,
TimeDelta::FromMilliseconds(timeout), false); TimeDelta::FromMilliseconds(timeout), false);
} }
int setInterval(ScriptState* script_state, int DOMWindowTimers::setInterval(
EventTarget& event_target, ScriptState* script_state,
const StringOrTrustedScript& string_or_trusted_script, EventTarget& event_target,
int timeout, const StringOrTrustedScript& string_or_trusted_script,
const Vector<ScriptValue>& arguments, int timeout,
ExceptionState& exception_state) { const Vector<ScriptValue>& arguments,
ExceptionState& exception_state) {
ExecutionContext* execution_context = event_target.GetExecutionContext(); ExecutionContext* execution_context = event_target.GetExecutionContext();
Document* document = execution_context->IsDocument() Document* document = execution_context->IsDocument()
? static_cast<Document*>(execution_context) ? static_cast<Document*>(execution_context)
...@@ -174,11 +174,11 @@ int setInterval(ScriptState* script_state, ...@@ -174,11 +174,11 @@ int setInterval(ScriptState* script_state,
arguments); arguments);
} }
int setIntervalFromString(ScriptState* script_state, int DOMWindowTimers::setIntervalFromString(ScriptState* script_state,
EventTarget& event_target, EventTarget& event_target,
const String& handler, const String& handler,
int timeout, int timeout,
const Vector<ScriptValue>&) { const Vector<ScriptValue>&) {
ExecutionContext* execution_context = event_target.GetExecutionContext(); ExecutionContext* execution_context = event_target.GetExecutionContext();
if (!IsAllowed(script_state, execution_context, true, handler)) if (!IsAllowed(script_state, execution_context, true, handler))
return 0; return 0;
...@@ -192,16 +192,14 @@ int setIntervalFromString(ScriptState* script_state, ...@@ -192,16 +192,14 @@ int setIntervalFromString(ScriptState* script_state,
TimeDelta::FromMilliseconds(timeout), false); TimeDelta::FromMilliseconds(timeout), false);
} }
void clearTimeout(EventTarget& event_target, int timeout_id) { void DOMWindowTimers::clearTimeout(EventTarget& event_target, int timeout_id) {
if (ExecutionContext* context = event_target.GetExecutionContext()) if (ExecutionContext* context = event_target.GetExecutionContext())
DOMTimer::RemoveByID(context, timeout_id); DOMTimer::RemoveByID(context, timeout_id);
} }
void clearInterval(EventTarget& event_target, int timeout_id) { void DOMWindowTimers::clearInterval(EventTarget& event_target, int timeout_id) {
if (ExecutionContext* context = event_target.GetExecutionContext()) if (ExecutionContext* context = event_target.GetExecutionContext())
DOMTimer::RemoveByID(context, timeout_id); DOMTimer::RemoveByID(context, timeout_id);
} }
} // namespace DOMWindowTimers
} // namespace blink } // namespace blink
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_DOM_WINDOW_TIMERS_H_ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_DOM_WINDOW_TIMERS_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_DOM_WINDOW_TIMERS_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_DOM_WINDOW_TIMERS_H_
#include "third_party/blink/renderer/platform/wtf/allocator.h"
#include "third_party/blink/renderer/platform/wtf/forward.h" #include "third_party/blink/renderer/platform/wtf/forward.h"
#include "third_party/blink/renderer/platform/wtf/vector.h" #include "third_party/blink/renderer/platform/wtf/vector.h"
...@@ -44,42 +45,45 @@ class ScriptState; ...@@ -44,42 +45,45 @@ class ScriptState;
class ScriptValue; class ScriptValue;
class StringOrTrustedScript; class StringOrTrustedScript;
namespace DOMWindowTimers { class DOMWindowTimers {
int setTimeout(ScriptState*, STATIC_ONLY(DOMWindowTimers);
EventTarget&,
const ScriptValue& handler, public:
int timeout, static int setTimeout(ScriptState*,
const Vector<ScriptValue>& arguments); EventTarget&,
int setTimeout(ScriptState*, const ScriptValue& handler,
EventTarget&, int timeout,
const StringOrTrustedScript&, const Vector<ScriptValue>& arguments);
int timeout, static int setTimeout(ScriptState*,
const Vector<ScriptValue>&, EventTarget&,
ExceptionState&); const StringOrTrustedScript&,
int setTimeoutFromString(ScriptState*, int timeout,
const Vector<ScriptValue>&,
ExceptionState&);
static int setTimeoutFromString(ScriptState*,
EventTarget&,
const String& handler,
int timeout,
const Vector<ScriptValue>&);
static int setInterval(ScriptState*,
EventTarget&, EventTarget&,
const String& handler, const ScriptValue& handler,
int timeout, int timeout,
const Vector<ScriptValue>&); const Vector<ScriptValue>&);
int setInterval(ScriptState*, static int setInterval(ScriptState*,
EventTarget&, EventTarget&,
const ScriptValue& handler, const StringOrTrustedScript&,
int timeout, int timeout,
const Vector<ScriptValue>&); const Vector<ScriptValue>&,
int setInterval(ScriptState*, ExceptionState&);
EventTarget&, static int setIntervalFromString(ScriptState*,
const StringOrTrustedScript&, EventTarget&,
int timeout, const String& handler,
const Vector<ScriptValue>&, int timeout,
ExceptionState&); const Vector<ScriptValue>&);
int setIntervalFromString(ScriptState*, static void clearTimeout(EventTarget&, int timeout_id);
EventTarget&, static void clearInterval(EventTarget&, int timeout_id);
const String& handler, };
int timeout,
const Vector<ScriptValue>&);
void clearTimeout(EventTarget&, int timeout_id);
void clearInterval(EventTarget&, int timeout_id);
}
} // namespace blink } // namespace blink
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment