fix: use webContentsId with contextId together

After after using `processId-contextCounter` as contextId, it may happen
that contexts in different WebContents sharing the same renderer process
get the same contextId. Using webContentsId as part of key in
ObjectsRegistry can fix this.
This commit is contained in:
Cheng Zhao 2018-07-20 10:21:44 +09:00
parent 136cf389e8
commit 04b7c77951
7 changed files with 22 additions and 53 deletions

View file

@ -1,19 +0,0 @@
// Copyright (c) 2018 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "atom/common/context_counter.h"
namespace atom {
namespace {
int g_context_id = 0;
} // namespace
int GetNextContextId() {
return ++g_context_id;
}
} // namespace atom

View file

@ -1,15 +0,0 @@
// Copyright (c) 2018 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_COMMON_CONTEXT_COUNTER_H_
#define ATOM_COMMON_CONTEXT_COUNTER_H_
namespace atom {
// Increase the context counter, and return current count.
int GetNextContextId();
} // namespace atom
#endif // ATOM_COMMON_CONTEXT_COUNTER_H_