OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/renderer_host/async_resource_handler.h" | 5 #include "chrome/browser/renderer_host/async_resource_handler.h" |
6 | 6 |
7 #include "base/process.h" | 7 #include "base/process.h" |
| 8 #include "base/shared_memory.h" |
| 9 #include "chrome/common/render_messages.h" |
8 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
9 | 11 |
10 SharedIOBuffer* AsyncResourceHandler::spare_read_buffer_; | 12 SharedIOBuffer* AsyncResourceHandler::spare_read_buffer_; |
11 | 13 |
12 // Our version of IOBuffer that uses shared memory. | 14 // Our version of IOBuffer that uses shared memory. |
13 class SharedIOBuffer : public net::IOBuffer { | 15 class SharedIOBuffer : public net::IOBuffer { |
14 public: | 16 public: |
15 SharedIOBuffer(int buffer_size) : net::IOBuffer(NULL), ok_(false) { | 17 SharedIOBuffer(int buffer_size) : net::IOBuffer(NULL), ok_(false) { |
16 if (shared_memory_.Create(std::wstring(), false, false, buffer_size) && | 18 if (shared_memory_.Create(std::wstring(), false, false, buffer_size) && |
17 shared_memory_.Map(buffer_size)) { | 19 shared_memory_.Map(buffer_size)) { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 } else if (read_buffer_.get()) { | 125 } else if (read_buffer_.get()) { |
124 read_buffer_.swap(&spare_read_buffer_); | 126 read_buffer_.swap(&spare_read_buffer_); |
125 } | 127 } |
126 return true; | 128 return true; |
127 } | 129 } |
128 | 130 |
129 // static | 131 // static |
130 void AsyncResourceHandler::GlobalCleanup() { | 132 void AsyncResourceHandler::GlobalCleanup() { |
131 spare_read_buffer_ = NULL; | 133 spare_read_buffer_ = NULL; |
132 } | 134 } |
OLD | NEW |