Commit c4ad2033 authored by Hans Wennborg's avatar Hans Wennborg Committed by Commit Bot

Fix -Wshadow warning for DOMWrapperWorld enumerations

New Clang versions started taking enumerations into account for the -Wshadow warning:

../../third_party/blink/renderer/platform/bindings/dom_wrapper_world.h:62:5:
warning: declaration shadows a variable in namespace 'blink' [-Wshadow]
    kEmbedderWorldIdLimit = IsolatedWorldId::kEmbedderWorldIdLimit,
    ^
../../third_party/blink/public/platform/web_isolated_world_ids.h:12:3: note:
previous declaration is here
  kEmbedderWorldIdLimit = (1 << 29),
  ^

../../third_party/blink/renderer/platform/bindings/dom_wrapper_world.h:63:5:
warning: declaration shadows a variable in namespace 'blink' [-Wshadow]
    kIsolatedWorldIdLimit = IsolatedWorldId::kIsolatedWorldIdLimit,
    ^
../../third_party/blink/public/platform/web_isolated_world_ids.h:16:3: note:
previous declaration is here
  kIsolatedWorldIdLimit,
  ^

Bug: 895475
Change-Id: Idb37a14a6d7ca92b1e6bfa1d2fa3f42ffe64fe38
Reviewed-on: https://chromium-review.googlesource.com/c/1283024
Commit-Queue: Hans Wennborg <hans@chromium.org>
Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600141}
parent e84c59dd
...@@ -23,9 +23,9 @@ Vector<scoped_refptr<DOMWrapperWorld>> CreateIsolatedWorlds( ...@@ -23,9 +23,9 @@ Vector<scoped_refptr<DOMWrapperWorld>> CreateIsolatedWorlds(
v8::Isolate* isolate) { v8::Isolate* isolate) {
Vector<scoped_refptr<DOMWrapperWorld>> worlds; Vector<scoped_refptr<DOMWrapperWorld>> worlds;
worlds.push_back(DOMWrapperWorld::EnsureIsolatedWorld( worlds.push_back(DOMWrapperWorld::EnsureIsolatedWorld(
isolate, DOMWrapperWorld::WorldId::kMainWorldId + 1)); isolate, DOMWrapperWorld::kMainWorldId + 1));
worlds.push_back(DOMWrapperWorld::EnsureIsolatedWorld( worlds.push_back(DOMWrapperWorld::EnsureIsolatedWorld(
isolate, DOMWrapperWorld::WorldId::kIsolatedWorldIdLimit - 1)); isolate, DOMWrapperWorld::kDOMWrapperWorldEmbedderWorldIdLimit - 1));
EXPECT_TRUE(worlds[0]->IsIsolatedWorld()); EXPECT_TRUE(worlds[0]->IsIsolatedWorld());
EXPECT_TRUE(worlds[1]->IsIsolatedWorld()); EXPECT_TRUE(worlds[1]->IsIsolatedWorld());
return worlds; return worlds;
......
...@@ -689,7 +689,7 @@ void WebLocalFrameImpl::ExecuteScriptInIsolatedWorld( ...@@ -689,7 +689,7 @@ void WebLocalFrameImpl::ExecuteScriptInIsolatedWorld(
const WebScriptSource& source_in) { const WebScriptSource& source_in) {
DCHECK(GetFrame()); DCHECK(GetFrame());
CHECK_GT(world_id, 0); CHECK_GT(world_id, 0);
CHECK_LT(world_id, DOMWrapperWorld::kEmbedderWorldIdLimit); CHECK_LT(world_id, DOMWrapperWorld::kDOMWrapperWorldEmbedderWorldIdLimit);
// Note: An error event in an isolated world will never be dispatched to // Note: An error event in an isolated world will never be dispatched to
// a foreign world. // a foreign world.
...@@ -704,7 +704,7 @@ WebLocalFrameImpl::ExecuteScriptInIsolatedWorldAndReturnValue( ...@@ -704,7 +704,7 @@ WebLocalFrameImpl::ExecuteScriptInIsolatedWorldAndReturnValue(
const WebScriptSource& source_in) { const WebScriptSource& source_in) {
DCHECK(GetFrame()); DCHECK(GetFrame());
CHECK_GT(world_id, 0); CHECK_GT(world_id, 0);
CHECK_LT(world_id, DOMWrapperWorld::kEmbedderWorldIdLimit); CHECK_LT(world_id, DOMWrapperWorld::kDOMWrapperWorldEmbedderWorldIdLimit);
// Note: An error event in an isolated world will never be dispatched to // Note: An error event in an isolated world will never be dispatched to
// a foreign world. // a foreign world.
...@@ -850,7 +850,7 @@ void WebLocalFrameImpl::RequestExecuteScriptInIsolatedWorld( ...@@ -850,7 +850,7 @@ void WebLocalFrameImpl::RequestExecuteScriptInIsolatedWorld(
WebScriptExecutionCallback* callback) { WebScriptExecutionCallback* callback) {
DCHECK(GetFrame()); DCHECK(GetFrame());
CHECK_GT(world_id, 0); CHECK_GT(world_id, 0);
CHECK_LT(world_id, DOMWrapperWorld::kEmbedderWorldIdLimit); CHECK_LT(world_id, DOMWrapperWorld::kDOMWrapperWorldEmbedderWorldIdLimit);
scoped_refptr<DOMWrapperWorld> isolated_world = scoped_refptr<DOMWrapperWorld> isolated_world =
DOMWrapperWorld::EnsureIsolatedWorld(ToIsolate(GetFrame()), world_id); DOMWrapperWorld::EnsureIsolatedWorld(ToIsolate(GetFrame()), world_id);
......
...@@ -56,7 +56,7 @@ static WorldMap& GetWorldMap() { ...@@ -56,7 +56,7 @@ static WorldMap& GetWorldMap() {
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
static bool IsIsolatedWorldId(int world_id) { static bool IsIsolatedWorldId(int world_id) {
return DOMWrapperWorld::kMainWorldId < world_id && return DOMWrapperWorld::kMainWorldId < world_id &&
world_id < DOMWrapperWorld::kIsolatedWorldIdLimit; world_id < DOMWrapperWorld::kDOMWrapperWorldIsolatedWorldIdLimit;
} }
static bool IsMainWorldId(int world_id) { static bool IsMainWorldId(int world_id) {
......
...@@ -59,8 +59,10 @@ class PLATFORM_EXPORT DOMWrapperWorld : public RefCounted<DOMWrapperWorld> { ...@@ -59,8 +59,10 @@ class PLATFORM_EXPORT DOMWrapperWorld : public RefCounted<DOMWrapperWorld> {
kInvalidWorldId = -1, kInvalidWorldId = -1,
kMainWorldId = 0, kMainWorldId = 0,
kEmbedderWorldIdLimit = IsolatedWorldId::kEmbedderWorldIdLimit, kDOMWrapperWorldEmbedderWorldIdLimit =
kIsolatedWorldIdLimit = IsolatedWorldId::kIsolatedWorldIdLimit, IsolatedWorldId::kEmbedderWorldIdLimit,
kDOMWrapperWorldIsolatedWorldIdLimit =
IsolatedWorldId::kIsolatedWorldIdLimit,
// Other worlds can use IDs after this. Don't manually pick up an ID from // Other worlds can use IDs after this. Don't manually pick up an ID from
// this range. generateWorldIdForType() picks it up on behalf of you. // this range. generateWorldIdForType() picks it up on behalf of you.
......
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