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

Unified Diff: ui/gfx/surface/transport_dib_win.cc

Issue 10351002: ui: Move surface/ directory out of gfx/, up to ui/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix gpu DEPS Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/surface/transport_dib_mac.cc ('k') | ui/surface/OWNERS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/surface/transport_dib_win.cc
diff --git a/ui/gfx/surface/transport_dib_win.cc b/ui/gfx/surface/transport_dib_win.cc
deleted file mode 100644
index a7df666863e27f93decf4cc4f45c2f8166ec2ddb..0000000000000000000000000000000000000000
--- a/ui/gfx/surface/transport_dib_win.cc
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/gfx/surface/transport_dib.h"
-
-#include <windows.h>
-
-#include <limits>
-
-#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/sys_info.h"
-#include "skia/ext/platform_canvas.h"
-
-TransportDIB::TransportDIB() {
-}
-
-TransportDIB::~TransportDIB() {
-}
-
-TransportDIB::TransportDIB(HANDLE handle)
- : shared_memory_(handle, false /* read write */) {
-}
-
-// static
-TransportDIB* TransportDIB::Create(size_t size, uint32 sequence_num) {
- size_t allocation_granularity = base::SysInfo::VMAllocationGranularity();
- size = size / allocation_granularity + 1;
- size = size * allocation_granularity;
-
- TransportDIB* dib = new TransportDIB;
-
- if (!dib->shared_memory_.CreateAnonymous(size)) {
- delete dib;
- return NULL;
- }
-
- dib->size_ = size;
- dib->sequence_num_ = sequence_num;
-
- return dib;
-}
-
-// static
-TransportDIB* TransportDIB::Map(Handle handle) {
- scoped_ptr<TransportDIB> dib(CreateWithHandle(handle));
- if (!dib->Map())
- return NULL;
- return dib.release();
-}
-
-// static
-TransportDIB* TransportDIB::CreateWithHandle(Handle handle) {
- return new TransportDIB(handle);
-}
-
-// static
-bool TransportDIB::is_valid_handle(Handle dib) {
- return dib != NULL;
-}
-
-// static
-bool TransportDIB::is_valid_id(TransportDIB::Id id) {
- return is_valid_handle(id.handle);
-}
-
-skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h) {
- // This DIB already mapped the file into this process, but PlatformCanvas
- // will map it again.
- DCHECK(!memory()) << "Mapped file twice in the same process.";
-
- scoped_ptr<skia::PlatformCanvas> canvas(new skia::PlatformCanvas);
- if (!canvas->initialize(w, h, true, handle()))
- return NULL;
- return canvas.release();
-}
-
-bool TransportDIB::Map() {
- if (!is_valid_handle(handle()))
- return false;
- if (memory())
- return true;
-
- if (!shared_memory_.Map(0 /* map whole shared memory segment */)) {
- LOG(ERROR) << "Failed to map transport DIB"
- << " handle:" << shared_memory_.handle()
- << " error:" << ::GetLastError();
- return false;
- }
-
- // There doesn't seem to be any way to find the size of the shared memory
- // region! GetFileSize indicates that the handle is invalid. Thus, we
- // conservatively set the size to the maximum and hope that the renderer
- // isn't about to ask us to read off the end of the array.
- size_ = std::numeric_limits<size_t>::max();
- return true;
-}
-
-void* TransportDIB::memory() const {
- return shared_memory_.memory();
-}
-
-TransportDIB::Handle TransportDIB::handle() const {
- return shared_memory_.handle();
-}
-
-TransportDIB::Id TransportDIB::id() const {
- return Id(handle(), sequence_num_);
-}
« no previous file with comments | « ui/gfx/surface/transport_dib_mac.cc ('k') | ui/surface/OWNERS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698