OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
7 | 7 |
8 #include "chrome/browser/renderer_host/browser_render_process_host.h" | 8 #include "chrome/browser/renderer_host/browser_render_process_host.h" |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 #if defined(OS_WIN) | 910 #if defined(OS_WIN) |
911 // On Windows we need to duplicate the handle from the remote process | 911 // On Windows we need to duplicate the handle from the remote process |
912 HANDLE section = chrome::GetSectionFromProcess( | 912 HANDLE section = chrome::GetSectionFromProcess( |
913 dib_id.handle, GetHandle(), false /* read write */); | 913 dib_id.handle, GetHandle(), false /* read write */); |
914 return TransportDIB::Map(section); | 914 return TransportDIB::Map(section); |
915 #elif defined(OS_MACOSX) | 915 #elif defined(OS_MACOSX) |
916 // On OSX, the browser allocates all DIBs and keeps a file descriptor around | 916 // On OSX, the browser allocates all DIBs and keeps a file descriptor around |
917 // for each. | 917 // for each. |
918 return widget_helper_->MapTransportDIB(dib_id); | 918 return widget_helper_->MapTransportDIB(dib_id); |
919 #elif defined(OS_POSIX) | 919 #elif defined(OS_POSIX) |
920 return TransportDIB::Map(dib_id); | 920 return TransportDIB::Map(dib_id.shmkey); |
921 #endif // defined(OS_POSIX) | 921 #endif // defined(OS_POSIX) |
922 } | 922 } |
923 | 923 |
924 TransportDIB* BrowserRenderProcessHost::GetTransportDIB( | 924 TransportDIB* BrowserRenderProcessHost::GetTransportDIB( |
925 TransportDIB::Id dib_id) { | 925 TransportDIB::Id dib_id) { |
| 926 if (!TransportDIB::is_valid_id(dib_id)) |
| 927 return NULL; |
| 928 |
926 const std::map<TransportDIB::Id, TransportDIB*>::iterator | 929 const std::map<TransportDIB::Id, TransportDIB*>::iterator |
927 i = cached_dibs_.find(dib_id); | 930 i = cached_dibs_.find(dib_id); |
928 if (i != cached_dibs_.end()) { | 931 if (i != cached_dibs_.end()) { |
929 cached_dibs_cleaner_.Reset(); | 932 cached_dibs_cleaner_.Reset(); |
930 return i->second; | 933 return i->second; |
931 } | 934 } |
932 | 935 |
933 TransportDIB* dib = MapTransportDIB(dib_id); | 936 TransportDIB* dib = MapTransportDIB(dib_id); |
934 if (!dib) | 937 if (!dib) |
935 return NULL; | 938 return NULL; |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1301 IPC::PlatformFileForTransit file; | 1304 IPC::PlatformFileForTransit file; |
1302 #if defined(OS_POSIX) | 1305 #if defined(OS_POSIX) |
1303 file = base::FileDescriptor(model_file, false); | 1306 file = base::FileDescriptor(model_file, false); |
1304 #elif defined(OS_WIN) | 1307 #elif defined(OS_WIN) |
1305 ::DuplicateHandle(::GetCurrentProcess(), model_file, GetHandle(), &file, 0, | 1308 ::DuplicateHandle(::GetCurrentProcess(), model_file, GetHandle(), &file, 0, |
1306 false, DUPLICATE_SAME_ACCESS); | 1309 false, DUPLICATE_SAME_ACCESS); |
1307 #endif | 1310 #endif |
1308 Send(new ViewMsg_SetPhishingModel(file)); | 1311 Send(new ViewMsg_SetPhishingModel(file)); |
1309 } | 1312 } |
1310 } | 1313 } |
OLD | NEW |