| OLD | NEW |
| 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/renderer_host/java/java_bridge_dispatcher_host_manager
.h" | 5 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager
.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host.h" | 9 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" |
| 11 | 11 |
| 12 using content::RenderViewHost; | 12 namespace content { |
| 13 | 13 |
| 14 JavaBridgeDispatcherHostManager::JavaBridgeDispatcherHostManager( | 14 JavaBridgeDispatcherHostManager::JavaBridgeDispatcherHostManager( |
| 15 content::WebContents* web_contents) | 15 WebContents* web_contents) |
| 16 : content::WebContentsObserver(web_contents) { | 16 : WebContentsObserver(web_contents) { |
| 17 } | 17 } |
| 18 | 18 |
| 19 JavaBridgeDispatcherHostManager::~JavaBridgeDispatcherHostManager() { | 19 JavaBridgeDispatcherHostManager::~JavaBridgeDispatcherHostManager() { |
| 20 for (ObjectMap::iterator iter = objects_.begin(); iter != objects_.end(); | 20 for (ObjectMap::iterator iter = objects_.begin(); iter != objects_.end(); |
| 21 ++iter) { | 21 ++iter) { |
| 22 WebKit::WebBindings::releaseObject(iter->second); | 22 WebKit::WebBindings::releaseObject(iter->second); |
| 23 } | 23 } |
| 24 DCHECK_EQ(0U, instances_.size()); | 24 DCHECK_EQ(0U, instances_.size()); |
| 25 } | 25 } |
| 26 | 26 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 instances_[render_view_host] = instance; | 69 instances_[render_view_host] = instance; |
| 70 } | 70 } |
| 71 | 71 |
| 72 void JavaBridgeDispatcherHostManager::RenderViewDeleted( | 72 void JavaBridgeDispatcherHostManager::RenderViewDeleted( |
| 73 RenderViewHost* render_view_host) { | 73 RenderViewHost* render_view_host) { |
| 74 instances_.erase(render_view_host); | 74 instances_.erase(render_view_host); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void JavaBridgeDispatcherHostManager::WebContentsDestroyed( | 77 void JavaBridgeDispatcherHostManager::WebContentsDestroyed( |
| 78 content::WebContents* web_contents) { | 78 WebContents* web_contents) { |
| 79 // When a WebContents is shutting down, it clears its observers before | 79 // When a WebContents is shutting down, it clears its observers before |
| 80 // it kills all of its RenderViewHosts, so we won't get a call to | 80 // it kills all of its RenderViewHosts, so we won't get a call to |
| 81 // RenderViewDeleted() for all RenderViewHosts. | 81 // RenderViewDeleted() for all RenderViewHosts. |
| 82 instances_.clear(); | 82 instances_.clear(); |
| 83 } | 83 } |
| 84 |
| 85 } // namespace content |
| OLD | NEW |