Make devtools_web_contents_ is destroyed before everything

The WebContentsDestroyed still access the other members, so if they are
destroyed before the devtools_web_contents_ in the destructor, we will
crash there.
This commit is contained in:
Cheng Zhao 2015-06-09 10:41:25 +08:00
Родитель 418264d42a
Коммит 64c4a34507
2 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -159,10 +159,10 @@ void InspectableWebContentsImpl::RegisterPrefs(PrefRegistrySimple* registry) {
InspectableWebContentsImpl::InspectableWebContentsImpl(
content::WebContents* web_contents)
: web_contents_(web_contents),
frontend_loaded_(false),
: frontend_loaded_(false),
can_dock_(true),
delegate_(nullptr),
web_contents_(web_contents),
weak_factory_(this) {
auto context = static_cast<BrowserContext*>(web_contents_->GetBrowserContext());
auto bounds_dict = context->prefs()->GetDictionary(kDevToolsBoundsPref);

Просмотреть файл

@ -147,10 +147,6 @@ class InspectableWebContentsImpl :
void SendMessageAck(int request_id,
const base::Value* arg1);
scoped_ptr<content::WebContents> web_contents_;
scoped_ptr<content::WebContents> devtools_web_contents_;
scoped_ptr<InspectableWebContentsView> view_;
bool frontend_loaded_;
scoped_refptr<content::DevToolsAgentHost> agent_host_;
scoped_ptr<content::DevToolsFrontendHost> frontend_host_;
@ -160,10 +156,14 @@ class InspectableWebContentsImpl :
gfx::Rect devtools_bounds_;
bool can_dock_;
InspectableWebContentsDelegate* delegate_; // weak references.
using PendingRequestsMap = std::map<const net::URLFetcher*, DispatchCallback>;
PendingRequestsMap pending_requests_;
InspectableWebContentsDelegate* delegate_; // weak references.
scoped_ptr<InspectableWebContentsView> view_;
scoped_ptr<content::WebContents> web_contents_;
scoped_ptr<content::WebContents> devtools_web_contents_;
base::WeakPtrFactory<InspectableWebContentsImpl> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(InspectableWebContentsImpl);