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

Side by Side Diff: chrome/browser/chromeos/drive/local_file_reader.cc

Issue 641223004: Adding instrumentation to locate the source of jankiness. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | net/base/file_stream_context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/chromeos/drive/local_file_reader.h" 5 #include "chrome/browser/chromeos/drive/local_file_reader.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/profiler/scoped_profile.h"
9 #include "base/sequenced_task_runner.h" 10 #include "base/sequenced_task_runner.h"
10 #include "net/base/completion_callback.h" 11 #include "net/base/completion_callback.h"
11 #include "net/base/io_buffer.h" 12 #include "net/base/io_buffer.h"
12 #include "net/base/net_errors.h" 13 #include "net/base/net_errors.h"
13 14
14 namespace drive { 15 namespace drive {
15 namespace util { 16 namespace util {
16 17
17 LocalFileReader::LocalFileReader( 18 LocalFileReader::LocalFileReader(
18 base::SequencedTaskRunner* sequenced_task_runner) 19 base::SequencedTaskRunner* sequenced_task_runner)
(...skipping 23 matching lines...) Expand all
42 const net::CompletionCallback& callback) { 43 const net::CompletionCallback& callback) {
43 DCHECK(!callback.is_null()); 44 DCHECK(!callback.is_null());
44 DCHECK(file_stream_.IsOpen()); 45 DCHECK(file_stream_.IsOpen());
45 int rv = file_stream_.Read(in_buffer, buffer_length, callback); 46 int rv = file_stream_.Read(in_buffer, buffer_length, callback);
46 DCHECK_EQ(rv, net::ERR_IO_PENDING); 47 DCHECK_EQ(rv, net::ERR_IO_PENDING);
47 } 48 }
48 49
49 void LocalFileReader::DidOpen(const net::CompletionCallback& callback, 50 void LocalFileReader::DidOpen(const net::CompletionCallback& callback,
50 int64 offset, 51 int64 offset,
51 int error) { 52 int error) {
53 // TODO(vadimt): Remove ScopedProfile below once crbug.com/423948 is fixed.
54 tracked_objects::ScopedProfile tracking_profile(
55 FROM_HERE_WITH_EXPLICIT_FUNCTION("423948 LocalFileReader::DidOpen"));
56
52 if (error != net::OK) 57 if (error != net::OK)
53 return callback.Run(error); 58 return callback.Run(error);
54 59
55 int rv = file_stream_.Seek(base::File::FROM_BEGIN, offset, 60 int rv = file_stream_.Seek(base::File::FROM_BEGIN, offset,
56 Bind(&LocalFileReader::DidSeek, 61 Bind(&LocalFileReader::DidSeek,
57 weak_ptr_factory_.GetWeakPtr(), 62 weak_ptr_factory_.GetWeakPtr(),
58 callback, offset)); 63 callback, offset));
59 DCHECK_EQ(rv, net::ERR_IO_PENDING); 64 DCHECK_EQ(rv, net::ERR_IO_PENDING);
60 } 65 }
61 66
62 void LocalFileReader::DidSeek(const net::CompletionCallback& callback, 67 void LocalFileReader::DidSeek(const net::CompletionCallback& callback,
63 int64 offset, 68 int64 offset,
64 int64 error) { 69 int64 error) {
65 callback.Run(error == offset ? net::OK : net::ERR_FAILED); 70 callback.Run(error == offset ? net::OK : net::ERR_FAILED);
66 } 71 }
67 72
68 } // namespace util 73 } // namespace util
69 } // namespace drive 74 } // namespace drive
OLDNEW
« no previous file with comments | « no previous file | net/base/file_stream_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698