Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 2038843003: bluetooth: Don't call methods of WebContentsImpl while it's being destroyed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove test Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <utility> 10 #include <utility>
(...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 audio_muter_->StopMuting(); 1214 audio_muter_->StopMuting();
1215 } 1215 }
1216 1216
1217 FOR_EACH_OBSERVER(WebContentsObserver, observers_, 1217 FOR_EACH_OBSERVER(WebContentsObserver, observers_,
1218 DidUpdateAudioMutingState(mute)); 1218 DidUpdateAudioMutingState(mute));
1219 1219
1220 // Notification for UI updates in response to the changed muting state. 1220 // Notification for UI updates in response to the changed muting state.
1221 NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB); 1221 NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB);
1222 } 1222 }
1223 1223
1224 void WebContentsImpl::IncrementBluetoothConnectedDeviceCount() {
1225 // Notify for UI updates if the state changes.
1226 bluetooth_connected_device_count_++;
1227 if (bluetooth_connected_device_count_ == 1) {
1228 NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB);
1229 }
1230 }
1231
1232 void WebContentsImpl::DecrementBluetoothConnectedDeviceCount() {
1233 // Notify for UI updates if the state changes.
1234 DCHECK(bluetooth_connected_device_count_ != 0);
1235 bluetooth_connected_device_count_--;
1236 if (bluetooth_connected_device_count_ == 0) {
1237 NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB);
1238 }
1239 }
1240
1241 bool WebContentsImpl::IsConnectedToBluetoothDevice() const { 1224 bool WebContentsImpl::IsConnectedToBluetoothDevice() const {
1242 return bluetooth_connected_device_count_ > 0; 1225 return bluetooth_connected_device_count_ > 0;
1243 } 1226 }
1244 1227
1245 bool WebContentsImpl::IsCrashed() const { 1228 bool WebContentsImpl::IsCrashed() const {
1246 return (crashed_status_ == base::TERMINATION_STATUS_PROCESS_CRASHED || 1229 return (crashed_status_ == base::TERMINATION_STATUS_PROCESS_CRASHED ||
1247 crashed_status_ == base::TERMINATION_STATUS_ABNORMAL_TERMINATION || 1230 crashed_status_ == base::TERMINATION_STATUS_ABNORMAL_TERMINATION ||
1248 crashed_status_ == base::TERMINATION_STATUS_PROCESS_WAS_KILLED || 1231 crashed_status_ == base::TERMINATION_STATUS_PROCESS_WAS_KILLED ||
1249 #if defined(OS_CHROMEOS) 1232 #if defined(OS_CHROMEOS)
1250 crashed_status_ == 1233 crashed_status_ ==
(...skipping 3798 matching lines...) Expand 10 before | Expand all | Expand 10 after
5049 int number_of_matches, 5032 int number_of_matches,
5050 const gfx::Rect& selection_rect, 5033 const gfx::Rect& selection_rect,
5051 int active_match_ordinal, 5034 int active_match_ordinal,
5052 bool final_update) { 5035 bool final_update) {
5053 if (delegate_) { 5036 if (delegate_) {
5054 delegate_->FindReply(this, request_id, number_of_matches, selection_rect, 5037 delegate_->FindReply(this, request_id, number_of_matches, selection_rect,
5055 active_match_ordinal, final_update); 5038 active_match_ordinal, final_update);
5056 } 5039 }
5057 } 5040 }
5058 5041
5042 void WebContentsImpl::IncrementBluetoothConnectedDeviceCount() {
5043 // Trying to invalidate the tab state while being destroyed could result in a
5044 // use after free.
5045 if (IsBeingDestroyed()) {
5046 return;
5047 }
5048 // Notify for UI updates if the state changes.
5049 bluetooth_connected_device_count_++;
5050 if (bluetooth_connected_device_count_ == 1) {
5051 NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB);
5052 }
5053 }
5054
5055 void WebContentsImpl::DecrementBluetoothConnectedDeviceCount() {
5056 // Trying to invalidate the tab state while being destroyed could result in a
5057 // use after free.
5058 if (IsBeingDestroyed()) {
5059 return;
5060 }
5061 // Notify for UI updates if the state changes.
5062 DCHECK(bluetooth_connected_device_count_ != 0);
5063 bluetooth_connected_device_count_--;
5064 if (bluetooth_connected_device_count_ == 0) {
5065 NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB);
5066 }
5067 }
5068
5059 #if defined(OS_ANDROID) 5069 #if defined(OS_ANDROID)
5060 void WebContentsImpl::NotifyFindMatchRectsReply( 5070 void WebContentsImpl::NotifyFindMatchRectsReply(
5061 int version, 5071 int version,
5062 const std::vector<gfx::RectF>& rects, 5072 const std::vector<gfx::RectF>& rects,
5063 const gfx::RectF& active_rect) { 5073 const gfx::RectF& active_rect) {
5064 if (delegate_) 5074 if (delegate_)
5065 delegate_->FindMatchRectsReply(this, version, rects, active_rect); 5075 delegate_->FindMatchRectsReply(this, version, rects, active_rect);
5066 } 5076 }
5067 #endif 5077 #endif
5068 5078
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
5120 for (RenderViewHost* render_view_host : render_view_host_set) 5130 for (RenderViewHost* render_view_host : render_view_host_set)
5121 render_view_host->OnWebkitPreferencesChanged(); 5131 render_view_host->OnWebkitPreferencesChanged();
5122 } 5132 }
5123 5133
5124 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( 5134 void WebContentsImpl::SetJavaScriptDialogManagerForTesting(
5125 JavaScriptDialogManager* dialog_manager) { 5135 JavaScriptDialogManager* dialog_manager) {
5126 dialog_manager_ = dialog_manager; 5136 dialog_manager_ = dialog_manager;
5127 } 5137 }
5128 5138
5129 } // namespace content 5139 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698