Fix a memory leak that happen on some video files The memory leak was introduced by BufferedDataSource, the cause of the leak: 1. Some video files have read patterns that BufferedResourceLoader cannot    provide data buffer with, thus a large amount of BufferedResourceLoader    is created and destroyed. 2. In the destruction of BufferedResourceLoader, it cancels the resource    request and immediately deletes the ResourceLoaderBridge. 3. The request canceled in the renderer process isn't cancalled immediately    in the browser process, at the mean time browser process still sends    shared memory buffers to the renderer process. 4. When these shared memory buffers arrived at the renderer process, the    ResourceLoaderBridge associated with the requst has already been destroyed,    ResourceDispatcher can't find the associated ResourceLoaderBridge and simply    delete the message. But the IPC message is not POD, it contains the handle    to shared memory that should be closed. 5. End result is a lot of memory are shared to the renderer process but they    are not closed.
Fix a memory leak that happen on some video files
The memory leak was introduced by BufferedDataSource, the cause of the leak:
1. Some video files have read patterns that BufferedResourceLoader cannot
   provide data buffer with, thus a large amount of BufferedResourceLoader
   is created and destroyed.
2. In the destruction of BufferedResourceLoader, it cancels the resource
   request and immediately deletes the ResourceLoaderBridge.
3. The request canceled in the renderer process isn't cancalled immediately
   in the browser process, at the mean time browser process still sends
   shared memory buffers to the renderer process.
4. When these shared memory buffers arrived at the renderer process, the
   ResourceLoaderBridge associated with the requst has already been destroyed,
   ResourceDispatcher can't find the associated ResourceLoaderBridge and simply
   delete the message. But the IPC message is not POD, it contains the handle
   to shared memory that should be closed.
5. End result is a lot of memory are shared to the renderer process but they
   are not closed.

Solutions:
1. Delete ResourceLoaderBridge only at OnCompletedResponse.
   Delete ResourceLoaderBridge at OnCompletedResponse, it is guranteed that
   no more shared memory buffer will arrive after this point, so it's safe
   to delete ResourceLoaderBridge. The downside is the lifetime of
   BufferedResourceLoader is prolonged until OnCompletedResponse is received,
   which may never is received in case of timeout for certain protocol..
2. Inside ResourceDispatcer, close the handles to shared memory even if
   ResourceLoaderBridge is not found.

I'm going for route 1. The problem I mentioned in 2 also sounds like a bug in
ResourceDispatcher, will talk to erickay or eroman to find a solution.

Review URL: http://codereview.chromium.org/100302

git-svn-id: http://src.chromium.org/svn/trunk/src@15304 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

Former-commit-id: 8e48efd17f669f7405eb249d3508ae65751959fa
meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser